Conditions | 12 |
Paths | 7 |
Total Lines | 21 |
Code Lines | 12 |
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 |
||
37 | function suppressPhp85(int $version, string $filename, int $lineno): bool |
||
38 | { |
||
39 | if ($version >= 80500) { |
||
40 | if (str_ends_with($filename, 'jpgraph.php') && $lineno === 1408) { |
||
41 | return true; |
||
42 | } |
||
43 | if (str_ends_with($filename, 'jpgraph_legend.inc.php') && $lineno === 174) { |
||
44 | return true; |
||
45 | } |
||
46 | if (str_ends_with($filename, 'jpgraph_regstat.php') && in_array($lineno, [155, 185, 198, 202], true)) { |
||
47 | return true; |
||
48 | } |
||
49 | if (str_ends_with($filename, 'AttributeTranslator.php') && $lineno === 506) { |
||
50 | return true; |
||
51 | } |
||
52 | if (str_ends_with($filename, 'functions.php') && $lineno === 300) { |
||
53 | return true; |
||
54 | } |
||
55 | } |
||
56 | |||
57 | return false; |
||
58 | } |
||
63 |