comsave/salesforce-mapper-bundle

View on GitHub

Showing 38 of 38 total issues

Method save has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function save($model)
    {
        if (is_array($model)) {
            $models = $model;
        } elseif ($model instanceof Traversable) {
Severity: Minor
Found in src/LogicItLab/Salesforce/MapperBundle/Mapper.php - About 1 hr to fix

    Method getSalesforcePropertiesFromReflectionClass has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function getSalesforcePropertiesFromReflectionClass(ReflectionClass $reflClass)
        {
            $salesforceProperties = array(
                'object' => null,
                'relations' => array(),

      Function getQueryWherePart has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          private function getQueryWherePart(array $criteria, $model)
          {
              $whereParts = array();
              $object = $this->annotationReader->getSalesforceObject($model);
              $fields = $this->annotationReader->getSalesforceFields($model);
      Severity: Minor
      Found in src/LogicItLab/Salesforce/MapperBundle/Mapper.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 getQueryWherePart has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function getQueryWherePart(array $criteria, $model)
          {
              $whereParts = array();
              $object = $this->annotationReader->getSalesforceObject($model);
              $fields = $this->annotationReader->getSalesforceFields($model);
      Severity: Minor
      Found in src/LogicItLab/Salesforce/MapperBundle/Mapper.php - About 1 hr to fix

        Method mapToDomainObject has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function mapToDomainObject($sObject, $modelClass)
            {
                // Try to find mapped model in unit of work
                if ($this->unitOfWork->find($modelClass, $sObject->Id)) {
                    return $this->unitOfWork->find($modelClass, $sObject->Id);
        Severity: Minor
        Found in src/LogicItLab/Salesforce/MapperBundle/Mapper.php - About 1 hr to fix

          Method getQuotedWhereValue has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function getQuotedWhereValue(
                  Annotation\Field $field,
                  $value,
                  Result\DescribeSObjectResult $description
              ) {
          Severity: Minor
          Found in src/LogicItLab/Salesforce/MapperBundle/Mapper.php - About 1 hr to fix

            Function validate has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                public function validate($modelDirPath, string $wsdlPath): array
                {
                    $this->modelDirPath = $modelDirPath;
                    $this->wsdlPath = $wsdlPath;
                    $missingFields = [];
            Severity: Minor
            Found in src/LogicItLab/Salesforce/MapperBundle/WsdlValidator.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 mapToDomainObject has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                public function mapToDomainObject($sObject, $modelClass)
                {
                    // Try to find mapped model in unit of work
                    if ($this->unitOfWork->find($modelClass, $sObject->Id)) {
                        return $this->unitOfWork->find($modelClass, $sObject->Id);
            Severity: Minor
            Found in src/LogicItLab/Salesforce/MapperBundle/Mapper.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 getFields has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function getFields($modelClass, $includeRelatedLevels, $ignoreObject = null)
                {
                    $fields = array();
            
                    foreach ($this->annotationReader->getSalesforceFields($modelClass) as $field) {
            Severity: Minor
            Found in src/LogicItLab/Salesforce/MapperBundle/Mapper.php - About 1 hr to fix

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

                  protected function getSalesforcePropertiesFromReflectionClass(ReflectionClass $reflClass)
                  {
                      $salesforceProperties = array(
                          'object' => null,
                          'relations' => array(),
              Severity: Minor
              Found in src/LogicItLab/Salesforce/MapperBundle/Annotation/AnnotationReader.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

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

                      $model,
                      array $criteria,
                      array $order = array(),
                      $related = 1,
                      $deleted = false,
              Severity: Minor
              Found in src/LogicItLab/Salesforce/MapperBundle/Mapper.php - About 45 mins to fix

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

                        $model,
                        array $criteria,
                        array $order = array(),
                        $related = 2,
                        $deleted = false
                Severity: Minor
                Found in src/LogicItLab/Salesforce/MapperBundle/Mapper.php - About 35 mins to fix

                  Function populatModelIds has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private function populatModelIds($results, $section)
                      {
                          /* @var SaveResult $relatedResult */
                          if (isset($this->bulkModels[$section])) {
                              foreach ($this->bulkModels[$section] as $key => $storedModel) {
                  Severity: Minor
                  Found in src/LogicItLab/Salesforce/MapperBundle/MappedBulkSaver.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 getOneToManySubqueries has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function getOneToManySubqueries($model, $includeRelatedLevels)
                      {
                          $relations = $this->annotationReader->getSalesforceRelations($model);
                          $object = $this->annotationReader->getSalesforceObject($model);
                          $subqueries = array();
                  Severity: Minor
                  Found in src/LogicItLab/Salesforce/MapperBundle/Mapper.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

                  Avoid too many return statements within this method.
                  Open

                                  return "'" . addslashes($value) . "'";
                  Severity: Major
                  Found in src/LogicItLab/Salesforce/MapperBundle/Mapper.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                    return $value ? 'true' : 'false';
                    Severity: Major
                    Found in src/LogicItLab/Salesforce/MapperBundle/Mapper.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                      return $value;
                      Severity: Major
                      Found in src/LogicItLab/Salesforce/MapperBundle/Mapper.php - About 30 mins to fix

                        Function getQuotedWhereValue has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            private function getQuotedWhereValue(
                                Annotation\Field $field,
                                $value,
                                Result\DescribeSObjectResult $description
                            ) {
                        Severity: Minor
                        Found in src/LogicItLab/Salesforce/MapperBundle/Mapper.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