File NavController.php
has 376 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace luya\cms\admin\apis;
use luya\admin\models\TagRelation;
NavController
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
class NavController extends \luya\admin\base\RestController
{
private function postArg($name, $defautValue = null)
{
return Yii::$app->request->post($name, $defautValue);
Function actionSaveProperties
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function actionSaveProperties($navId)
{
$rows = [];
$doNotDeleteList = [];
- 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 actionDelete
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function actionDelete($navId)
{
if (!Yii::$app->adminuser->canRoute(Module::ROUTE_PAGE_DELETE)) {
throw new ForbiddenHttpException("Unable to remove this page due to permission restrictions.");
}
Method actionSaveProperties
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function actionSaveProperties($navId)
{
$rows = [];
$doNotDeleteList = [];
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 actionDelete
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function actionDelete($navId)
{
if (!Yii::$app->adminuser->canRoute(Module::ROUTE_PAGE_DELETE)) {
throw new ForbiddenHttpException("Unable to remove this page due to permission restrictions.");
}
- 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"