davispeixoto/Force.com-Toolkit-for-PHP

View on GitHub

Showing 20 of 30 total issues

File SforceBaseClient.php has 673 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php namespace Davispeixoto\ForceDotComToolkitForPhp;

    /*
     * Copyright (c) 2007, salesforce.com, inc.
     * All rights reserved.
Severity: Major
Found in src/Davispeixoto/ForceDotComToolkitForPhp/SforceBaseClient.php - About 1 day to fix

    Function __construct has a Cognitive Complexity of 73 (exceeds 5 allowed). Consider refactoring.
    Open

        public function __construct($response = null)
        {
            if (!isset($response) && !$response) {
                return;
            }
    Severity: Minor
    Found in src/Davispeixoto/ForceDotComToolkitForPhp/SObject.php - About 1 day to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function xml2array has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring.
    Open

        public function xml2array($contents, $get_attributes = 1)
        {
            if (!$contents) {
                return array();
            }
    Severity: Minor
    Found in src/Davispeixoto/ForceDotComToolkitForPhp/SObject.php - About 1 day to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    SforceBaseClient has 63 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class SforceBaseClient
    {
        protected $sforce;
        protected $sessionId;
        protected $location;
    Severity: Major
    Found in src/Davispeixoto/ForceDotComToolkitForPhp/SforceBaseClient.php - About 1 day to fix

      Function setHeaders has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
      Open

          private function setHeaders($call = null)
          {
              $this->sforce->__setSoapHeaders(null);
      
              $header_array = array(
      Severity: Minor
      Found in src/Davispeixoto/ForceDotComToolkitForPhp/SforceBaseClient.php - About 4 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Method setHeaders has 108 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function setHeaders($call = null)
          {
              $this->sforce->__setSoapHeaders(null);
      
              $header_array = array(
      Severity: Major
      Found in src/Davispeixoto/ForceDotComToolkitForPhp/SforceBaseClient.php - About 4 hrs to fix

        Method xml2array has 87 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function xml2array($contents, $get_attributes = 1)
            {
                if (!$contents) {
                    return array();
                }
        Severity: Major
        Found in src/Davispeixoto/ForceDotComToolkitForPhp/SObject.php - About 3 hrs to fix

          SforceCustomField has 28 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class SforceCustomField
          {
              public function setCaseSensitive($caseSensitive)
              {
                  $this->caseSensitive = $caseSensitive;
          Severity: Minor
          Found in src/Davispeixoto/ForceDotComToolkitForPhp/SforceCustomField.php - About 3 hrs to fix

            Method __construct has 70 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function __construct($response = null)
                {
                    if (!isset($response) && !$response) {
                        return;
                    }
            Severity: Major
            Found in src/Davispeixoto/ForceDotComToolkitForPhp/SObject.php - About 2 hrs to fix

              Function __construct has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function __construct($response)
                  {
                      if ($response instanceof SforceSearchResult) {
                          $this->searchRecords = $response->searchRecords;
                      } else {
              Severity: Minor
              Found in src/Davispeixoto/ForceDotComToolkitForPhp/SforceSearchResult.php - About 1 hr to fix

              Cognitive Complexity

              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

              A method's cognitive complexity is based on a few simple rules:

              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
              • Code is considered more complex for each "break in the linear flow of the code"
              • Code is considered more complex when "flow breaking structures are nested"

              Further reading

              Function __construct has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function __construct($response)
                  {
                      $this->queryLocator = $response->queryLocator;
                      $this->done = $response->done;
                      $this->size = $response->size;
              Severity: Minor
              Found in src/Davispeixoto/ForceDotComToolkitForPhp/QueryResult.php - About 1 hr to fix

              Cognitive Complexity

              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

              A method's cognitive complexity is based on a few simple rules:

              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
              • Code is considered more complex for each "break in the linear flow of the code"
              • Code is considered more complex when "flow breaking structures are nested"

              Further reading

              Method __construct has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function __construct($wsdl, $loginResult, $sforceConn)
                  {
                      $soapClientArray = null;
              
                      $phpversion = substr(PHP_VERSION, 0, strpos(PHP_VERSION, '-'));
              Severity: Minor
              Found in src/Davispeixoto/ForceDotComToolkitForPhp/SforceMetadataClient.php - About 1 hr to fix

                Function update has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function update($sObjects, $type, $assignment_header = null, $mru_header = null)
                    {
                        $arg = new stdClass;
                        $arg->sObjects = [];
                        foreach ($sObjects as $sObject) {
                Severity: Minor
                Found in src/Davispeixoto/ForceDotComToolkitForPhp/SforceEnterpriseClient.php - About 55 mins to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Function upsert has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function upsert($ext_Id, $sObjects, $type = 'Contact')
                    {
                        $arg = new stdClass;
                        $arg->sObjects = [];
                        $arg->externalIDFieldName = new SoapVar($ext_Id, XSD_STRING, 'string', 'http://www.w3.org/2001/XMLSchema');
                Severity: Minor
                Found in src/Davispeixoto/ForceDotComToolkitForPhp/SforceEnterpriseClient.php - About 55 mins to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Function create has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function create($sObjects, $type)
                    {
                        $arg = [];
                        foreach ($sObjects as $sObject) {
                            // FIX for fieldsToNull issue - allow array in fieldsToNull (STEP #1)
                Severity: Minor
                Found in src/Davispeixoto/ForceDotComToolkitForPhp/SforceEnterpriseClient.php - About 55 mins to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Function convertLead has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function convertLead($leadConverts)
                    {
                        $this->setHeaders("convertLead");
                        $arg = new stdClass();
                        
                Severity: Minor
                Found in src/Davispeixoto/ForceDotComToolkitForPhp/SforceBaseClient.php - About 45 mins to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Function valid has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function valid()
                    {
                        while ($this->pointer >= count($this->records)) {
                            // Pointer is larger than (current) result set; see if we can fetch more
                            if ($this->done === false) {
                Severity: Minor
                Found in src/Davispeixoto/ForceDotComToolkitForPhp/QueryResult.php - About 45 mins to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Consider simplifying this complex logical expression.
                Open

                        if ($call == "create" ||
                            $call == "merge" ||
                            $call == "query" ||
                            $call == "retrieve" ||
                            $call == "update" ||
                Severity: Major
                Found in src/Davispeixoto/ForceDotComToolkitForPhp/SforceBaseClient.php - About 40 mins to fix

                  Consider simplifying this complex logical expression.
                  Open

                                      if ((is_array($current[$tag]) && $get_attributes == 0)//If it is already an array...
                                          || (isset($current[$tag][0]) && is_array($current[$tag][0]) && ($get_attributes == 1 || $get_attributes == 2))
                                      ) {
                                          array_push($current[$tag], $result); // ...push the new element into that array.
                                      } else { //If it is not an array...
                  Severity: Major
                  Found in src/Davispeixoto/ForceDotComToolkitForPhp/SObject.php - About 40 mins to fix

                    Method __doRequest has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        public function __doRequest($request, $location, $action, $version, $one_way = 0)
                    Severity: Minor
                    Found in src/Davispeixoto/ForceDotComToolkitForPhp/SforceSoapClient.php - About 35 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language