Function _check_if_need_to_cache
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public function _check_if_need_to_cache()
{
// Fast implementation of disabling output caching for the current page
if (conf('no_output_cache')) {
$this->NO_NEED_TO_CACHE = true;
- 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 _check_if_need_to_cache
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _check_if_need_to_cache()
{
// Fast implementation of disabling output caching for the current page
if (conf('no_output_cache')) {
$this->NO_NEED_TO_CACHE = true;
Function _init
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function _init($params = [])
{
// Assign group_id = 1 for guests
if (empty($_SESSION['user_group'])) {
$_SESSION['user_group'] = 1;
- 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 too many return
statements within this method. Open
return false; // Default return value
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
return $this->NO_NEED_TO_CACHE;
Avoid too many return
statements within this method. Open
return $this->NO_NEED_TO_CACHE;
Avoid too many return
statements within this method. Open
return $this->NO_NEED_TO_CACHE;
Avoid too many return
statements within this method. Open
return $this->NO_NEED_TO_CACHE;
Function _send_http_headers
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function _send_http_headers($cache_last_modified_time = 0)
{
// Send correct headers
header('Content-Type: text/html; charset=' . conf('charset'), 1);
header('Content-language: ' . conf('language'), 1);
- 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"