bcit-ci/CodeIgniter

View on GitHub
system/core/Input.php

Summary

Maintainability
F
3 days
Test Coverage

Function ip_address has a Cognitive Complexity of 68 (exceeds 5 allowed). Consider refactoring.
Open

    public function ip_address()
    {
        if ($this->ip_address !== FALSE)
        {
            return $this->ip_address;
Severity: Minor
Found in system/core/Input.php - About 1 day 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

File Input.php has 353 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/Input.php - About 4 hrs to fix

    Method ip_address has 94 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function ip_address()
        {
            if ($this->ip_address !== FALSE)
            {
                return $this->ip_address;
    Severity: Major
    Found in system/core/Input.php - About 3 hrs to fix

      Method set_cookie has 73 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function set_cookie($name, $value = '', $expire = 0, $domain = '', $path = '/', $prefix = '', $secure = NULL, $httponly = NULL, $samesite = NULL)
          {
              if (is_array($name))
              {
                  // always leave 'name' in last place, as the loop will break otherwise, due to $$item
      Severity: Major
      Found in system/core/Input.php - About 2 hrs to fix

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

            public function set_cookie($name, $value = '', $expire = 0, $domain = '', $path = '/', $prefix = '', $secure = NULL, $httponly = NULL, $samesite = NULL)
            {
                if (is_array($name))
                {
                    // always leave 'name' in last place, as the loop will break otherwise, due to $$item
        Severity: Minor
        Found in system/core/Input.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 _fetch_from_array has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function _fetch_from_array(&$array, $index = NULL, $xss_clean = FALSE)
            {
                // If $index is NULL, it means that the whole $array is requested
                isset($index) OR $index = array_keys($array);
        
        
        Severity: Minor
        Found in system/core/Input.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 _fetch_from_array has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function _fetch_from_array(&$array, $index = NULL, $xss_clean = FALSE)
            {
                // If $index is NULL, it means that the whole $array is requested
                isset($index) OR $index = array_keys($array);
        
        
        Severity: Minor
        Found in system/core/Input.php - About 1 hr to fix

          Method set_cookie has 9 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              public function set_cookie($name, $value = '', $expire = 0, $domain = '', $path = '/', $prefix = '', $secure = NULL, $httponly = NULL, $samesite = NULL)
          Severity: Major
          Found in system/core/Input.php - About 1 hr to fix

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

                public function request_headers($xss_clean = FALSE)
                {
                    // If header is already defined, return it immediately
                    if ( ! empty($this->headers))
                    {
            Severity: Minor
            Found in system/core/Input.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

            Avoid deeply nested control flow statements.
            Open

                                        for ($j = 0; $j < 8; $j++)
                                        {
                                            $ip[$j] = intval($ip[$j], 16);
                                        }
            Severity: Major
            Found in system/core/Input.php - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      if ($proxy_ips[$i] === $this->ip_address)
                                      {
                                          $this->ip_address = $spoof;
                                          break;
                                      }
              Severity: Major
              Found in system/core/Input.php - About 45 mins to fix

                There are no issues that match your filters.

                Category
                Status