Menu
has 33 functions (exceeds 20 allowed). Consider refactoring. Open
class Menu extends Component implements \ArrayAccess, QueryOperatorFieldInterface
{
use CacheableTrait;
/**
File Menu.php
has 336 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace luya\cms;
use luya\cms\menu\InjectItemInterface;
Method loadWebsiteLanguageContainer
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function loadWebsiteLanguageContainer($langShortCode)
{
$hostName = $this->request->hostName;
$cacheKey = $this->_cachePrefix.$hostName.$langShortCode;
Function resolveCurrent
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private function resolveCurrent()
{
$requestPath = $this->request->get('path', null);
if (empty($requestPath)) {
- 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 resolveCurrent
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function resolveCurrent()
{
$requestPath = $this->request->get('path', null);
if (empty($requestPath)) {
Function loadWebsiteLanguageContainer
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function loadWebsiteLanguageContainer($langShortCode)
{
$hostName = $this->request->hostName;
$cacheKey = $this->_cachePrefix.$hostName.$langShortCode;
- 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 getLevelContainer
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getLevelContainer($level, Item $baseItem = null): array|\luya\cms\menu\QueryIteratorFilter
{
// define if the requested level is the root line (level 1) or not
$rootLine = ($level === 1) ? true : false;
// countdown the level (as we need the parent of the element to get the children
- 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"