| Conditions | 11 |
| Paths | 16 |
| Total Lines | 35 |
| Code Lines | 20 |
| 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 |
||
| 45 | return $array; |
||
| 46 | } |
||
| 47 | |||
| 48 | /** |
||
| 49 | * @param $value |
||
| 50 | * @param $key |
||
| 51 | * |
||
| 52 | * @return bool |
||
| 53 | */ |
||
| 54 | public static function unsetEmptyChildren($value, $key) |
||
|
1 ignored issue
–
show
|
|||
| 55 | { |
||
| 56 | if (is_bool($value)) { |
||
| 57 | return false; |
||
| 58 | } else { |
||
| 59 | return empty($value) ? true : false; |
||
| 60 | } |
||
| 61 | } |
||
| 62 | |||
| 63 | /** |
||
| 64 | * @param $value |
||
| 65 | * @param $key |
||
| 66 | * |
||
| 67 | * @return bool |
||
| 68 | */ |
||
| 69 | public static function unsetNullChildren($value, $key) |
||
|
1 ignored issue
–
show
|
|||
| 70 | { |
||
| 71 | return $value == null ? true : false; |
||
| 72 | } |
||
| 73 | } |
||
| 74 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.