bcit-ci/CodeIgniter

View on GitHub
system/core/Router.php

Summary

Maintainability
C
1 day
Test Coverage

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

    protected function _set_routing()
    {
        // Load the routes.php file. It would be great if we could
        // skip this for enable_query_strings = TRUE, but then
        // default_controller would be empty ...
Severity: Minor
Found in system/core/Router.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 _set_routing has 57 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function _set_routing()
    {
        // Load the routes.php file. It would be great if we could
        // skip this for enable_query_strings = TRUE, but then
        // default_controller would be empty ...
Severity: Major
Found in system/core/Router.php - About 2 hrs to fix

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

        protected function _parse_routes()
        {
            // Turn the segment array into a URI string
            $uri = implode('/', $this->uri->segments);
    
    
    Severity: Minor
    Found in system/core/Router.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_routes has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function _parse_routes()
        {
            // Turn the segment array into a URI string
            $uri = implode('/', $this->uri->segments);
    
    
    Severity: Minor
    Found in system/core/Router.php - About 1 hr to fix

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

          protected function _set_request($segments = array())
          {
              $segments = $this->_validate_request($segments);
              // If we don't have any segments left - try the default controller;
              // WARNING: Directories get shifted out of the segments array!
      Severity: Minor
      Found in system/core/Router.php - About 1 hr to fix

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

            protected function _set_request($segments = array())
            {
                $segments = $this->_validate_request($segments);
                // If we don't have any segments left - try the default controller;
                // WARNING: Directories get shifted out of the segments array!
        Severity: Minor
        Found in system/core/Router.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