Conditions | 11 |
Paths | 13 |
Total Lines | 14 |
Code Lines | 11 |
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 |
||
53 | private static function dump($dataType, int $indent) |
||
54 | { |
||
55 | if (is_scalar($dataType)) { |
||
56 | switch (gettype($dataType)) { |
||
57 | case 'boolean': return $dataType ? 'true' : 'false';break; |
||
1 ignored issue
–
show
|
|||
58 | case 'float': if (is_infinite($dataType)) return $dataType > 0 ? '.inf' : '-.inf'; |
||
2 ignored issues
–
show
|
|||
59 | case 'double': if (is_nan($dataType)) return '.nan'; |
||
2 ignored issues
–
show
|
|||
60 | default: |
||
1 ignored issue
–
show
|
|||
61 | return $dataType; |
||
62 | } |
||
63 | } elseif (is_object($dataType)) { |
||
64 | self::dumpObject($dataType, $indent); |
||
65 | } elseif (is_array($dataType)) { |
||
66 | self::dumpSequence($dataType, $indent); |
||
67 | } |
||
141 |