bcit-ci/CodeIgniter

View on GitHub
system/core/Loader.php

Summary

Maintainability
F
1 wk
Test Coverage

File Loader.php has 717 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * CodeIgniter
 *
 * An open source application development framework for PHP
Severity: Major
Found in system/core/Loader.php - About 1 day to fix

    Function model has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
    Open

        public function model($model, $name = '', $db_conn = FALSE)
        {
            if (empty($model))
            {
                return $this;
    Severity: Minor
    Found in system/core/Loader.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 _ci_init_library has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function _ci_init_library($class, $prefix, $config = FALSE, $object_name = NULL)
        {
            // Is there an associated config file for this class? Note: these should always be lowercase
            if ($config === NULL)
            {
    Severity: Minor
    Found in system/core/Loader.php - About 4 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 model has 96 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function model($model, $name = '', $db_conn = FALSE)
        {
            if (empty($model))
            {
                return $this;
    Severity: Major
    Found in system/core/Loader.php - About 3 hrs to fix

      CI_Loader has 29 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class CI_Loader {
      
          // All these are set automatically. Don't mess with them.
          /**
           * Nesting level of the output buffering mechanism
      Severity: Minor
      Found in system/core/Loader.php - About 3 hrs to fix

        Function helper has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

            public function helper($helpers = array())
            {
                is_array($helpers) OR $helpers = array($helpers);
                foreach ($helpers as &$helper)
                {
        Severity: Minor
        Found in system/core/Loader.php - About 3 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 _ci_load_stock_library has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function _ci_load_stock_library($library_name, $file_path, $params, $object_name)
            {
                $prefix = 'CI_';
        
                if (class_exists($prefix.$library_name, FALSE))
        Severity: Minor
        Found in system/core/Loader.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 _ci_load has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function _ci_load($_ci_data)
            {
                // Set the default data variables
                foreach (array('_ci_view', '_ci_vars', '_ci_path', '_ci_return') as $_ci_val)
                {
        Severity: Minor
        Found in system/core/Loader.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 _ci_init_library has 63 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function _ci_init_library($class, $prefix, $config = FALSE, $object_name = NULL)
            {
                // Is there an associated config file for this class? Note: these should always be lowercase
                if ($config === NULL)
                {
        Severity: Major
        Found in system/core/Loader.php - About 2 hrs to fix

          Method _ci_load has 61 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function _ci_load($_ci_data)
              {
                  // Set the default data variables
                  foreach (array('_ci_view', '_ci_vars', '_ci_path', '_ci_return') as $_ci_val)
                  {
          Severity: Major
          Found in system/core/Loader.php - About 2 hrs to fix

            Function _ci_autoloader has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function _ci_autoloader()
                {
                    if (file_exists(APPPATH.'config/autoload.php'))
                    {
                        include(APPPATH.'config/autoload.php');
            Severity: Minor
            Found in system/core/Loader.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 _ci_load_library has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function _ci_load_library($class, $params = NULL, $object_name = NULL)
                {
                    // Get the class name, and while we're at it trim any slashes.
                    // The directory path can be included as part of the class name,
                    // but we don't want a leading slash
            Severity: Minor
            Found in system/core/Loader.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 _ci_load_stock_library has 53 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function _ci_load_stock_library($library_name, $file_path, $params, $object_name)
                {
                    $prefix = 'CI_';
            
                    if (class_exists($prefix.$library_name, FALSE))
            Severity: Major
            Found in system/core/Loader.php - About 2 hrs to fix

              Method _ci_load_library has 51 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function _ci_load_library($class, $params = NULL, $object_name = NULL)
                  {
                      // Get the class name, and while we're at it trim any slashes.
                      // The directory path can be included as part of the class name,
                      // but we don't want a leading slash
              Severity: Major
              Found in system/core/Loader.php - About 2 hrs to fix

                Method _ci_autoloader has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    protected function _ci_autoloader()
                    {
                        if (file_exists(APPPATH.'config/autoload.php'))
                        {
                            include(APPPATH.'config/autoload.php');
                Severity: Minor
                Found in system/core/Loader.php - About 2 hrs to fix

                  Method helper has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function helper($helpers = array())
                      {
                          is_array($helpers) OR $helpers = array($helpers);
                          foreach ($helpers as &$helper)
                          {
                  Severity: Minor
                  Found in system/core/Loader.php - About 1 hr to fix

                    Method remove_package_path has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function remove_package_path($path = '')
                        {
                            $config =& $this->_ci_get_component('config');
                    
                            if ($path === '')
                    Severity: Minor
                    Found in system/core/Loader.php - About 1 hr to fix

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

                          public function remove_package_path($path = '')
                          {
                              $config =& $this->_ci_get_component('config');
                      
                              if ($path === '')
                      Severity: Minor
                      Found in system/core/Loader.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 driver has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function driver($library, $params = NULL, $object_name = NULL)
                          {
                              if (is_array($library))
                              {
                                  foreach ($library as $key => $value)
                      Severity: Minor
                      Found in system/core/Loader.php - About 1 hr to fix

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

                            public function driver($library, $params = NULL, $object_name = NULL)
                            {
                                if (is_array($library))
                                {
                                    foreach ($library as $key => $value)
                        Severity: Minor
                        Found in system/core/Loader.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 library has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function library($library, $params = NULL, $object_name = NULL)
                            {
                                if (empty($library))
                                {
                                    return $this;
                        Severity: Minor
                        Found in system/core/Loader.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 dbforge has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function dbforge($db = NULL, $return = FALSE)
                            {
                                $CI =& get_instance();
                                if ( ! is_object($db) OR ! ($db instanceof CI_DB))
                                {
                        Severity: Minor
                        Found in system/core/Loader.php - About 1 hr to fix

                          Avoid too many return statements within this method.
                          Open

                                      return $this->_ci_load_library($class.'/'.$class, $params, $object_name);
                          Severity: Major
                          Found in system/core/Loader.php - About 30 mins to fix

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

                                public function dbforge($db = NULL, $return = FALSE)
                                {
                                    $CI =& get_instance();
                                    if ( ! is_object($db) OR ! ($db instanceof CI_DB))
                                    {
                            Severity: Minor
                            Found in system/core/Loader.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