Showing 209 of 326 total issues
Function controller
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
controller : ['$scope', 'ServiceLayoutsData', 'ServiceMenuData', function($scope, ServiceLayoutsData, ServiceMenuData) {
$scope.data.use_draft = 0;
$scope.data.layout_id = 0;
$scope.data.from_draft_id = 0;
Method createRedirectItem
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createRedirectItem($navId, $langId, $title, $alias, $redirectType, $redirectTypeValue, $description, $redirectTypeTarget): array|int
{
$_errors = [];
$navItem = new NavItem();
Method findOneByHostName
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function findOneByHostName($hostName): array|bool
{
$cache = $this->getHasCache($hostName);
if ($cache) {
return $cache;
Method createModuleItem
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createModuleItem($navId, $langId, $title, $alias, $moduleName, $description, $controllerName, $actionName, array $actionParams): array|int
{
$_errors = [];
$navItem = new NavItem();
Method testBasicBlockImporter
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testBasicBlockImporter()
{
// config fixture
$configFixture = new ActiveRecordFixture([
'modelClass' => Config::class
Method createPage
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
public function createPage($parentNavId, $navContainerId, $langId, $title, $alias, $layoutId, $description, $isDraft = false): array|int
Method createPageFromDraft
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
public function createPageFromDraft($parentNavId, $navContainerId, $langId, $title, $alias, $description, $fromDraftNavId, $isDraft = false): bool|array
Method createRedirectItem
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
public function createRedirectItem($navId, $langId, $title, $alias, $redirectType, $redirectTypeValue, $description, $redirectTypeTarget): array|int
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 handleLayoutFile
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected function handleLayoutFile(&$layoutFiles, $path, $themeName = null)
{
$aliased = Yii::getAlias($path, false);
$filePath = $aliased ?: $path;
- 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 controller
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
controller : ['$scope', '$http', '$filter', 'ServiceMenuData', 'ServiceLanguagesData', 'AdminToastService', 'ServiceCurrentWebsite', function($scope, $http, $filter, ServiceMenuData, ServiceLanguagesData, AdminToastService, ServiceCurrentWebsite) {
Function actionCatch
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function actionCatch($path)
{
$compositePath = Yii::$app->composition->prependTo($path);
foreach (Redirect::find()->all() as $redirect) {
if ($redirect->matchRequestPath($path)) {
- 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 handleBlockDefintionInDirectories
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected function handleBlockDefintionInDirectories(array $directories, $blockDefinition)
{
$results = [];
foreach ($directories as $directoryPath) {
$path = rtrim((string) $directoryPath, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . ltrim((string) $blockDefinition, DIRECTORY_SEPARATOR);
- 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 findInternalRedirect
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected function findInternalRedirect()
{
$path = Yii::$app->request->pathInfo;
$compositePath = Yii::$app->composition->prependTo($path);
foreach (Redirect::find()->all() as $redirect) {
- 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
Method createPageItem
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public function createPageItem($navId, $langId, $title, $alias, $layoutId, $description): array|int
Function actionIndex
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function actionIndex()
{
try {
$current = Yii::$app->menu->current;
} catch (Exception $e) {
- 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 actionDeepPageCopy
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function actionDeepPageCopy()
{
$navId = (int) Yii::$app->request->getBodyParam('navId');
if (empty($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 actionCreatePageVersion
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function actionCreatePageVersion()
{
$fromPageModel = null;
$name = Yii::$app->request->post('name');
$fromPageId = (int) Yii::$app->request->post('fromPageId');
- 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
Avoid deeply nested control flow statements. Open
if ($parentNavId) {
$data = $node->title . '/' . $data;
}