Finesse/QueryScribe

View on GitHub

Showing 30 of 44 total issues

File CommonGrammar.php has 303 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace Finesse\QueryScribe\Grammars;

use Finesse\QueryScribe\Exceptions\InvalidQueryException;
Severity: Minor
Found in src/Grammars/CommonGrammar.php - About 3 hrs to fix

    CommonGrammar has 25 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class CommonGrammar implements GrammarInterface
    {
        use CommonGrammarCriteriaTrait;
        use CommonGrammarOrderTrait;
    
    
    Severity: Minor
    Found in src/Grammars/CommonGrammar.php - About 2 hrs to fix

      Method whereArgumentsToCriterion has 47 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function whereArgumentsToCriterion(
              array $arguments,
              string $appendRule = 'AND',
              bool $valueIsColumn = false
          ): Criterion {
      Severity: Minor
      Found in src/QueryBricks/WhereTrait.php - About 1 hr to fix

        Function compileInsertFromValues has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function compileInsertFromValues($table, string $tableAlias = null, array $values): array
            {
                if (empty($values)) {
                    return [];
                }
        Severity: Minor
        Found in src/Grammars/CommonGrammar.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 processQuery has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function processQuery(Query $query, $context): Query
            {
                $queryProperties = [];
        
                // Table
        Severity: Minor
        Found in src/PostProcessors/AbstractProcessor.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 processQuery has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function processQuery(Query $query, $context): Query
            {
                $queryProperties = [];
        
                // Table
        Severity: Minor
        Found in src/PostProcessors/AbstractProcessor.php - About 1 hr to fix

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

              protected function whereArgumentsToCriterion(
                  array $arguments,
                  string $appendRule = 'AND',
                  bool $valueIsColumn = false
              ): Criterion {
          Severity: Minor
          Found in src/QueryBricks/WhereTrait.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 compileCriteria has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function compileCriteria(array $criteria, array &$bindings): string
              {
                  $criteriaSQL = '';
                  $previousAppendRule = null;
          
          
          Severity: Minor
          Found in src/Grammars/CommonGrammarCriteriaTrait.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 compileInsert has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function compileInsert(Query $query): array
              {
                  if ($query->table === null) {
                      throw new InvalidQueryException('The INTO table is not set');
                  }
          Severity: Minor
          Found in src/Grammars/CommonGrammar.php - About 1 hr to fix

            Method compileInsertFromValues has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function compileInsertFromValues($table, string $tableAlias = null, array $values): array
                {
                    if (empty($values)) {
                        return [];
                    }
            Severity: Minor
            Found in src/Grammars/CommonGrammar.php - About 1 hr to fix

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

                  public function addInsert(array $rows): self
                  {
                      if (!empty($rows) && !is_array(reset($rows))) {
                          $rows = [$rows];
                      }
              Severity: Minor
              Found in src/QueryBricks/InsertTrait.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 addInsert has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function addInsert(array $rows): self
                  {
                      if (!empty($rows) && !is_array(reset($rows))) {
                          $rows = [$rows];
                      }
              Severity: Minor
              Found in src/QueryBricks/InsertTrait.php - About 1 hr to fix

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

                    public function addInsertFromSelect($columns, $selectQuery = null): self
                    {
                        if ($selectQuery === null) {
                            $selectQuery = $columns;
                            $columns = null;
                Severity: Minor
                Found in src/QueryBricks/InsertTrait.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 addSelect has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function addSelect($columns, string $alias = null): self
                    {
                        if (!is_array($columns)) {
                            if ($alias === null) {
                                $columns = [$columns];
                Severity: Minor
                Found in src/QueryBricks/SelectTrait.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 compileCriterion has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function compileCriterion(Criterion $criterion, array &$bindings): string
                    {
                        if ($criterion instanceof ValueCriterion) {
                            return $this->compileValueCriterion($criterion, $bindings);
                        }
                Severity: Minor
                Found in src/Grammars/CommonGrammarCriteriaTrait.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 compileInsert has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function compileInsert(Query $query): array
                    {
                        if ($query->table === null) {
                            throw new InvalidQueryException('The INTO table is not set');
                        }
                Severity: Minor
                Found in src/Grammars/CommonGrammar.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

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

                    public function whereBetween($column, $min, $max, bool $not = false, string $appendRule = 'AND'): self
                Severity: Minor
                Found in src/QueryBricks/WhereTrait.php - About 35 mins to fix

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

                      public function __construct($column, $min, $max, bool $not, string $appendRule)
                  Severity: Minor
                  Found in src/QueryBricks/Criteria/BetweenCriterion.php - About 35 mins to fix

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

                        protected function processCriterion(Criterion $criterion, $context): Criterion
                        {
                            if ($criterion instanceof ValueCriterion) {
                                return $this->processValueCriterion($criterion, $context);
                            }
                    Severity: Minor
                    Found in src/PostProcessors/AbstractProcessorCriteriaTrait.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 processInCriterion has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        protected function processInCriterion(InCriterion $criterion, $context): InCriterion
                        {
                            $column = $this->processColumnOrSubQuery($criterion->column, $context);
                            if (is_array($criterion->values)) {
                                $values = [];
                    Severity: Minor
                    Found in src/PostProcessors/AbstractProcessorCriteriaTrait.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

                    Severity
                    Category
                    Status
                    Source
                    Language