Object parameters should be type hinted 18

More information: https://insight.symfony.com/what-we-analyse/php.object_parameter_not_type_hinted

  1. * login and password
  2. * @param array $soap_options (optional) Additional options to send to the
  3. * SoapClient constructor. @see
  4. * http://php.net/manual/en/soapclient.soapclient.php
  5. */
  6. public function createConnection($wsdl, $proxy = null, $soap_options = array())

    The parameter proxy, which is an object, should be typehinted.

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Davis L P Peixoto
  7. {
  8. // use correct version comparison
  9. if (version_compare(phpversion(), '5.3', '<')) {
  10. throw new Exception ('PHP versions older than 5.3 are no longer supported. Please upgrade!');
  11. }
  1. $this->sforce = $this->getSoapClient($wsdl, $soapClientArray);
  2. return $this->sforce;
  3. }
  4. public function setCallOptions($header)

    The parameter header, which is an object, should be typehinted.

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Davis L P Peixoto
  5. {
  6. if ($header != null) {
  7. $this->callOptions = new SoapHeader($this->namespace, 'CallOptions', array(
  8. 'client' => $header->client,
  9. 'defaultNamespace' => $header->defaultNamespace
  1. /**
  2. * Specifies the session ID returned from the login server after a successful
  3. * login.
  4. */
  5. protected function _setLoginHeader($loginResult)

    The parameter loginResult, which is an object, should be typehinted.

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Davis L P Peixoto
  6. {
  7. $this->sessionId = $loginResult->sessionId;
  8. $this->setSessionHeader($this->sessionId);
  9. $serverURL = $loginResult->serverUrl;
  10. $this->setEndPoint($serverURL);
  1. }
  2. $this->sforce->__setSoapHeaders($header_array);
  3. }
  4. public function setAssignmentRuleHeader($header)

    The parameter header, which is an object, should be typehinted.

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Davis L P Peixoto
  5. {
  6. if ($header != null) {
  7. $this->assignmentRuleHeader = new SoapHeader($this->namespace, 'AssignmentRuleHeader', array(
  8. 'assignmentRuleId' => $header->assignmentRuleId,
  9. 'useDefaultRule' => $header->useDefaultRuleFlag
  1. } else {
  2. $this->assignmentRuleHeader = null;
  3. }
  4. }
  5. public function setEmailHeader($header)

    The parameter header, which is an object, should be typehinted.

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Davis L P Peixoto
  6. {
  7. if ($header != null) {
  8. $this->emailHeader = new SoapHeader($this->namespace, 'EmailHeader', array(
  9. 'triggerAutoResponseEmail' => $header->triggerAutoResponseEmail,
  10. 'triggerOtherEmail' => $header->triggerOtherEmail,
  1. } else {
  2. $this->emailHeader = null;
  3. }
  4. }
  5. public function setLoginScopeHeader($header)

    The parameter header, which is an object, should be typehinted.

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Davis L P Peixoto
  6. {
  7. if ($header != null) {
  8. $this->loginScopeHeader = new SoapHeader($this->namespace, 'LoginScopeHeader', array(
  9. 'organizationId' => $header->organizationId,
  10. 'portalId' => $header->portalId
  1. } else {
  2. $this->loginScopeHeader = null;
  3. }
  4. }
  5. public function setMruHeader($header)

    The parameter header, which is an object, should be typehinted.

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Davis L P Peixoto
  6. {
  7. if ($header != null) {
  8. $this->mruHeader = new SoapHeader($this->namespace, 'MruHeader', array(
  9. 'updateMru' => $header->updateMruFlag
  10. ));
  1. $this->sessionHeader = null;
  2. $this->sessionId = null;
  3. }
  4. }
  5. public function setUserTerritoryDeleteHeader($header)

    The parameter header, which is an object, should be typehinted.

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Davis L P Peixoto
  6. {
  7. if ($header != null) {
  8. $this->userTerritoryDeleteHeader = new SoapHeader($this->namespace, 'UserTerritoryDeleteHeader ', array(
  9. 'transferToUserId' => $header->transferToUserId
  10. ));
  1. } else {
  2. $this->userTerritoryDeleteHeader = null;
  3. }
  4. }
  5. public function setQueryOptions($header)

    The parameter header, which is an object, should be typehinted.

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Davis L P Peixoto
  6. {
  7. if ($header != null) {
  8. $this->queryHeader = new SoapHeader($this->namespace, 'QueryOptions', array(
  9. 'batchSize' => $header->batchSize
  10. ));
  1. } else {
  2. $this->queryHeader = null;
  3. }
  4. }
  5. public function setAllowFieldTruncationHeader($header)

    The parameter header, which is an object, should be typehinted.

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Davis L P Peixoto
  6. {
  7. if ($header != null) {
  8. $this->allowFieldTruncationHeader = new SoapHeader($this->namespace, 'AllowFieldTruncationHeader', array(
  9. 'allowFieldTruncation' => $header->allowFieldTruncation
  10. )
  1. } else {
  2. $this->allowFieldTruncationHeader = null;
  3. }
  4. }
  5. public function setLocaleOptions($header)

    The parameter header, which is an object, should be typehinted.

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Davis L P Peixoto
  6. {
  7. if ($header != null) {
  8. $this->localeOptions = new SoapHeader($this->namespace, 'LocaleOptions',
  9. array(
  10. 'language' => $header->language
  1. }
  2. /**
  3. * @param $header
  4. */
  5. public function setPackageVersionHeader($header)

    The parameter header, which is an object, should be typehinted.

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Davis L P Peixoto
  6. {
  7. if ($header != null) {
  8. $headerData = array('packageVersions' => array());
  9. foreach ($header->packageVersions as $key => $hdrElem) {
  1. *
  2. * @param string $query Query String
  3. * @param QueryOptions $queryOptions Batch size limit. OPTIONAL
  4. * @return QueryResult
  5. */
  6. public function query($query)

    The parameter query, which is an object, should be typehinted.

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Davis L P Peixoto
  7. {
  8. $this->setHeaders("query");
  9. $raw = $this->sforce->query(array(
  10. 'queryString' => $query
  11. ))->result;
  1. protected $location;
  2. protected $version = '27.0';
  3. protected $namespace = 'http://soap.sforce.com/2006/04/metadata';
  4. public function __construct($wsdl, $loginResult, $sforceConn)

    The parameter loginResult, which is an object, should be typehinted.

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Davis L P Peixoto
  5. {
  6. $soapClientArray = null;
  7. $phpversion = substr(phpversion(), 0, strpos(phpversion(), '-'));
  8. if ($phpversion > '5.1.2') {
  1. /**
  2. * Specifies the session ID returned from the login server after a successful
  3. * login.
  4. */
  5. protected function _setLoginHeader($loginResult)

    The parameter loginResult, which is an object, should be typehinted.

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Davis L P Peixoto
  6. {
  7. $this->sessionId = $loginResult->sessionId;
  8. $this->setSessionHeader($this->sessionId);
  9. $serverURL = $loginResult->serverUrl;
  10. $this->setEndPoint($serverURL);
  1. $encodedObj->metadata = new SoapVar($obj, SOAP_ENC_OBJECT, $this->getObjtype($obj), $this->namespace);
  2. return $this->sforce->create($encodedObj);
  3. }
  4. public function update($obj)

    The parameter obj, which is an object, should be typehinted.

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Davis L P Peixoto
  5. {
  6. $encodedObj = new stdClass();
  7. $encodedObj->UpdateMetadata = $obj;
  8. $encodedObj->UpdateMetadata->metadata = new SoapVar($obj->metadata, SOAP_ENC_OBJECT,
  9. $this->getObjtype($obj->metadata), $this->namespace);
  1. }
  2. /*
  3. * If the stdClass has a done, we know it is a QueryResult
  4. */
  5. public function isQueryResult($param)

    The parameter param, which is an object, should be typehinted.

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Davis L P Peixoto
  6. {
  7. return isset($param->done);
  8. }
  9. /*
  1. }
  2. /*
  3. * If the stdClass has a type, we know it is an SObject
  4. */
  5. public function isSObject($param)

    The parameter param, which is an object, should be typehinted.

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Davis L P Peixoto
  6. {
  7. return isset($param->type);
  8. }
  9. }

Booleans and null should be compared strictly 26

More information: https://insight.symfony.com/what-we-analyse/php.strict_boolean_comparison_should_be_used

  1. 'features' => SOAP_SINGLE_ELEMENT_ARRAYS,
  2. 'compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP
  3. ), $soap_options);
  4. if ($proxy != null) {

    With booleans and null, only strict comparison (with !== operator) should be used to lower bug risks and to improve performances.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Davis L P Peixoto
  5. $proxySettings = array();
  6. $proxySettings['proxy_host'] = $proxy->host;
  7. $proxySettings['proxy_port'] = $proxy->port; // Use an integer, not a string
  8. $proxySettings['proxy_login'] = $proxy->login;
  9. $proxySettings['proxy_password'] = $proxy->password;
  1. return $this->sforce;
  2. }
  3. public function setCallOptions($header)
  4. {
  5. if ($header != null) {

    With booleans and null, only strict comparison (with !== operator) should be used to lower bug risks and to improve performances.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Davis L P Peixoto
  6. $this->callOptions = new SoapHeader($this->namespace, 'CallOptions', array(
  7. 'client' => $header->client,
  8. 'defaultNamespace' => $header->defaultNamespace
  9. ));
  10. } else {
  1. * @return LoginResult
  2. */
  3. public function login($username, $password)
  4. {
  5. $this->sforce->__setSoapHeaders(null);
  6. if ($this->callOptions != null) {

    With booleans and null, only strict comparison (with !== operator) should be used to lower bug risks and to improve performances.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Davis L P Peixoto
  7. $this->sforce->__setSoapHeaders(array($this->callOptions));
  8. }
  9. if ($this->loginScopeHeader != null) {
  10. $this->sforce->__setSoapHeaders(array($this->loginScopeHeader));
  11. }
  1. {
  2. $this->sforce->__setSoapHeaders(null);
  3. if ($this->callOptions != null) {
  4. $this->sforce->__setSoapHeaders(array($this->callOptions));
  5. }
  6. if ($this->loginScopeHeader != null) {

    With booleans and null, only strict comparison (with !== operator) should be used to lower bug risks and to improve performances.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Davis L P Peixoto
  7. $this->sforce->__setSoapHeaders(array($this->loginScopeHeader));
  8. }
  9. $result = $this->sforce->login(array(
  10. 'username' => $username,
  11. 'password' => $password
  1. $header_array = array(
  2. $this->sessionHeader
  3. );
  4. $header = $this->callOptions;
  5. if ($header != null) {

    With booleans and null, only strict comparison (with !== operator) should be used to lower bug risks and to improve performances.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Davis L P Peixoto
  6. array_push($header_array, $header);
  7. }
  8. if ($call == "create" ||
  9. $call == "merge" ||
  1. $call == "merge" ||
  2. $call == "update" ||
  3. $call == "upsert"
  4. ) {
  5. $header = $this->assignmentRuleHeader;
  6. if ($header != null) {

    With booleans and null, only strict comparison (with !== operator) should be used to lower bug risks and to improve performances.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Davis L P Peixoto
  7. array_push($header_array, $header);
  8. }
  9. }
  10. if ($call == "login") {
  1. }
  2. }
  3. if ($call == "login") {
  4. $header = $this->loginScopeHeader;
  5. if ($header != null) {

    With booleans and null, only strict comparison (with !== operator) should be used to lower bug risks and to improve performances.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Davis L P Peixoto
  6. array_push($header_array, $header);
  7. }
  8. }
  9. if ($call == "create" ||
  1. $call == "resetPassword" ||
  2. $call == "update" ||
  3. $call == "upsert"
  4. ) {
  5. $header = $this->emailHeader;
  6. if ($header != null) {

    With booleans and null, only strict comparison (with !== operator) should be used to lower bug risks and to improve performances.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Davis L P Peixoto
  7. array_push($header_array, $header);
  8. }
  9. }
  10. if ($call == "create" ||
  1. $call == "retrieve" ||
  2. $call == "update" ||
  3. $call == "upsert"
  4. ) {
  5. $header = $this->mruHeader;
  6. if ($header != null) {

    With booleans and null, only strict comparison (with !== operator) should be used to lower bug risks and to improve performances.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Davis L P Peixoto
  7. array_push($header_array, $header);
  8. }
  9. }
  10. if ($call == "delete") {
  1. }
  2. }
  3. if ($call == "delete") {
  4. $header = $this->userTerritoryDeleteHeader;
  5. if ($header != null) {

    With booleans and null, only strict comparison (with !== operator) should be used to lower bug risks and to improve performances.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Davis L P Peixoto
  6. array_push($header_array, $header);
  7. }
  8. }
  9. if ($call == "query" ||
  1. if ($call == "query" ||
  2. $call == "queryMore" ||
  3. $call == "retrieve"
  4. ) {
  5. $header = $this->queryHeader;
  6. if ($header != null) {

    With booleans and null, only strict comparison (with !== operator) should be used to lower bug risks and to improve performances.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Davis L P Peixoto
  7. array_push($header_array, $header);
  8. }
  9. }
  10. // try to add allowFieldTruncationHeader
  1. 'update',
  2. 'upsert',
  3. );
  4. if (in_array($call, $allowFieldTruncationHeaderCalls)) {
  5. $header = $this->allowFieldTruncationHeader;
  6. if ($header != null) {

    With booleans and null, only strict comparison (with !== operator) should be used to lower bug risks and to improve performances.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Davis L P Peixoto
  7. array_push($header_array, $header);
  8. }
  9. }
  10. // try to add localeOptions
  1. }
  2. // try to add localeOptions
  3. if ($call == 'describeSObject' || $call == 'describeSObjects') {
  4. $header = $this->localeOptions;
  5. if ($header != null) {

    With booleans and null, only strict comparison (with !== operator) should be used to lower bug risks and to improve performances.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Davis L P Peixoto
  6. array_push($header_array, $header);
  7. }
  8. }
  9. // try to add PackageVersionHeader
  1. 'upsert',
  2. );
  3. if (in_array($call, $packageVersionHeaderCalls)) {
  4. $header = $this->packageVersionHeader;
  5. if ($header != null) {

    With booleans and null, only strict comparison (with !== operator) should be used to lower bug risks and to improve performances.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Davis L P Peixoto
  6. array_push($header_array, $header);
  7. }
  8. }
  9. $this->sforce->__setSoapHeaders($header_array);
  1. $this->sforce->__setSoapHeaders($header_array);
  2. }
  3. public function setAssignmentRuleHeader($header)
  4. {
  5. if ($header != null) {

    With booleans and null, only strict comparison (with !== operator) should be used to lower bug risks and to improve performances.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Davis L P Peixoto
  6. $this->assignmentRuleHeader = new SoapHeader($this->namespace, 'AssignmentRuleHeader', array(
  7. 'assignmentRuleId' => $header->assignmentRuleId,
  8. 'useDefaultRule' => $header->useDefaultRuleFlag
  9. ));
  10. } else {
  1. }
  2. }
  3. public function setEmailHeader($header)
  4. {
  5. if ($header != null) {

    With booleans and null, only strict comparison (with !== operator) should be used to lower bug risks and to improve performances.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Davis L P Peixoto
  6. $this->emailHeader = new SoapHeader($this->namespace, 'EmailHeader', array(
  7. 'triggerAutoResponseEmail' => $header->triggerAutoResponseEmail,
  8. 'triggerOtherEmail' => $header->triggerOtherEmail,
  9. 'triggerUserEmail' => $header->triggerUserEmail
  10. ));
  1. }
  2. }
  3. public function setLoginScopeHeader($header)
  4. {
  5. if ($header != null) {

    With booleans and null, only strict comparison (with !== operator) should be used to lower bug risks and to improve performances.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Davis L P Peixoto
  6. $this->loginScopeHeader = new SoapHeader($this->namespace, 'LoginScopeHeader', array(
  7. 'organizationId' => $header->organizationId,
  8. 'portalId' => $header->portalId
  9. ));
  10. } else {
  1. }
  2. }
  3. public function setMruHeader($header)
  4. {
  5. if ($header != null) {

    With booleans and null, only strict comparison (with !== operator) should be used to lower bug risks and to improve performances.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Davis L P Peixoto
  6. $this->mruHeader = new SoapHeader($this->namespace, 'MruHeader', array(
  7. 'updateMru' => $header->updateMruFlag
  8. ));
  9. } else {
  10. $this->mruHeader = null;
  1. }
  2. }
  3. public function setSessionHeader($id)
  4. {
  5. if ($id != null) {

    With booleans and null, only strict comparison (with !== operator) should be used to lower bug risks and to improve performances.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Davis L P Peixoto
  6. $this->sessionHeader = new SoapHeader($this->namespace, 'SessionHeader', array(
  7. 'sessionId' => $id
  8. ));
  9. $this->sessionId = $id;
  10. } else {
  1. }
  2. }
  3. public function setUserTerritoryDeleteHeader($header)
  4. {
  5. if ($header != null) {

    With booleans and null, only strict comparison (with !== operator) should be used to lower bug risks and to improve performances.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Davis L P Peixoto
  6. $this->userTerritoryDeleteHeader = new SoapHeader($this->namespace, 'UserTerritoryDeleteHeader ', array(
  7. 'transferToUserId' => $header->transferToUserId
  8. ));
  9. } else {
  10. $this->userTerritoryDeleteHeader = null;
  1. }
  2. }
  3. public function setQueryOptions($header)
  4. {
  5. if ($header != null) {

    With booleans and null, only strict comparison (with !== operator) should be used to lower bug risks and to improve performances.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Davis L P Peixoto
  6. $this->queryHeader = new SoapHeader($this->namespace, 'QueryOptions', array(
  7. 'batchSize' => $header->batchSize
  8. ));
  9. } else {
  10. $this->queryHeader = null;
  1. }
  2. }
  3. public function setAllowFieldTruncationHeader($header)
  4. {
  5. if ($header != null) {

    With booleans and null, only strict comparison (with !== operator) should be used to lower bug risks and to improve performances.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Davis L P Peixoto
  6. $this->allowFieldTruncationHeader = new SoapHeader($this->namespace, 'AllowFieldTruncationHeader', array(
  7. 'allowFieldTruncation' => $header->allowFieldTruncation
  8. )
  9. );
  10. } else {
  1. }
  2. }
  3. public function setLocaleOptions($header)
  4. {
  5. if ($header != null) {

    With booleans and null, only strict comparison (with !== operator) should be used to lower bug risks and to improve performances.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Davis L P Peixoto
  6. $this->localeOptions = new SoapHeader($this->namespace, 'LocaleOptions',
  7. array(
  8. 'language' => $header->language
  9. )
  10. );
  1. /**
  2. * @param $header
  3. */
  4. public function setPackageVersionHeader($header)
  5. {
  6. if ($header != null) {

    With booleans and null, only strict comparison (with !== operator) should be used to lower bug risks and to improve performances.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Davis L P Peixoto
  7. $headerData = array('packageVersions' => array());
  8. foreach ($header->packageVersions as $key => $hdrElem) {
  9. $headerData['packageVersions'][] = array(
  10. 'majorNumber' => $hdrElem->majorNumber,
  1. * @param int $id AssignmentRuleId
  2. * @param boolean $flag UseDefaultRule flag
  3. */
  4. public function __construct($id = null, $flag = null)
  5. {
  6. if ($id != null) {

    With booleans and null, only strict comparison (with !== operator) should be used to lower bug risks and to improve performances.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Davis L P Peixoto
  7. $this->assignmentRuleId = $id;
  8. }
  9. if ($flag != null) {
  10. $this->useDefaultRuleFlag = $flag;
  1. {
  2. if ($id != null) {
  3. $this->assignmentRuleId = $id;
  4. }
  5. if ($flag != null) {

    With booleans and null, only strict comparison (with !== operator) should be used to lower bug risks and to improve performances.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Davis L P Peixoto
  6. $this->useDefaultRuleFlag = $flag;
  7. }
  8. }
  9. }

Unused method, property, variable or parameter 7

More information: https://insight.symfony.com/what-we-analyse/php.unused_local_variable_or_private_member

  1. * @return LogoutResult
  2. */
  3. public function logout()
  4. {
  5. $this->setHeaders("logout");
  6. $arg = new stdClass();

    This arg local variable is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Davis L P Peixoto
  7. return $this->sforce->logout();
  8. }
  9. /**
  1. * @return invalidateSessionsResult
  2. */
  3. public function invalidateSessions()
  4. {
  5. $this->setHeaders("invalidateSessions");
  6. $arg = new stdClass();

    This arg local variable is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Davis L P Peixoto
  7. $this->logout();
  8. return $this->sforce->invalidateSessions();
  9. }
  1. *
  2. * @param String $query Query String
  3. * @param QueryOptions $queryOptions Batch size limit. OPTIONAL
  4. * @return QueryResult
  5. */
  6. public function queryAll($query, $queryOptions = null)

    This queryOptions argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Davis L P Peixoto
  7. {
  8. $this->setHeaders("queryAll");
  9. $raw = $this->sforce->queryAll(array(
  10. 'queryString' => $query
  11. ))->result;
  1. protected $location;
  2. protected $version = '27.0';
  3. protected $namespace = 'http://soap.sforce.com/2006/04/metadata';
  4. public function __construct($wsdl, $loginResult, $sforceConn)

    This sforceConn argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Davis L P Peixoto
  5. {
  6. $soapClientArray = null;
  7. $phpversion = substr(phpversion(), 0, strpos(phpversion(), '-'));
  8. if ($phpversion > '5.1.2') {
  1. return;
  2. }
  3. //Initializations
  4. $xml_array = array();
  5. $parents = array();

    This parents local variable is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Davis L P Peixoto
  6. $opened_tags = array();
  7. $arr = array();
  8. $current = &$xml_array;
  1. }
  2. //Initializations
  3. $xml_array = array();
  4. $parents = array();
  5. $opened_tags = array();

    This opened_tags local variable is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Davis L P Peixoto
  6. $arr = array();
  7. $current = &$xml_array;
  8. foreach ($xml_values as $data) {
  1. //Initializations
  2. $xml_array = array();
  3. $parents = array();
  4. $opened_tags = array();
  5. $arr = array();

    This arr local variable is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Davis L P Peixoto
  6. $current = &$xml_array;
  7. foreach ($xml_values as $data) {
  8. unset($attributes, $value);//Remove existing values, or there will be trouble

PHP code should follow PSR-1 basic coding standard 11

More information: https://insight.symfony.com/what-we-analyse/php.psr1

  1. /**
  2. * Specifies the session ID returned from the login server after a successful
  3. * login.
  4. */
  5. protected function _setLoginHeader($loginResult)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Davis L P Peixoto
  6. {
  7. $this->sessionId = $loginResult->sessionId;
  8. $this->setSessionHeader($this->sessionId);
  9. $serverURL = $loginResult->serverUrl;
  10. $this->setEndPoint($serverURL);
  1. public function getLastResponseHeaders()
  2. {
  3. return $this->sforce->__getLastResponseHeaders();
  4. }
  5. protected function _convertToAny($fields)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Davis L P Peixoto
  6. {
  7. $anyString = '';
  8. foreach ($fields as $key => $value) {
  9. $anyString = $anyString . '<' . $key . '>' . $value . '</' . $key . '>';
  10. }
  1. }
  2. return $anyString;
  3. }
  4. protected function _create($arg)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Davis L P Peixoto
  5. {
  6. $this->setHeaders("create");
  7. return $this->sforce->create($arg)->result;
  8. }
  1. $this->setHeaders("create");
  2. return $this->sforce->create($arg)->result;
  3. }
  4. protected function _merge($arg)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Davis L P Peixoto
  5. {
  6. $this->setHeaders("merge");
  7. return $this->sforce->merge($arg)->result;
  8. }
  1. $this->setHeaders("merge");
  2. return $this->sforce->merge($arg)->result;
  3. }
  4. protected function _process($arg)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Davis L P Peixoto
  5. {
  6. $this->setHeaders();
  7. return $this->sforce->process($arg)->result;
  8. }
  1. $this->setHeaders();
  2. return $this->sforce->process($arg)->result;
  3. }
  4. protected function _update($arg)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Davis L P Peixoto
  5. {
  6. $this->setHeaders("update");
  7. return $this->sforce->update($arg)->result;
  8. }
  1. $this->setHeaders("update");
  2. return $this->sforce->update($arg)->result;
  3. }
  4. protected function _upsert($arg)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Davis L P Peixoto
  5. {
  6. $this->setHeaders("upsert");
  7. return $this->sforce->upsert($arg)->result;
  8. }
  1. error_log('Please pass in array to this function: ' . $backtrace[0]['function']);
  2. return false;
  3. }
  4. }
  5. protected function _sendEmail($arg)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Davis L P Peixoto
  6. {
  7. $this->setHeaders();
  8. return $this->sforce->sendEmail($arg)->result;
  9. }
  1. /**
  2. * Specifies the session ID returned from the login server after a successful
  3. * login.
  4. */
  5. protected function _setLoginHeader($loginResult)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Davis L P Peixoto
  6. {
  7. $this->sessionId = $loginResult->sessionId;
  8. $this->setSessionHeader($this->sessionId);
  9. $serverURL = $loginResult->serverUrl;
  10. $this->setEndPoint($serverURL);
  1. */
  2. class SforcePartnerClient extends SforceBaseClient
  3. {
  4. const PARTNER_NAMESPACE = 'urn:partner.soap.sforce.com';
  5. function SforcePartnerClient()

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Davis L P Peixoto
  6. {
  7. $this->namespace = self::PARTNER_NAMESPACE;
  8. }
  9. protected function getSoapClient($wsdl, $options)
  1. /**
  2. *
  3. * @param mixed $response
  4. * @return array
  5. */
  6. private function _retrieveResult($response)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Davis L P Peixoto
  7. {
  8. $arr = array();
  9. if (is_array($response)) {
  10. foreach ($response as $r) {
  11. $sobject = new SObject($r);