lib/ezQuery.php

Summary

Maintainability
D
3 days
Test Coverage

File ezQuery.php has 748 lines of code (exceeds 250 allowed). Consider refactoring.
Wontfix

<?php

namespace ezsql;

use ezsql\ezSchema;
Severity: Major
Found in lib/ezQuery.php - About 1 day to fix

    ezQuery has 54 functions (exceeds 20 allowed). Consider refactoring.
    Wontfix

    class ezQuery implements ezQueryInterface
    {
        protected $select_result = true;
        protected $prepareActive = false;
        protected $preparedValues = array();
    Severity: Major
    Found in lib/ezQuery.php - About 7 hrs to fix

      Function select has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
      Open

          public function select(string $table = null, $columnFields = '*', ...$conditions)
          {
              $getFromTable = $this->fromTable;
              $getSelect_result = $this->select_result;
              $getIsInto = $this->isInto;
      Severity: Minor
      Found in lib/ezQuery.php - About 5 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 _query_insert_replace has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
      Open

          private function _query_insert_replace($table = '', $keyValue = null, $type = '', $execute = true)
          {
              if ((!\is_array($keyValue) && ($execute)) || empty($table)) {
                  return $this->clearPrepare();
              }
      Severity: Minor
      Found in lib/ezQuery.php - About 5 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 select has 75 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function select(string $table = null, $columnFields = '*', ...$conditions)
          {
              $getFromTable = $this->fromTable;
              $getSelect_result = $this->select_result;
              $getIsInto = $this->isInto;
      Severity: Major
      Found in lib/ezQuery.php - About 3 hrs to fix

        Method create has 53 lines of code (exceeds 25 allowed). Consider refactoring.
        Wontfix

            public function create(string $table = null, ...$schemas)
            {
                $vendor = get_vendor();
                if (empty($table) || empty($schemas) || empty($vendor))
                    return false;
        Severity: Major
        Found in lib/ezQuery.php - About 2 hrs to fix

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

              public function where(...$conditions)
              {
          
                  if (empty($conditions))
                      return false;
          Severity: Minor
          Found in lib/ezQuery.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 create has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

              public function create(string $table = null, ...$schemas)
              {
                  $vendor = get_vendor();
                  if (empty($table) || empty($schemas) || empty($vendor))
                      return false;
          Severity: Minor
          Found in lib/ezQuery.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 _query_insert_replace has 45 lines of code (exceeds 25 allowed). Consider refactoring.
          Wontfix

              private function _query_insert_replace($table = '', $keyValue = null, $type = '', $execute = true)
              {
                  if ((!\is_array($keyValue) && ($execute)) || empty($table)) {
                      return $this->clearPrepare();
                  }
          Severity: Minor
          Found in lib/ezQuery.php - About 1 hr to fix

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

                public function update(string $table = null, $keyValue, ...$whereConditions)
                {
                    if (!\is_array($keyValue) || empty($table)) {
                        return $this->clearPrepare();
                    }
            Severity: Minor
            Found in lib/ezQuery.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 where has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Wontfix

                public function where(...$conditions)
                {
            
                    if (empty($conditions))
                        return false;
            Severity: Minor
            Found in lib/ezQuery.php - About 1 hr to fix

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

                  public function alter(string $table = null, ...$alteringSchema)
                  {
                      if (empty($table) || empty($alteringSchema))
                          return false;
              
              
              Severity: Minor
              Found in lib/ezQuery.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 retrieveConditions has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Wontfix

                  private function retrieveConditions($whereConditions)
                  {
                      $whereConditions = $this->flattenWhereConditions($whereConditions);
                      $whereKey = [];
                      $whereValue = [];
              Severity: Minor
              Found in lib/ezQuery.php - About 1 hr to fix

                Consider simplifying this complex logical expression.
                Open

                                if ($joinSet || $skipWhere || $groupBySet || $havingSet || $orderBySet || $limitSet || $unionSet) {
                                    $where = $args_by;
                                    $skipWhere = true;
                                }
                Severity: Major
                Found in lib/ezQuery.php - About 1 hr to fix

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

                      private function retrieveConditions($whereConditions)
                      {
                          $whereConditions = $this->flattenWhereConditions($whereConditions);
                          $whereKey = [];
                          $whereValue = [];
                  Severity: Minor
                  Found in lib/ezQuery.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 joining has 7 arguments (exceeds 4 allowed). Consider refactoring.
                  Wontfix

                          String $type = \_INNER,
                          string $leftTable = null,
                          string $rightTable = null,
                          string $leftColumn = null,
                          string $rightColumn = null,
                  Severity: Major
                  Found in lib/ezQuery.php - About 50 mins to fix

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

                        private function processConditions($column, $condition, $value, $valueOrCombine, $extraCombine)
                        {
                            if (!\in_array($condition, \_BOOLEAN_OPERATORS))
                                return $this->clearPrepare();
                    
                    
                    Severity: Minor
                    Found in lib/ezQuery.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 innerJoin has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Wontfix

                            string $leftTable = null,
                            string $rightTable = null,
                            string $leftColumn = null,
                            string $rightColumn = null,
                            string $tableAs = null,
                    Severity: Minor
                    Found in lib/ezQuery.php - About 45 mins to fix

                      Method rightJoin has 6 arguments (exceeds 4 allowed). Consider refactoring.
                      Wontfix

                              string $leftTable = null,
                              string $rightTable = null,
                              string $leftColumn = null,
                              string $rightColumn = null,
                              string $tableAs = null,
                      Severity: Minor
                      Found in lib/ezQuery.php - About 45 mins to fix

                        Method leftJoin has 6 arguments (exceeds 4 allowed). Consider refactoring.
                        Wontfix

                                string $leftTable = null,
                                string $rightTable = null,
                                string $leftColumn = null,
                                string $rightColumn = null,
                                string $tableAs = null,
                        Severity: Minor
                        Found in lib/ezQuery.php - About 45 mins to fix

                          Method fullJoin has 6 arguments (exceeds 4 allowed). Consider refactoring.
                          Wontfix

                                  string $leftTable = null,
                                  string $rightTable = null,
                                  string $leftColumn = null,
                                  string $rightColumn = null,
                                  string $tableAs = null,
                          Severity: Minor
                          Found in lib/ezQuery.php - About 45 mins to fix

                            Function grouping has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                            Wontfix

                                public function grouping(...$whereConditions)
                                {
                                    if (empty($whereConditions))
                                        return false;
                            
                            
                            Severity: Minor
                            Found in lib/ezQuery.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

                            Consider simplifying this complex logical expression.
                            Wontfix

                                    if (($condition == \_BETWEEN) || ($condition == \_notBETWEEN)) {
                                        $this->conditionBetween($column, $condition, $value, $valueOrCombine, $extraCombine);
                                    } elseif ($condition == \_IN) {
                                        $this->conditionIn($column, $condition, $value, $valueOrCombine);
                                    } elseif (((\strtolower($value) == 'null') || ($condition == 'IS') || ($condition == 'IS NOT'))) {
                            Severity: Major
                            Found in lib/ezQuery.php - About 40 mins to fix

                              Method conditions has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Wontfix

                                  private function conditions($key, $condition, $value, $combine, $extra)
                              Severity: Minor
                              Found in lib/ezQuery.php - About 35 mins to fix

                                Method conditionBetween has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                Wontfix

                                    private function conditionBetween($key, $condition, $valueOne, $valueTwo, $combine)
                                Severity: Minor
                                Found in lib/ezQuery.php - About 35 mins to fix

                                  Method insert_select has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                  Wontfix

                                      public function insert_select(string $toTable = null, $toColumns = '*', $fromTable = null, $fromColumns = '*', ...$conditions)
                                  Severity: Minor
                                  Found in lib/ezQuery.php - About 35 mins to fix

                                    Method processConditions has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                    Wontfix

                                        private function processConditions($column, $condition, $value, $valueOrCombine, $extraCombine)
                                    Severity: Minor
                                    Found in lib/ezQuery.php - About 35 mins to fix

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

                                          private function joining(
                                              String $type = \_INNER,
                                              string $leftTable = null,
                                              string $rightTable = null,
                                              string $leftColumn = null,
                                      Severity: Minor
                                      Found in lib/ezQuery.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.
                                      Wontfix

                                              return $this->clearPrepare();
                                      Severity: Major
                                      Found in lib/ezQuery.php - About 30 mins to fix

                                        Avoid too many return statements within this method.
                                        Wontfix

                                                            return false;
                                        Severity: Major
                                        Found in lib/ezQuery.php - About 30 mins to fix

                                          Avoid too many return statements within this method.
                                          Wontfix

                                                      return " $whereOrHaving $where ";
                                          Severity: Major
                                          Found in lib/ezQuery.php - About 30 mins to fix

                                            Avoid too many return statements within this method.
                                            Wontfix

                                                    return ($where != '1') ? " $whereOrHaving $where " : ' ';
                                            Severity: Major
                                            Found in lib/ezQuery.php - About 30 mins to fix

                                              Avoid too many return statements within this method.
                                              Wontfix

                                                          return $sql;
                                              Severity: Major
                                              Found in lib/ezQuery.php - About 30 mins to fix

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

                                                    private function create_schema(array ...$columnDataOptions)
                                                    {
                                                        if (empty($columnDataOptions))
                                                            return false;
                                                
                                                
                                                Severity: Minor
                                                Found in lib/ezQuery.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