Showing 209 of 326 total issues
Function copySubBlocksTo
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function copySubBlocksTo($sourceId, $targetPrevId, $targetNavItemPageId)
{
if ($sourceId) {
$subBlocks = NavItemPageBlockItem::findAll(['prev_id' => $sourceId]);
foreach ($subBlocks as $block) {
- 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 deleteAllSubBlocks
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function deleteAllSubBlocks($blockId)
{
if ($blockId) {
$subBlocks = NavItemPageBlockItem::findAll(['prev_id' => $blockId]);
foreach ($subBlocks as $block) {
- 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"
Further reading
Function fileUpload
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function fileUpload($fileId, $returnObject = false): bool|array|\luya\admin\file\Item
{
if (!empty($fileId)) {
$file = Yii::$app->storage->getFile($fileId);
/* @var \luya\admin\file\Item $file */
- 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 actionDeepPageCopyAsTemplate
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function actionDeepPageCopyAsTemplate()
{
$newItem = null;
$navId = (int) Yii::$app->request->getBodyParam('navId');
- 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"
Further reading
Function actionMigrate
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function actionMigrate($old, $replace)
{
$block = Block::find()->where(['like', 'class', $old])->one();
if (!$block) {
- 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"
Further reading
Function testBasicBlockImporterWithFailingDefintion
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function testBasicBlockImporterWithFailingDefintion()
{
// config fixture
$configFixture = new ActiveRecordFixture([
'modelClass' => Config::class
- 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"