| Conditions | 8 |
| Paths | 128 |
| Total Lines | 120 |
| Code Lines | 73 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 288 | public function admineticMenus(): array |
||
| 289 | { |
||
| 290 | return [ |
||
| 291 | [ |
||
| 292 | 'type' => 'breaker', |
||
| 293 | 'name' => 'General', |
||
| 294 | 'description' => 'Administration Control', |
||
| 295 | ], |
||
| 296 | [ |
||
| 297 | 'type' => 'link', |
||
| 298 | 'name' => 'Dashboard', |
||
| 299 | 'icon' => 'fa fa-home', |
||
| 300 | 'link' => route('home'), |
||
| 301 | 'is_active' => request()->routeIs('home') ? 'active' : '', |
||
| 302 | 'conditions' => [ |
||
| 303 | [ |
||
| 304 | 'type' => 'and', |
||
| 305 | 'condition' => auth()->user()->hasRole('admin'), |
||
| 306 | ], |
||
| 307 | ], |
||
| 308 | ], |
||
| 309 | [ |
||
| 310 | 'type' => 'menu', |
||
| 311 | 'name' => 'User Management', |
||
| 312 | 'icon' => 'fa fa-users', |
||
| 313 | 'is_active' => request()->routeIs('user*') ? 'active' : '', |
||
| 314 | 'pill' => [ |
||
| 315 | 'class' => 'badge badge-info badge-air-info', |
||
| 316 | 'value' => \App\Models\User::count(), |
||
| 317 | ], |
||
| 318 | 'conditions' => [ |
||
| 319 | [ |
||
| 320 | 'type' => 'or', |
||
| 321 | 'condition' => auth()->user()->can('view-any', \App\Models\User::class), |
||
| 322 | ], |
||
| 323 | [ |
||
| 324 | 'type' => 'or', |
||
| 325 | 'condition' => auth()->user()->can('create', \App\Models\User::class), |
||
| 326 | ], |
||
| 327 | ], |
||
| 328 | 'children' => $this->indexCreateChildren('user', \App\Models\User::class), |
||
| 329 | ], |
||
| 330 | [ |
||
| 331 | 'type' => 'menu', |
||
| 332 | 'name' => 'Role', |
||
| 333 | 'icon' => 'fa fa-black-tie', |
||
| 334 | 'is_active' => request()->routeIs('role*') ? 'active' : '', |
||
| 335 | 'conditions' => [ |
||
| 336 | [ |
||
| 337 | 'type' => 'or', |
||
| 338 | 'condition' => auth()->user()->can('view-any', \Pratiksh\Adminetic\Models\Admin\Role::class), |
||
| 339 | ], |
||
| 340 | [ |
||
| 341 | 'type' => 'or', |
||
| 342 | 'condition' => auth()->user()->can('create', \Pratiksh\Adminetic\Models\Admin\Role::class), |
||
| 343 | ], |
||
| 344 | ], |
||
| 345 | 'children' => $this->indexCreateChildren('role', \Pratiksh\Adminetic\Models\Admin\Role::class), |
||
| 346 | ], |
||
| 347 | [ |
||
| 348 | 'type' => 'menu', |
||
| 349 | 'name' => 'Permission', |
||
| 350 | 'icon' => 'fa fa-check', |
||
| 351 | 'is_active' => request()->routeIs('permission*') ? 'active' : '', |
||
| 352 | 'conditions' => [ |
||
| 353 | [ |
||
| 354 | 'type' => 'or', |
||
| 355 | 'condition' => auth()->user()->can('view-any', \Pratiksh\Adminetic\Models\Admin\Permission::class), |
||
| 356 | ], |
||
| 357 | [ |
||
| 358 | 'type' => 'or', |
||
| 359 | 'condition' => auth()->user()->can('create', \Pratiksh\Adminetic\Models\Admin\Permission::class), |
||
| 360 | ], |
||
| 361 | ], |
||
| 362 | 'children' => $this->indexCreateChildren('permission', \Pratiksh\Adminetic\Models\Admin\Permission::class), |
||
| 363 | ], |
||
| 364 | [ |
||
| 365 | 'type' => 'menu', |
||
| 366 | 'name' => 'Setting', |
||
| 367 | 'icon' => 'fa fa-cog', |
||
| 368 | 'is_active' => request()->routeIs('setting*') ? 'active' : '', |
||
| 369 | 'conditions' => [ |
||
| 370 | [ |
||
| 371 | 'type' => 'or', |
||
| 372 | 'condition' => auth()->user()->can('view-any', \Pratiksh\Adminetic\Models\Admin\Setting::class), |
||
| 373 | ], |
||
| 374 | [ |
||
| 375 | 'type' => 'or', |
||
| 376 | 'condition' => auth()->user()->can('create', \Pratiksh\Adminetic\Models\Admin\Setting::class), |
||
| 377 | ], |
||
| 378 | ], |
||
| 379 | 'children' => $this->indexCreateChildren('setting', \Pratiksh\Adminetic\Models\Admin\Setting::class), |
||
| 380 | ], |
||
| 381 | [ |
||
| 382 | 'type' => 'menu', |
||
| 383 | 'name' => 'Preference', |
||
| 384 | 'icon' => 'fa fa-wrench', |
||
| 385 | 'is_active' => request()->routeIs('preference*') ? 'active' : '', |
||
| 386 | 'conditions' => [ |
||
| 387 | [ |
||
| 388 | 'type' => 'or', |
||
| 389 | 'condition' => auth()->user()->can('view-any', \Pratiksh\Adminetic\Models\Admin\Preference::class), |
||
| 390 | ], |
||
| 391 | [ |
||
| 392 | 'type' => 'or', |
||
| 393 | 'condition' => auth()->user()->can('create', \Pratiksh\Adminetic\Models\Admin\Preference::class), |
||
| 394 | ], |
||
| 395 | ], |
||
| 396 | 'children' => $this->indexCreateChildren('preference', \Pratiksh\Adminetic\Models\Admin\Preference::class), |
||
| 397 | ], |
||
| 398 | [ |
||
| 399 | 'type' => 'link', |
||
| 400 | 'name' => 'Activities', |
||
| 401 | 'icon' => 'fa fa-book', |
||
| 402 | 'is_active' => request()->routeIs('activity*') ? 'active' : '', |
||
| 403 | 'link' => adminRedirectRoute('activity'), |
||
| 404 | 'conditions' => [ |
||
| 405 | [ |
||
| 406 | 'type' => 'and', |
||
| 407 | 'condition' => auth()->user()->hasRole('admin'), |
||
| 408 | ], |
||
| 491 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths