Finesse/QueryScribe

View on GitHub
src/Grammars/CommonGrammar.php

Summary

Maintainability
C
1 day
Test Coverage

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

      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

      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 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

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

              protected function compileOffsetAndLimitPart(Query $query, array &$bindings): string
              {
                  $parts = [];
          
                  if ($query->limit !== null) {
          Severity: Minor
          Found in src/Grammars/CommonGrammar.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