Function getItems
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
public static function getItems()
{
if (self::$items === null) {
$items = Nav::find()
->select(['cms_nav.id', 'nav_item_id' => 'cms_nav_item.id', 'nav_container_id', 'parent_nav_id', 'is_hidden', 'layout_file', 'is_offline', 'is_draft', 'is_home', 'cms_nav_item.title'])
- 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 getItems
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getItems()
{
if (self::$items === null) {
$items = Nav::find()
->select(['cms_nav.id', 'nav_item_id' => 'cms_nav_item.id', 'nav_container_id', 'parent_nav_id', 'is_hidden', 'layout_file', 'is_offline', 'is_draft', 'is_home', 'cms_nav_item.title'])
Function loadInheritanceData
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private static function loadInheritanceData($parentNavId = 0, $fromInheritNode = false)
{
// get items from singleton object
$items = self::getNavItems()[$parentNavId] ?? [];
foreach ($items as $item) {
- 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 checkUserWebsitePermissions
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function checkUserWebsitePermissions(array $website)
{
/** @var User $user */
$user = Yii::$app->adminuser->identity;
$userGroupIds = ArrayHelper::getColumn($user->groups, 'id');
- 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 navGroupInheritanceNode
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function navGroupInheritanceNode($navId, Group $group)
{
// default defintion is false
$definition = false;
// see if permission data for group exists, foreach items and set if match
- 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 getWebsites
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function getWebsites()
{
if (self::$websites === null) {
$websites = (new Query())
->select([
- 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"