bcit-ci/CodeIgniter

View on GitHub
system/core/URI.php

Summary

Maintainability
D
2 days
Test Coverage

File URI.php has 284 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/URI.php - About 2 hrs to fix

    CI_URI has 22 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class CI_URI {
    
        /**
         * List of cached URI segments
         *
    Severity: Minor
    Found in system/core/URI.php - About 2 hrs to fix

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

          protected function _set_uri_string($str, $is_cli = FALSE)
          {
              // CLI requests have a bit simpler logic
              if ($is_cli)
              {
      Severity: Minor
      Found in system/core/URI.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 _uri_to_assoc has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function _uri_to_assoc($n = 3, $default = array(), $which = 'segment')
          {
              if ( ! is_numeric($n))
              {
                  return $default;
      Severity: Minor
      Found in system/core/URI.php - About 1 hr to fix

        Method _set_uri_string has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function _set_uri_string($str, $is_cli = FALSE)
            {
                // CLI requests have a bit simpler logic
                if ($is_cli)
                {
        Severity: Minor
        Found in system/core/URI.php - About 1 hr to fix

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

              protected function _uri_to_assoc($n = 3, $default = array(), $which = 'segment')
              {
                  if ( ! is_numeric($n))
                  {
                      return $default;
          Severity: Minor
          Found in system/core/URI.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 _parse_request_uri has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function _parse_request_uri()
              {
                  if ( ! isset($_SERVER['REQUEST_URI'], $_SERVER['SCRIPT_NAME']))
                  {
                      return '';
          Severity: Minor
          Found in system/core/URI.php - About 1 hr to fix

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

                public function __construct(CI_Config $config)
                {
                    $this->config = $config;
            
                    // If it's a CLI request, ignore the configuration
            Severity: Minor
            Found in system/core/URI.php - About 1 hr to fix

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

                  protected function _parse_request_uri()
                  {
                      if ( ! isset($_SERVER['REQUEST_URI'], $_SERVER['SCRIPT_NAME']))
                      {
                          return '';
              Severity: Minor
              Found in system/core/URI.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 __construct has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function __construct(CI_Config $config)
                  {
                      $this->config = $config;
              
                      // If it's a CLI request, ignore the configuration
              Severity: Minor
              Found in system/core/URI.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

              There are no issues that match your filters.

              Category
              Status