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;
- Read upRead up
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
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;
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
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
- Read upRead up
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);
- Read upRead up
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);
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)
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))
{
- Read upRead up
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);
}
Avoid deeply nested control flow statements. Open
if ($proxy_ips[$i] === $this->ip_address)
{
$this->ip_address = $spoof;
break;
}