Function tasks
has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring. Open
public function tasks($allowed_check = false)
{
$main = main();
if ($main->is_console() || $main->is_ajax()) {
$main->no_graphics(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
Function _check_block_rights
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
public function _check_block_rights($block_id = 0, $OBJECT = '', $ACTION = '')
{
if (empty($block_id) || empty($OBJECT)) {
return false;
}
- 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 yf_core_blocks.class.php
has 413 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Core blocks methods.
*
Consider simplifying this complex logical expression. Open
if (( ! is_array($rule_info['methods']) || $matched_method)
&& ( ! is_array($rule_info['user_groups']) || $matched_user_group)
&& ( ! is_array($rule_info['themes']) || $matched_theme || ! $CUR_USER_THEME)
&& ( ! is_array($rule_info['locales']) || $matched_locale || ! $CUR_LOCALE)
&& ( ! is_array($rule_info['site_ids']) || $matched_site || ! $CUR_SITE)
Function _show_block
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
public function _show_block($input = [])
{
if ( ! isset($this->_blocks_infos)) {
$this->_blocks_infos = main()->get_data('blocks_all');
}
- 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 tasks
has 105 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function tasks($allowed_check = false)
{
$main = main();
if ($main->is_console() || $main->is_ajax()) {
$main->no_graphics(true);
Method _show_block
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _show_block($input = [])
{
if ( ! isset($this->_blocks_infos)) {
$this->_blocks_infos = main()->get_data('blocks_all');
}
Method _check_block_rights
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _check_block_rights($block_id = 0, $OBJECT = '', $ACTION = '')
{
if (empty($block_id) || empty($OBJECT)) {
return false;
}
Function _action_on_block_denied
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function _action_on_block_denied($block_name = '')
{
if ($block_name == 'center_area') {
if ($this->TASK_DENIED_403_HEADER) {
header(($_SERVER['SERVER_PROTOCOL'] ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.1') . ' 403 Forbidden');
- 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 _get_denied_tasks_names
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function _get_denied_tasks_names()
{
$cache = 'cache_' . __FUNCTION__;
if (isset($this->$cache)) {
return $this->$cache;
- 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 prefetch_center
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function prefetch_center()
{
$block_name = 'center_area';
if ( ! isset($this->_blocks_infos)) {
$this->_blocks_infos = main()->get_data('blocks_all');
- 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 _get_denied_tasks_names
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _get_denied_tasks_names()
{
$cache = 'cache_' . __FUNCTION__;
if (isset($this->$cache)) {
return $this->$cache;
Method prefetch_center
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function prefetch_center()
{
$block_name = 'center_area';
if ( ! isset($this->_blocks_infos)) {
$this->_blocks_infos = main()->get_data('blocks_all');
Function _load_blocks_rules
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function _load_blocks_rules()
{
if ( ! empty($this->_blocks_rules)) {
return false;
}
- 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 $obj->$special_method_name($special_params);
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
return $this->_action_on_block_denied($block_name);
Avoid too many return
statements within this method. Open
return $this->tasks($allowed_check = true);
Avoid too many return
statements within this method. Open
return ($prepend ? implode(PHP_EOL, $prepend) : '') . $body . ($append ? implode(PHP_EOL, $append) : '');
Avoid too many return
statements within this method. Open
return false;
Function _get_center_block_id
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function _get_center_block_id()
{
if ( ! isset($this->_blocks_infos)) {
$this->_blocks_infos = main()->get_data('blocks_all');
}
- 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"