Showing 209 of 326 total issues
Method testMatchRequestPath
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testMatchRequestPath()
{
$fixture = new NgRestModelFixture([
'modelClass' => Redirect::class
]);
Method buildList
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function buildList(QueryIteratorFilter $iterator, $i = 1)
{
// Abort if maxDepth is set & reached
if ($this->maxDepth !== null && $i >= ($this->maxDepth + 1)) {
return "";
Function dropItemPlaceholder
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
$scope.dropItemPlaceholder = function(dragged,dropped,position) {
if (dragged.hasOwnProperty('favorized') || dragged.hasOwnProperty('newblock')) {
// its a new block
$http.post('admin/api-cms-navitempageblockitem/create', {
prev_id : dropped.prev_id,
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.");
}
Function dropItemPlaceholder
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
$scope.dropItemPlaceholder = function(dragged,dropped,position) {
if (dragged.hasOwnProperty('favorized') || dragged.hasOwnProperty('newblock')) {
// its a new block
$http.post('admin/api-cms-navitempageblockitem/create', {
prev_id: dropped.prev_id,
Method testFindByTags
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testFindByTags()
{
PageScope::run($this->app, function (PageScope $scope) {
$scope->createAdminGroupFixture(1);
$scope->createAdminUserFixture();
Method createModuleItem
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
public function createModuleItem($navId, $langId, $title, $alias, $moduleName, $description, $controllerName, $actionName, array $actionParams): array|int
Method actionSaveProperties
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function actionSaveProperties($navId)
{
$rows = [];
$doNotDeleteList = [];
Method testActionTags
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testActionTags()
{
PermissionScope::run($this->app, function (PermissionScope $scope) {
$scope->createAndAllowRoute('webmodel/nav/tags');
$scope->createAndAllowRoute('webmodel/nav/save-tags');
Method generateItems
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function generateItems($start, $end, $lang)
{
$data = [];
foreach (range($start, $end) as $number) {
$data[$number] = [
Function renderToolbar
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function renderToolbar($event)
{
Yii::info('LUYA CMS Toolbar rendering start', __METHOD__);
$props = [];
- 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 createHostInfoMapping
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function createHostInfoMapping()
{
$hostInfoMapping = [];
foreach ($this->loadAllWebsiteData() as $website) {
- 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 luyaBootstrap
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function luyaBootstrap(Application $app)
{
if (!$app->request->isConsoleRequest && !$app->request->isAdmin) {
if ($app->has('composition') && $app->has('website')) {
if (empty($app->composition->hostInfoMapping)) {
- 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 imageUpload
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public static function imageUpload(string|int|null $value, bool|string $applyFilter = false, $returnObject = false): bool|array|\luya\admin\image\Item
{
if (empty($value)) {
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
Function controller
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
controller : ['$scope', '$http', function($scope, $http) {
$scope.parent = $scope.$parent.$parent;
$scope.navItemId = $scope.parent.item.id;
Method getItems
has 27 lines of code (exceeds 25 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) {
Method run
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function run()
{
// when the setup timestamp is not yet set, its a fresh installation, therefore skip the 1.0.0 generic block upgrade
// otherwise its an existing/upgrading instance which is doing the import command.
if (!Config::has(Config::CONFIG_SETUP_COMMAND_TIMESTAMP)) {
Method testBlockEnvOptions
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testBlockEnvOptions()
{
$block = new TestBlock();
$pageObject = new ActiveRecord(); // @TODO specify class
Method getConfigArray
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getConfigArray()
{
return [
'id' => 'ngresttest',
'basePath' => dirname(__DIR__),
Method testItemFunctions
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testItemFunctions()
{
$obj = Yii::$app->menu->findOne(['id' => 1]);
$this->assertEquals(1, $obj->id);