pepiscms/application/libraries/MenuRendor.php
Function render
has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring. Open
Open
public function render($controller, $method, $language_code = '', $pull_submenu_from_controller = false, $current_module = false)
{
$menu = $this->config->item('menu');
$pull_submenu_from_controller = $this->ensurePulledSumbenuFromControllerIsSet($controller, $pull_submenu_from_controller);
- 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 render
has 93 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function render($controller, $method, $language_code = '', $pull_submenu_from_controller = false, $current_module = false)
{
$menu = $this->config->item('menu');
$pull_submenu_from_controller = $this->ensurePulledSumbenuFromControllerIsSet($controller, $pull_submenu_from_controller);
File MenuRendor.php
has 273 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
/**
* PepisCMS
*
Method computeSubmenuItem
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
private function computeSubmenuItem($controller, $method, $language_code, $pull_submenu_from_controller,
array $menu_map_item_template, $item, $module, array $menu_map_item)
Function buildSubmenuUrl
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
private function buildSubmenuUrl($module, $item, $language_code)
{
if (!$module->name) {
$submenu_url = admin_url() . $item[self::PROP_CONTROLLER] . '/';
} elseif (isset($item[self::PROP_MODULE]) && $item[self::PROP_MODULE]) {
- 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 render
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
public function render($controller, $method, $language_code = '', $pull_submenu_from_controller = false, $current_module = false)
Method buildMenuItem
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
private function buildMenuItem($language_code, $pull_submenu_from_controller, $current_module, array $menu_map_item_template, $item)
Method computeCacheVariableName
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
private function computeCacheVariableName($controller, $method, $language_code, $pull_submenu_from_controller, $current_module)