bcit-ci/CodeIgniter

View on GitHub
system/database/DB_query_builder.php

Summary

Maintainability
F
1 wk
Test Coverage

File DB_query_builder.php has 1349 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * CodeIgniter
 *
 * An open source application development framework for PHP
Severity: Major
Found in system/database/DB_query_builder.php - About 3 days to fix

    CI_DB_query_builder has 84 functions (exceeds 20 allowed). Consider refactoring.
    Open

    abstract class CI_DB_query_builder extends CI_DB_driver {
    
        /**
         * Return DELETE SQL flag
         *
    Severity: Major
    Found in system/database/DB_query_builder.php - About 1 day to fix

      Function _compile_wh has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function _compile_wh($qb_key)
          {
              if (count($this->$qb_key) > 0)
              {
                  for ($i = 0, $c = count($this->$qb_key); $i < $c; $i++)
      Severity: Minor
      Found in system/database/DB_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 join has 57 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function join($table, $cond, $type = '', $escape = NULL)
          {
              $type = trim(strtoupper($type).' JOIN');
              preg_match('#^(NATURAL\s+)?((LEFT|RIGHT|FULL)\s+)?((INNER|OUTER)\s+)?JOIN$#', $type) OR $type = 'JOIN';
      
      
      Severity: Major
      Found in system/database/DB_query_builder.php - About 2 hrs to fix

        Function _wh has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function _wh($qb_key, $key, $value = NULL, $type = 'AND ', $escape = NULL)
            {
                $qb_cache_key = ($qb_key === 'qb_having') ? 'qb_cache_having' : 'qb_cache_where';
        
                if ( ! is_array($key))
        Severity: Minor
        Found in system/database/DB_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

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

            public function from($from)
            {
                foreach ((array) $from as $val)
                {
                    if (strpos($val, ',') !== FALSE)
        Severity: Minor
        Found in system/database/DB_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

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

            protected function _merge_cache()
            {
                if (count($this->qb_cache_exists) === 0)
                {
                    return;
        Severity: Minor
        Found in system/database/DB_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

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

            public function join($table, $cond, $type = '', $escape = NULL)
            {
                $type = trim(strtoupper($type).' JOIN');
                preg_match('#^(NATURAL\s+)?((LEFT|RIGHT|FULL)\s+)?((INNER|OUTER)\s+)?JOIN$#', $type) OR $type = 'JOIN';
        
        
        Severity: Minor
        Found in system/database/DB_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

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

            protected function _like($field, $match = '', $type = 'AND ', $side = 'both', $not = '', $escape = NULL)
            {
                if ( ! is_array($field))
                {
                    $field = array($field => $match);
        Severity: Minor
        Found in system/database/DB_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 _like has 43 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function _like($field, $match = '', $type = 'AND ', $side = 'both', $not = '', $escape = NULL)
            {
                if ( ! is_array($field))
                {
                    $field = array($field => $match);
        Severity: Minor
        Found in system/database/DB_query_builder.php - About 1 hr to fix

          Method delete has 40 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function delete($table = '', $where = '', $limit = NULL, $reset_data = TRUE)
              {
                  // Combine any cached components with the current statements
                  $this->_merge_cache();
          
          
          Severity: Minor
          Found in system/database/DB_query_builder.php - About 1 hr to fix

            Method _compile_wh has 40 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function _compile_wh($qb_key)
                {
                    if (count($this->$qb_key) > 0)
                    {
                        for ($i = 0, $c = count($this->$qb_key); $i < $c; $i++)
            Severity: Minor
            Found in system/database/DB_query_builder.php - About 1 hr to fix

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

                  public function update_batch($table, $set = NULL, $index = NULL, $batch_size = 100)
                  {
                      // Combine any cached components with the current statements
                      $this->_merge_cache();
              
              
              Severity: Minor
              Found in system/database/DB_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 _wh has 39 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function _wh($qb_key, $key, $value = NULL, $type = 'AND ', $escape = NULL)
                  {
                      $qb_cache_key = ($qb_key === 'qb_having') ? 'qb_cache_having' : 'qb_cache_where';
              
                      if ( ! is_array($key))
              Severity: Minor
              Found in system/database/DB_query_builder.php - About 1 hr to fix

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

                    public function update_batch($table, $set = NULL, $index = NULL, $batch_size = 100)
                    {
                        // Combine any cached components with the current statements
                        $this->_merge_cache();
                
                
                Severity: Minor
                Found in system/database/DB_query_builder.php - About 1 hr to fix

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

                      protected function _compile_select($select_override = FALSE)
                      {
                          // Combine any cached components with the current statements
                          $this->_merge_cache();
                  
                  
                  Severity: Minor
                  Found in system/database/DB_query_builder.php - About 1 hr to fix

                    Method order_by has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function order_by($orderby, $direction = '', $escape = NULL)
                        {
                            $direction = strtoupper(trim($direction));
                    
                            if ($direction === 'RANDOM')
                    Severity: Minor
                    Found in system/database/DB_query_builder.php - About 1 hr to fix

                      Method _wh_in has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          protected function _wh_in($qb_key, $key, array $values, $not = FALSE, $type = 'AND ', $escape = NULL)
                          {
                              $qb_cache_key = ($qb_key === 'qb_having') ? 'qb_cache_having' : 'qb_cache_where';
                      
                              if (empty($key) OR ! is_string($key))
                      Severity: Minor
                      Found in system/database/DB_query_builder.php - About 1 hr to fix

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

                            public function delete($table = '', $where = '', $limit = NULL, $reset_data = TRUE)
                            {
                                // Combine any cached components with the current statements
                                $this->_merge_cache();
                        
                        
                        Severity: Minor
                        Found in system/database/DB_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

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

                            public function insert_batch($table, $set = NULL, $escape = NULL, $batch_size = 100)
                            {
                                if ($set === NULL)
                                {
                                    if (empty($this->qb_set))
                        Severity: Minor
                        Found in system/database/DB_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 insert_batch has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function insert_batch($table, $set = NULL, $escape = NULL, $batch_size = 100)
                            {
                                if ($set === NULL)
                                {
                                    if (empty($this->qb_set))
                        Severity: Minor
                        Found in system/database/DB_query_builder.php - About 1 hr to fix

                          Method set_insert_batch has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function set_insert_batch($key, $value = '', $escape = NULL)
                              {
                                  $key = $this->_object_to_array_batch($key);
                          
                                  if ( ! is_array($key))
                          Severity: Minor
                          Found in system/database/DB_query_builder.php - About 1 hr to fix

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

                                protected function _track_aliases($table)
                                {
                                    if (is_array($table))
                                    {
                                        foreach ($table as $t)
                            Severity: Minor
                            Found in system/database/DB_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

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

                                protected function _compile_select($select_override = FALSE)
                                {
                                    // Combine any cached components with the current statements
                                    $this->_merge_cache();
                            
                            
                            Severity: Minor
                            Found in system/database/DB_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 _merge_cache has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                protected function _merge_cache()
                                {
                                    if (count($this->qb_cache_exists) === 0)
                                    {
                                        return;
                            Severity: Minor
                            Found in system/database/DB_query_builder.php - About 1 hr to fix

                              Method from has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public function from($from)
                                  {
                                      foreach ((array) $from as $val)
                                      {
                                          if (strpos($val, ',') !== FALSE)
                              Severity: Minor
                              Found in system/database/DB_query_builder.php - About 1 hr to fix

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

                                    public function set_insert_batch($key, $value = '', $escape = NULL)
                                    {
                                        $key = $this->_object_to_array_batch($key);
                                
                                        if ( ! is_array($key))
                                Severity: Minor
                                Found in system/database/DB_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 set_update_batch has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public function set_update_batch($key, $index = '', $escape = NULL)
                                    {
                                        $key = $this->_object_to_array_batch($key);
                                
                                        if ( ! is_array($key))
                                Severity: Minor
                                Found in system/database/DB_query_builder.php - About 1 hr to fix

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

                                      public function count_all_results($table = '', $reset = TRUE)
                                      {
                                          if ($table !== '')
                                          {
                                              $this->_track_aliases($table);
                                  Severity: Minor
                                  Found in system/database/DB_query_builder.php - About 1 hr to fix

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

                                        protected function _track_aliases($table)
                                        {
                                            if (is_array($table))
                                            {
                                                foreach ($table as $t)
                                    Severity: Minor
                                    Found in system/database/DB_query_builder.php - About 1 hr to fix

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

                                          public function order_by($orderby, $direction = '', $escape = NULL)
                                          {
                                              $direction = strtoupper(trim($direction));
                                      
                                              if ($direction === 'RANDOM')
                                      Severity: Minor
                                      Found in system/database/DB_query_builder.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 set_update_batch has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                          public function set_update_batch($key, $index = '', $escape = NULL)
                                          {
                                              $key = $this->_object_to_array_batch($key);
                                      
                                              if ( ! is_array($key))
                                      Severity: Minor
                                      Found in system/database/DB_query_builder.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 _wh_in has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                      Open

                                          protected function _wh_in($qb_key, $key, array $values, $not = FALSE, $type = 'AND ', $escape = NULL)
                                      Severity: Minor
                                      Found in system/database/DB_query_builder.php - About 45 mins to fix

                                        Method _like has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                        Open

                                            protected function _like($field, $match = '', $type = 'AND ', $side = 'both', $not = '', $escape = NULL)
                                        Severity: Minor
                                        Found in system/database/DB_query_builder.php - About 45 mins to fix

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

                                              protected function _wh_in($qb_key, $key, array $values, $not = FALSE, $type = 'AND ', $escape = NULL)
                                              {
                                                  $qb_cache_key = ($qb_key === 'qb_having') ? 'qb_cache_having' : 'qb_cache_where';
                                          
                                                  if (empty($key) OR ! is_string($key))
                                          Severity: Minor
                                          Found in system/database/DB_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 _compile_order_by has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                          Open

                                              protected function _compile_order_by()
                                              {
                                                  if (empty($this->qb_orderby))
                                                  {
                                                      return '';
                                          Severity: Minor
                                          Found in system/database/DB_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

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

                                              protected function _wh($qb_key, $key, $value = NULL, $type = 'AND ', $escape = NULL)
                                          Severity: Minor
                                          Found in system/database/DB_query_builder.php - About 35 mins to fix

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

                                                public function select($select = '*', $escape = NULL)
                                                {
                                                    if (is_string($select))
                                                    {
                                                        $select = explode(',', $select);
                                            Severity: Minor
                                            Found in system/database/DB_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 group_by has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                            Open

                                                public function group_by($by, $escape = NULL)
                                                {
                                                    is_bool($escape) OR $escape = $this->_protect_identifiers;
                                            
                                                    if (is_string($by))
                                            Severity: Minor
                                            Found in system/database/DB_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 _object_to_array_batch has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                            Open

                                                protected function _object_to_array_batch($object)
                                                {
                                                    if ( ! is_object($object))
                                                    {
                                                        return $object;
                                            Severity: Minor
                                            Found in system/database/DB_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 _update_batch has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                            Open

                                                protected function _update_batch($table, $values, $index)
                                                {
                                                    $ids = array();
                                                    foreach ($values as $key => $val)
                                                    {
                                            Severity: Minor
                                            Found in system/database/DB_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 _compile_group_by has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                            Open

                                                protected function _compile_group_by()
                                                {
                                                    if (count($this->qb_groupby) > 0)
                                                    {
                                                        for ($i = 0, $c = count($this->qb_groupby); $i < $c; $i++)
                                            Severity: Minor
                                            Found in system/database/DB_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

                                            Avoid too many return statements within this method.
                                            Open

                                                    return $affected_rows;
                                            Severity: Major
                                            Found in system/database/DB_query_builder.php - About 30 mins to fix

                                              Similar blocks of code found in 2 locations. Consider refactoring.
                                              Open

                                                  public function truncate($table = '')
                                                  {
                                                      if ($table === '')
                                                      {
                                                          if ( ! isset($this->qb_from[0]))
                                              Severity: Major
                                              Found in system/database/DB_query_builder.php and 1 other location - About 2 hrs to fix
                                              system/database/DB_query_builder.php on lines 2120..2139

                                              Duplicated Code

                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                              Tuning

                                              This issue has a mass of 129.

                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                              Refactorings

                                              Further Reading

                                              Similar blocks of code found in 2 locations. Consider refactoring.
                                              Open

                                                  public function empty_table($table = '')
                                                  {
                                                      if ($table === '')
                                                      {
                                                          if ( ! isset($this->qb_from[0]))
                                              Severity: Major
                                              Found in system/database/DB_query_builder.php and 1 other location - About 2 hrs to fix
                                              system/database/DB_query_builder.php on lines 2153..2172

                                              Duplicated Code

                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                              Tuning

                                              This issue has a mass of 129.

                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                              Refactorings

                                              Further Reading

                                              Similar blocks of code found in 2 locations. Consider refactoring.
                                              Open

                                                          else
                                                          {
                                                              $val = trim($val);
                                              
                                                              // Extract any aliases that might exist. We use this information
                                              Severity: Minor
                                              Found in system/database/DB_query_builder.php and 1 other location - About 55 mins to fix
                                              system/database/DB_query_builder.php on lines 479..491

                                              Duplicated Code

                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                              Tuning

                                              This issue has a mass of 99.

                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                              Refactorings

                                              Further Reading

                                              Similar blocks of code found in 2 locations. Consider refactoring.
                                              Open

                                                              foreach (explode(',', $val) as $v)
                                                              {
                                                                  $v = trim($v);
                                                                  $this->_track_aliases($v);
                                              
                                              
                                              Severity: Minor
                                              Found in system/database/DB_query_builder.php and 1 other location - About 55 mins to fix
                                              system/database/DB_query_builder.php on lines 493..508

                                              Duplicated Code

                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                              Tuning

                                              This issue has a mass of 99.

                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                              Refactorings

                                              Further Reading

                                              There are no issues that match your filters.

                                              Category
                                              Status