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

        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

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

          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

          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

              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

                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

                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

                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

                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

                  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

                    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

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

                    protected function joinArgumentsToJoinObject(string $type, $table, array $criterion = []): Join
                    {
                    if (is_array($table)) {
                    $tableName = $table[0] ?? null;
                    $tableAlias = $table[1] ?? null;
                    Severity: Minor
                    Found in src/QueryBricks/JoinTrait.php - About 35 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language