Conditions | 10 |
Paths | 10 |
Total Lines | 15 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 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 |
||
27 | private static function getTypeFromNativeType(string $type): string { |
||
28 | switch ($type) { |
||
29 | case 'NEWDECIMAL': |
||
30 | case 'DECIMAL': |
||
31 | case 'FLOAT': |
||
32 | case 'DOUBLE': |
||
33 | return 'f'; |
||
34 | case 'TINY': |
||
35 | case 'SHORT': |
||
36 | case 'LONG': |
||
37 | case 'LONGLONG': |
||
38 | case 'INT24': |
||
39 | return 'i'; |
||
40 | } |
||
41 | return $type; |
||
42 | } |
||
44 |