| Conditions | 11 | 
| Paths | 192 | 
| Total Lines | 35 | 
| Code Lines | 31 | 
| 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  | 
            ||
| 20 | public function index(Request $request)  | 
            ||
| 21 |     { | 
            ||
| 22 | $all_data=$request->all();  | 
            ||
| 23 | $contestModel=new ContestModel();  | 
            ||
| 24 | $filter["rule"]=isset($all_data["rule"]) ? $all_data["rule"] : null;  | 
            ||
| 25 | $filter["public"]=isset($all_data["public"]) ? $all_data["public"] : null;  | 
            ||
| 26 | $filter["verified"]=isset($all_data["verified"]) ? $all_data["verified"] : null;  | 
            ||
| 27 | $filter["rated"]=isset($all_data["rated"]) ? $all_data["rated"] : null;  | 
            ||
| 28 | $filter["anticheated"]=isset($all_data["anticheated"]) ? $all_data["anticheated"] : null;  | 
            ||
| 29 | $filter["practice"]=isset($all_data["practice"]) ? $all_data["practice"] : null;  | 
            ||
| 30 | $return_list=$contestModel->list($filter,Auth::check()?Auth::user()->id:0);  | 
            ||
| 31 | $featured=$contestModel->featured();  | 
            ||
| 32 |         if (is_null($return_list)) { | 
            ||
| 33 |             if (isset($all_data["page"]) && $all_data["page"]>1) { | 
            ||
| 34 |                 return redirect("/contest"); | 
            ||
| 35 |             } else { | 
            ||
| 36 |                 return view('contest.index', [ | 
            ||
| 37 | 'page_title'=>"Contest",  | 
            ||
| 38 |                     'site_title'=>config("app.name"), | 
            ||
| 39 | 'navigation' => "Contest",  | 
            ||
| 40 | 'contest_list'=> null,  | 
            ||
| 41 | 'paginator' => null,  | 
            ||
| 42 | 'featured'=>$featured,  | 
            ||
| 43 | 'filter' => $filter  | 
            ||
| 44 | ]);  | 
            ||
| 45 | }  | 
            ||
| 46 |         } else { | 
            ||
| 47 |             return view('contest.index', [ | 
            ||
| 48 | 'page_title'=>"Contest",  | 
            ||
| 49 |                 'site_title'=>config("app.name"), | 
            ||
| 50 | 'navigation' => "Contest",  | 
            ||
| 51 | 'contest_list'=>$return_list['contents'],  | 
            ||
| 52 | 'paginator' => $return_list['paginator'],  | 
            ||
| 53 | 'featured'=>$featured,  | 
            ||
| 54 | 'filter' => $filter  | 
            ||
| 55 | ]);  | 
            ||
| 92 |