| Conditions | 11 |
| Paths | 10 |
| Total Lines | 34 |
| Code Lines | 24 |
| 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 |
||
| 18 | public function handle($request, Closure $next) |
||
| 19 | { |
||
| 20 | $admin_path = config('crudbooster.ADMIN_PATH') ?: 'admin'; |
||
| 21 | |||
| 22 | if (CRUDBooster::myId() == '') { |
||
| 23 | $url = url($admin_path.'/login'); |
||
| 24 | |||
| 25 | return redirect($url)->with('message', trans('crudbooster.not_logged_in')); |
||
| 26 | } |
||
| 27 | if (CRUDBooster::isLocked()) { |
||
| 28 | $url = url($admin_path.'/lock-screen'); |
||
| 29 | |||
| 30 | return redirect($url); |
||
| 31 | } |
||
| 32 | if($request->url()==CRUDBooster::adminPath('')){ |
||
| 33 | $menus=DB::table('cms_menus')->whereRaw("cms_menus.id IN (select id_cms_menus from cms_menus_privileges where id_cms_privileges = '".CRUDBooster::myPrivilegeId()."')")->where('is_dashboard', 1)->where('is_active', 1)->first(); |
||
| 34 | if ($menus) { |
||
| 35 | if ($menus->type == 'Statistic') { |
||
| 36 | return redirect()->action('\crocodicstudio\crudbooster\controllers\StatisticBuilderController@getDashboard'); |
||
| 37 | } elseif ($menus->type == 'Module') { |
||
| 38 | $module = CRUDBooster::first('cms_moduls', ['path' => $menus->path]); |
||
| 39 | return redirect()->action( $module->controller.'@getIndex'); |
||
| 40 | } elseif ($menus->type == 'Route') { |
||
| 41 | $action = str_replace("Controller", "Controller@", $menus->path); |
||
| 42 | $action = str_replace(['Get', 'Post'], ['get', 'post'], $action); |
||
| 43 | return redirect()->action($action); |
||
| 44 | } elseif ($menus->type == 'Controller & Method') { |
||
| 45 | return redirect()->action($menus->path); |
||
| 46 | } elseif ($menus->type == 'URL') { |
||
| 47 | return redirect($menus->path); |
||
| 48 | } |
||
| 49 | } |
||
| 50 | } |
||
| 51 | return $next($request); |
||
| 52 | } |
||
| 54 |
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