chrisandchris/passive-record-orm

View on GitHub
src/ChrisAndChris/Common/RowMapperBundle/Services/Query/Builder.php

Summary

Maintainability
F
4 days
Test Coverage

File Builder.php has 580 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
namespace ChrisAndChris\Common\RowMapperBundle\Services\Query;

use ChrisAndChris\Common\RowMapperBundle\Exceptions\MalformedQueryException;
use ChrisAndChris\Common\RowMapperBundle\Exceptions\MissingParameterException;
Severity: Major
Found in src/ChrisAndChris/Common/RowMapperBundle/Services/Query/Builder.php - About 1 day to fix

    Builder has 59 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Builder
    {
    
        /** @var array the statement */
        private $statement = [];
    Severity: Major
    Found in src/ChrisAndChris/Common/RowMapperBundle/Services/Query/Builder.php - About 1 day to fix

      Function append has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
      Open

          private function append($typeName, array $params = [])
          {
              if ($this->allowAppend() && $this->typeBag->has($typeName)) {
                  $endParams = [];
                  $type = $this->typeBag->get($typeName);
      Severity: Minor
      Found in src/ChrisAndChris/Common/RowMapperBundle/Services/Query/Builder.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

      Function values has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          public function values(array $values = [])
          {
              if (is_array($values) && count($values) > 0) {
                  $this->append('values');
      
      
      Severity: Minor
      Found in src/ChrisAndChris/Common/RowMapperBundle/Services/Query/Builder.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

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

          public function updates(array $updates)
          {
              if (count($updates) < 1) {
                  throw new MalformedQueryException(
                      sprintf('Must update at least one field, %s given', count($updates))
      Severity: Minor
      Found in src/ChrisAndChris/Common/RowMapperBundle/Services/Query/Builder.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 append has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function append($typeName, array $params = [])
          {
              if ($this->allowAppend() && $this->typeBag->has($typeName)) {
                  $endParams = [];
                  $type = $this->typeBag->get($typeName);
      Severity: Minor
      Found in src/ChrisAndChris/Common/RowMapperBundle/Services/Query/Builder.php - About 1 hr to fix

        Method updates has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function updates(array $updates)
            {
                if (count($updates) < 1) {
                    throw new MalformedQueryException(
                        sprintf('Must update at least one field, %s given', count($updates))
        Severity: Minor
        Found in src/ChrisAndChris/Common/RowMapperBundle/Services/Query/Builder.php - About 1 hr to fix

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

              public function getSqlQuery(ParserInterface $parser = null)
              {
                  if ($this->parser === null && $parser === null) {
                      throw new SystemException('No parser given');
                  }
          Severity: Minor
          Found in src/ChrisAndChris/Common/RowMapperBundle/Services/Query/Builder.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 getSqlQuery has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function getSqlQuery(ParserInterface $parser = null)
              {
                  if ($this->parser === null && $parser === null) {
                      throw new SystemException('No parser given');
                  }
          Severity: Minor
          Found in src/ChrisAndChris/Common/RowMapperBundle/Services/Query/Builder.php - About 1 hr to fix

            Method values has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function values(array $values = [])
                {
                    if (is_array($values) && count($values) > 0) {
                        $this->append('values');
            
            
            Severity: Minor
            Found in src/ChrisAndChris/Common/RowMapperBundle/Services/Query/Builder.php - About 1 hr to fix

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

                  private function appendMultiple($types)
                  {
                      if ($types instanceof Builder) {
                          $types = $types->getStatement();
                      } else {
              Severity: Minor
              Found in src/ChrisAndChris/Common/RowMapperBundle/Services/Query/Builder.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 allowAppend has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function allowAppend()
                  {
                      // for speed, we first check only the last index
                      // if the last index says we should append, we check all other indexes
                      // any of the index must be false
              Severity: Minor
              Found in src/ChrisAndChris/Common/RowMapperBundle/Services/Query/Builder.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 combine has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function combine($builder)
                  {
                      if (!$this->allowAppend() || $builder === null) {
                          return $this;
                      }
              Severity: Minor
              Found in src/ChrisAndChris/Common/RowMapperBundle/Services/Query/Builder.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 orderBy has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function orderBy(array $orders)
                  {
                      $this->append('order');
                      $idx = 0;
                      foreach ($orders as $field => $direction) {
              Severity: Minor
              Found in src/ChrisAndChris/Common/RowMapperBundle/Services/Query/Builder.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

              There are no issues that match your filters.

              Category
              Status