Showing 209 of 326 total issues
Function controller
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
controller : ['$scope', function($scope) {
$scope.changeModel = function(data) {
$scope.navId = data.id;
}
Function actionCleanup
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function actionCleanup()
{
// return all pages with deleted items
$navIds = Nav::find()->where(['is_deleted' => true])->select(['id'])->column();
- 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 getRowDescriber
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function getRowDescriber()
{
if (!empty($this->row_id)) {
switch (StorageFile::cleanBaseTableName($this->table_name)) {
case "cms_nav":
- 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 testRenderFrontend
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testRenderFrontend()
{
$this->createAdminLangFixture([
1 => [
'id' => 1,
Method loadWebsiteLanguageContainer
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function loadWebsiteLanguageContainer($langShortCode)
{
$hostName = $this->request->hostName;
$cacheKey = $this->_cachePrefix.$hostName.$langShortCode;
Function actionGetNavItemPath
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function actionGetNavItemPath($navId)
{
$data = "";
$node = NavItem::find()->where(['nav_id' => $navId])->one();
if ($node) {
- 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 getLink
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function getLink()
{
// take care of redirect
if ($this->getType() === 3 && !empty($this->redirectMapData('value'))) {
// generate convert object to determine correctn usage.
- 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 run
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function run()
{
$currentLang = Yii::$app->composition['langShortCode'];
$rule = Yii::$app->menu->currentUrlRule;
- 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 ngRestAttributeTypes
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function ngRestAttributeTypes()
{
return [
'name' => 'text',
'host' => 'slug',
Method copyPageItem
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function copyPageItem(NavItem $targetNavItem)
{
if ($this->nav_item_type !== self::TYPE_PAGE) {
return false;
}
Method actionCleanup
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function actionCleanup()
{
// return all pages with deleted items
$navIds = Nav::find()->where(['is_deleted' => true])->select(['id'])->column();
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'])
Method testDelete
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testDelete()
{
PermissionScope::run($this->app, function (PermissionScope $scope) {
$this->createAdminLangFixture();
$this->createCmsWebsiteFixture([
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 resolveCurrent
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private function resolveCurrent()
{
$requestPath = $this->request->get('path', null);
if (empty($requestPath)) {
- 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 getItems
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private function getItems(NavContainer $container, $parentNavId = 0, $parentGroup = [], $index = 1)
{
$navs = $container->getNavs()->andWhere(['parent_nav_id' => $parentNavId])->all();
foreach ($navs as $nav) {
- 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 updateNavItemData
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
$scope.updateNavItemData = function(itemCopy, typeDataCopy) {
$scope.errors = [];
var headers = {"headers" : { "Content-Type" : "application/x-www-form-urlencoded; charset=UTF-8" }};
var navItemId = itemCopy.id;
Method createPage
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createPage($parentNavId, $navContainerId, $langId, $title, $alias, $layoutId, $description, $isDraft = false): array|int
{
$_errors = [];
$nav = $this;
Function initializer
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
function initializer() {
$scope.navData = $filter('filter')($scope.menuData.items, {id: $scope.id}, true)[0];
if ($scope.navData == undefined) {
$scope.isDraft = true;
} else {
Method createRedirect
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createRedirect($parentNavId, $navContainerId, $langId, $title, $alias, $redirectType, $redirectTypeValue, $description, $redirectTypeTarget, $anchor = null): array|int
{
$_errors = [];
$nav = $this;