Showing 209 of 326 total issues
Method testSetUrlRuleParamsForI18nSlugUrlRules
has 98 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testSetUrlRuleParamsForI18nSlugUrlRules()
{
$langFixture = $this->createAdminLangFixture([
'de' => [
'id' => 1,
Method testModuleBlock
has 90 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testModuleBlock()
{
$tpl = <<<'EOT'
<?php
File NavItem.php
has 316 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace luya\cms\models;
use luya\admin\base\GenericSearchInterface;
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 actionCreate
has 89 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function actionCreate()
{
if (empty($this->type)) {
Console::clearScreenBeforeCursor();
$this->type = $this->select('Do you want to create an app or module Block?', [
Method testAppBlock
has 89 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testAppBlock()
{
$tpl = <<<'EOT'
<?php
File BlockPlaceholderIterationTest.php
has 313 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace cmstests\data\blocks;
use cmstests\CmsFrontendTestCase;
NavItem
has 29 functions (exceeds 20 allowed). Consider refactoring. Open
class NavItem extends ActiveRecord implements GenericSearchInterface
{
public const TYPE_PAGE = 1;
public const TYPE_MODULE = 2;
Function actionCreate
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
public function actionCreate()
{
if (empty($this->type)) {
Console::clearScreenBeforeCursor();
$this->type = $this->select('Do you want to create an app or module 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 importLayoutFile
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
protected function importLayoutFile($file, $aliased, $themeName = null)
{
if (!file_exists($file)) {
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
InjectItem
has 28 functions (exceeds 20 allowed). Consider refactoring. Open
class InjectItem extends BaseObject implements InjectItemInterface
{
/**
* @var integer The user id who created this page.
*/
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;
Function renderItem
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
public function renderItem($navItemId, $appendix = null, bool|int $setNavItemTypeId = false)
{
$model = NavItem::find()->where(['id' => $navItemId])->with(['nav'])->one();
if (!$model) {
- 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 testRegisterDefaultVariations
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testRegisterDefaultVariations()
{
$this->app->getModule('cmsadmin')->blockVariations = [
TestingBlock::variations()
->add('idf', 'My Test')
Method testRenderPlaceholderIteration
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testRenderPlaceholderIteration()
{
$this->app->setComponents([
'db' => [
'class' => 'yii\db\Connection',
File InternalBaseBlock.php
has 297 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace luya\cms\base;
use luya\admin\base\TypesInterface;
Method renderItem
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function renderItem($navItemId, $appendix = null, bool|int $setNavItemTypeId = false)
{
$model = NavItem::find()->where(['id' => $navItemId])->with(['nav'])->one();
if (!$model) {
Method testActionToggleHome
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testActionToggleHome()
{
PermissionScope::run($this->app, function (PermissionScope $scope) {
$this->createAdminLangFixture();
$this->createCmsNavItemRedirectFixture();
Function actionDataBlocks
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public function actionDataBlocks()
{
$favs = Yii::$app->adminuser->identity->setting->get("blockfav", []);
$groups = [];
foreach (BlockGroup::find()->with(['blocks'])->all() as $blockGroup) {
- 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 importLayoutFile
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function importLayoutFile($file, $aliased, $themeName = null)
{
if (!file_exists($file)) {
return false;
}