Function renderPlaceholderRecursive
has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring. Open
private function renderPlaceholderRecursive($navItemPageId, $placeholderVar, $prevId, $layoutBlockInstance = null)
{
$string = '';
$i = 0;
$equalIndex = 1;
- 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 NavItemPage.php
has 370 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace luya\cms\models;
use luya\cms\admin\Module;
Method renderPlaceholderRecursive
has 83 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function renderPlaceholderRecursive($navItemPageId, $placeholderVar, $prevId, $layoutBlockInstance = null)
{
$string = '';
$i = 0;
$equalIndex = 1;
NavItemPage
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
class NavItemPage extends NavItemType implements NavItemTypeInterface, ViewContextInterface
{
use CacheableTrait;
/**
Method getBlockItem
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getBlockItem(NavItemPageBlockItem $blockItem, NavItemPage $navItemPage, array $envOptions = [])
{
// if the block relation could be found, return false.
if (!$blockItem->block) {
return false;
Method getPlaceholder
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getPlaceholder($placeholderVar, $prevId, NavItemPage $navItemPage)
{
$nav_item_page_block_item_data = NavItemPageBlockItem::find()
->select(['id', 'block_id', 'json_config_values', 'json_config_cfg_values', 'nav_item_page_id', 'is_dirty', 'is_hidden', 'variation'])
->where(['prev_id' => $prevId, 'nav_item_page_id' => $navItemPage->id, 'placeholder_var' => $placeholderVar])
Function getContentAsArray
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function getContentAsArray()
{
//$nav_item_page = (new \yii\db\Query())->select('*')->from('cms_nav_item_page t1')->leftJoin('cms_layout', 'cms_layout.id=t1.layout_id')->where(['t1.id' => $this->id])->one();
$nav_item_page = $this;
- 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 getBlockItem
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function getBlockItem(NavItemPageBlockItem $blockItem, NavItemPage $navItemPage, array $envOptions = [])
{
// if the block relation could be found, return false.
if (!$blockItem->block) {
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 copyBlocks
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function copyBlocks($fromPageId, $toPageId)
{
$pageBlocks = NavItemPageBlockItem::find()->where(['nav_item_page_id' => $fromPageId])->asArray(true)->all();
$idLink = [];
- 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 getContent
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getContent()
{
if (!$this->layout) {
throw new InvalidConfigException("Unable to find the requested cms layout '{$this->layout_id}' for nav item page id '{$this->id}'. Make sure your page does not have an old inactive/deleted cms layout selected.");
}
- 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"