| Conditions | 11 | 
| Paths | 12 | 
| Total Lines | 34 | 
| Code Lines | 19 | 
| 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  | 
            ||
| 17 | public static function handle($data, $parameters, $posts, $responsesFields, $ctrl)  | 
            ||
| 18 |     { | 
            ||
| 19 | $row = $data->first();  | 
            ||
| 20 | |||
| 21 |         if (! $row) { | 
            ||
| 22 | return ApiResponder::makeResult(0, 'There is no data found !');  | 
            ||
| 23 | }  | 
            ||
| 24 | |||
| 25 |         foreach ($parameters as $param) { | 
            ||
| 26 | $name = $param['name'];  | 
            ||
| 27 | $type = $param['type'];  | 
            ||
| 28 | $value = $posts[$name];  | 
            ||
| 29 | $used = $param['used'];  | 
            ||
| 30 | $required = $param['required'];  | 
            ||
| 31 | |||
| 32 |             if ($param['config'] != '' && substr($param['config'], 0, 1) != '*') { | 
            ||
| 33 | $value = $param['config'];  | 
            ||
| 34 | }  | 
            ||
| 35 |             if (Hash::check($value, $row->{$name})) { | 
            ||
| 36 | continue;  | 
            ||
| 37 | }  | 
            ||
| 38 | |||
| 39 |             if ($required && $type == 'password') { | 
            ||
| 40 | self::passwordError($posts, $ctrl);  | 
            ||
| 41 | }  | 
            ||
| 42 | |||
| 43 |             if (! $required && $used && $value) { | 
            ||
| 44 | self::passwordError($posts, $ctrl);  | 
            ||
| 45 | }  | 
            ||
| 46 | }  | 
            ||
| 47 | |||
| 48 | self::handleFile($row, $responsesFields);  | 
            ||
| 
                                                                                                    
                        
                         | 
                |||
| 49 | |||
| 50 | return self::success($row);  | 
            ||
| 51 | }  | 
            ||
| 92 | }  |