Showing 25 of 61 total issues
Function __call
has a Cognitive Complexity of 64 (exceeds 5 allowed). Consider refactoring. Open
public function __call(string $name, array $arguments)
{
$original_method_name = Str::snake($name);
preg_match('/^([a-z]+)_([a-z_]+)_([a-z]+)$/', $original_method_name, $matches);
- 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 Item.php
has 463 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/*
* This file is part of Laravel Navigation Builder.
*
Menu
has 35 functions (exceeds 20 allowed). Consider refactoring. Open
class Menu
{
/**
* Item collection.
*
Item
has 31 functions (exceeds 20 allowed). Consider refactoring. Open
class Item
{
/**
* No link specified.
*
Function render
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
public function render($menu_level = 0)
{
static::activateIfItemIsActive($this);
// Not authorized for this menu.
- 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 __call
has 85 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __call(string $name, array $arguments)
{
$original_method_name = Str::snake($name);
preg_match('/^([a-z]+)_([a-z_]+)_([a-z]+)$/', $original_method_name, $matches);
Method render
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function render($menu_level = 0)
{
static::activateIfItemIsActive($this);
// Not authorized for this menu.
File Menu.php
has 261 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/*
* This file is part of Laravel Navigation Builder.
*
Function activateIfItemIsActive
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public static function activateIfItemIsActive($item)
{
// No menu items provided.
if (empty($list = $item->getActiveIfItemIsActiveOption())) {
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
Function getMenu
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function getMenu($key)
{
if (is_array($key)) {
$menu_items = $key;
} else {
- 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
Consider simplifying this complex logical expression. Open
if (($action == 'add' || $action == 'remove' || $action == 'append' || $action == 'prepend')
&& ($key == 'item' || $key == 'container' || $key == 'link') && $method_name == 'attribute') {
$input_value = Arr::get($arguments, 1, '');
$current_value = Arr::get($this->{$key.'_'.$method_name}, Arr::get($arguments, 0, null), '');
Method renderDropdown
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function renderDropdown()
{
$menu_source = Arr::get($this->option, 'dropdown_source', null);
$config = Arr::get($this->option, 'dropdown_config', null);
Method __call
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __call($name, $arguments)
{
// $this->whereTitle(...)
preg_match('/^[W|w]here([a-zA-Z0-9_]+)$/', $name, $matches);
Function __call
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function __call($name, $arguments)
{
// $this->whereTitle(...)
preg_match('/^[W|w]here([a-zA-Z0-9_]+)$/', $name, $matches);
- 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 activateIfItemIsActive
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function activateIfItemIsActive($item)
{
// No menu items provided.
if (empty($list = $item->getActiveIfItemIsActiveOption())) {
return false;
Avoid deeply nested control flow statements. Open
if (($index = array_search($input_value, $current_value_array)) !== false) {
unset($current_value_array[$index]);
}
Function checkItemIsActive
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function checkItemIsActive($item)
{
if ($this->getActive()) {
return 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 renderDropdown
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function renderDropdown()
{
$menu_source = Arr::get($this->option, 'dropdown_source', null);
$config = Arr::get($this->option, 'dropdown_config', null);
- 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 $this;
Avoid too many return
statements within this method. Open
return $this;