bcit-ci/CodeIgniter

View on GitHub
system/core/Common.php

Summary

Maintainability
D
2 days
Test Coverage

File Common.php has 448 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

    Method set_status_header has 81 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function set_status_header($code = 200, $text = '')
        {
            if (is_cli())
            {
                return;
    Severity: Major
    Found in system/core/Common.php - About 3 hrs to fix

      Function load_class has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

          function &load_class($class, $directory = 'libraries', $param = NULL)
          {
              static $_classes = array();
      
              // Does the class exist? If so, we're done...
      Severity: Minor
      Found in system/core/Common.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 get_config has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          function &get_config(Array $replace = array())
          {
              static $config;
      
              if (empty($config))
      Severity: Minor
      Found in system/core/Common.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 set_status_header has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          function set_status_header($code = 200, $text = '')
          {
              if (is_cli())
              {
                  return;
      Severity: Minor
      Found in system/core/Common.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 load_class has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function &load_class($class, $directory = 'libraries', $param = NULL)
          {
              static $_classes = array();
      
              // Does the class exist? If so, we're done...
      Severity: Minor
      Found in system/core/Common.php - About 1 hr to fix

        Method get_config has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function &get_config(Array $replace = array())
            {
                static $config;
        
                if (empty($config))
        Severity: Minor
        Found in system/core/Common.php - About 1 hr to fix

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

              function is_really_writable($file)
              {
                  // If we're on a UNIX-like server, just is_writable()
                  if (DIRECTORY_SEPARATOR === '/')
                  {
          Severity: Minor
          Found in system/core/Common.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 _error_handler has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              function _error_handler($severity, $message, $filepath, $line)
              {
                  $is_error = (((E_ERROR | E_PARSE | E_COMPILE_ERROR | E_CORE_ERROR | E_USER_ERROR) & $severity) === $severity);
          
                  // When an error occurred, set the status header to '500 Internal Server Error'
          Severity: Minor
          Found in system/core/Common.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 html_escape has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              function html_escape($var, $double_encode = TRUE)
              {
                  if (empty($var))
                  {
                      return $var;
          Severity: Minor
          Found in system/core/Common.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

          Avoid too many return statements within this method.
          Open

                  return TRUE;
          Severity: Major
          Found in system/core/Common.php - About 30 mins to fix

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

                function is_https()
                {
                    if ( ! empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off')
                    {
                        return TRUE;
            Severity: Minor
            Found in system/core/Common.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 _stringify_attributes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                function _stringify_attributes($attributes, $js = FALSE)
                {
                    $atts = NULL;
            
                    if (empty($attributes))
            Severity: Minor
            Found in system/core/Common.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