bcit-ci/CodeIgniter

View on GitHub
system/database/DB_result.php

Summary

Maintainability
C
1 day
Test Coverage

File DB_result.php has 281 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * CodeIgniter
 *
 * An open source application development framework for PHP
Severity: Minor
Found in system/database/DB_result.php - About 2 hrs to fix

    CI_DB_result has 23 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class CI_DB_result {
    
        /**
         * Connection ID
         *
    Severity: Minor
    Found in system/database/DB_result.php - About 2 hrs to fix

      Method custom_result_object has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function custom_result_object($class_name)
          {
              if (isset($this->custom_result_object[$class_name]))
              {
                  return $this->custom_result_object[$class_name];
      Severity: Minor
      Found in system/database/DB_result.php - About 1 hr to fix

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

            public function custom_result_object($class_name)
            {
                if (isset($this->custom_result_object[$class_name]))
                {
                    return $this->custom_result_object[$class_name];
        Severity: Minor
        Found in system/database/DB_result.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

        Avoid too many return statements within this method.
        Open

                return $this->custom_row_object($n, $type);
        Severity: Major
        Found in system/database/DB_result.php - About 30 mins to fix

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

              public function result_object()
              {
                  if (count($this->result_object) > 0)
                  {
                      return $this->result_object;
          Severity: Minor
          Found in system/database/DB_result.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

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

              public function result_array()
              {
                  if (count($this->result_array) > 0)
                  {
                      return $this->result_array;
          Severity: Minor
          Found in system/database/DB_result.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

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

              public function set_row($key, $value = NULL)
              {
                  // We cache the row data for subsequent uses
                  if ( ! is_array($this->row_data))
                  {
          Severity: Minor
          Found in system/database/DB_result.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