comsave/soap-client

View on GitHub

Showing 18 of 18 total issues

File Client.php has 401 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace Phpforce\SoapClient;

use Phpforce\Common\AbstractHasDispatcher;
Severity: Minor
Found in src/Phpforce/SoapClient/Client.php - About 5 hrs to fix

    Client has 41 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Client extends AbstractHasDispatcher implements ClientInterface
    {
        /*
         * SOAP namespace
         *
    Severity: Minor
    Found in src/Phpforce/SoapClient/Client.php - About 5 hrs to fix

      Field has 35 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class Field
      {
          protected $autoNumber;
          protected $byteLength;
          protected $calculated;
      Severity: Minor
      Found in src/Phpforce/SoapClient/Result/DescribeSObjectResult/Field.php - About 4 hrs to fix

        DescribeSObjectResult has 26 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class DescribeSObjectResult
        {
            protected $activateable;
            protected $childRelationships;
            protected $createable;
        Severity: Minor
        Found in src/Phpforce/SoapClient/Result/DescribeSObjectResult.php - About 3 hrs to fix

          Function getSoapTypes has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
          Open

              public function getSoapTypes()
              {
                  if (null === $this->types) {
          
                      $soapTypes = $this->__getTypes();
          Severity: Minor
          Found in src/Phpforce/SoapClient/Soap/SoapClient.php - About 2 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

          GetUserInfoResult has 22 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class GetUserInfoResult
          {
              protected $accessibilityMode;
          
              protected $currencySymbol;
          Severity: Minor
          Found in src/Phpforce/SoapClient/Result/GetUserInfoResult.php - About 2 hrs to fix

            Function createSObject has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function createSObject($object, $objectType)
                {
                    $sObject = new \stdClass();
            
                    foreach (get_object_vars($object) as $field => $value) {
            Severity: Minor
            Found in src/Phpforce/SoapClient/Client.php - About 2 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 createSObject has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function createSObject($object, $objectType)
                {
                    $sObject = new \stdClass();
            
                    foreach (get_object_vars($object) as $field => $value) {
            Severity: Minor
            Found in src/Phpforce/SoapClient/Client.php - About 1 hr to fix

              Function merge has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function merge(array $mergeRequests, $type)
                  {
                      foreach ($mergeRequests as $mergeRequest) {
                          if (!($mergeRequest instanceof Request\MergeRequest)) {
                              throw new \InvalidArgumentException(
              Severity: Minor
              Found in src/Phpforce/SoapClient/Client.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 flush has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function flush()
                  {
                      if (count($this->bulkDeleteRecords) > 0) {
                          $this->results['deleted'] = array_merge($this->results['deleted'], $this->flushDeletes());
                      }
              Severity: Minor
              Found in src/Phpforce/SoapClient/BulkSaver.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 merge has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function merge(array $mergeRequests, $type)
                  {
                      foreach ($mergeRequests as $mergeRequest) {
                          if (!($mergeRequest instanceof Request\MergeRequest)) {
                              throw new \InvalidArgumentException(
              Severity: Minor
              Found in src/Phpforce/SoapClient/Client.php - About 1 hr to fix

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

                    protected function checkResult(array $results, array $params)
                    {
                        $exceptions = new Exception\SaveException();
                
                        for ($i = 0; $i < count($results); $i++) {
                Severity: Minor
                Found in src/Phpforce/SoapClient/Client.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

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                    private function addBulkCreateRecord($record, $objectType)
                    {
                        if (isset($this->bulkCreateRecords[$objectType])
                            && count($this->bulkCreateRecords[$objectType]) == $this->bulkSaveLimit) {
                            $this->results['created'] = array_merge($this->results['created'], $this->flushCreates($objectType));
                Severity: Minor
                Found in src/Phpforce/SoapClient/BulkSaver.php and 1 other location - About 55 mins to fix
                src/Phpforce/SoapClient/BulkSaver.php on lines 207..215

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 98.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                    private function addBulkUpdateRecord($sObject, $objectType)
                    {
                        if (isset($this->bulkUpdateRecords[$objectType])
                            && count($this->bulkUpdateRecords[$objectType]) == $this->bulkSaveLimit) {
                            $this->results['updated'] = array_merge($this->results['updated'], $this->flushUpdates($objectType));
                Severity: Minor
                Found in src/Phpforce/SoapClient/BulkSaver.php and 1 other location - About 55 mins to fix
                src/Phpforce/SoapClient/BulkSaver.php on lines 175..183

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 98.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Method __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    public function __construct($wsdl, $username, $password, $token, array $soapOptions = array(), $environment = 'prod')
                Severity: Minor
                Found in src/Phpforce/SoapClient/ClientBuilder.php - About 45 mins to fix

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

                      protected function call($method, array $params = array())
                      {
                          $this->init();
                  
                          // Prepare headers
                  Severity: Minor
                  Found in src/Phpforce/SoapClient/Client.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 getObjectAt has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      protected function getObjectAt($pointer)
                      {
                          if ($this->queryResult->getRecord($pointer)) {
                              $this->current = $this->queryResult->getRecord($pointer);
                  
                  
                  Severity: Minor
                  Found in src/Phpforce/SoapClient/Result/RecordIterator.php - About 35 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 createSoapVars has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      protected function createSoapVars(array $objects, $type)
                      {
                          $soapVars = array();
                  
                          foreach ($objects as $object) {
                  Severity: Minor
                  Found in src/Phpforce/SoapClient/Client.php - About 25 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

                  Severity
                  Category
                  Status
                  Source
                  Language