| Conditions | 23 |
| Paths | 6144 |
| Total Lines | 3 |
| Code Lines | 2 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 2 |
| CRAP Score | 23 |
| 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 |
||
| 8 | 718 | final public function getPlural($n = 1) { |
|
| 9 | 718 | return $n % 10 == 1 && $n % 100 != 11 && $n % 100 != 71 && $n % 100 != 91 ? 0 : ($n % 10 == 2 && $n % 100 != 12 && $n % 100 != 72 && $n % 100 != 92 ? 1 : (($n % 10 == 3 || $n % 10 == 4 || $n % 10 == 9) && $n % 100 != 13 && $n % 100 != 14 && $n % 100 != 19 && $n % 100 != 73 && $n % 100 != 74 && $n % 100 != 79 && $n % 100 != 93 && $n % 100 != 94 && $n % 100 != 99 ? 2 : ($n % 1000000 == 0 && $n != 0 ? 3 : 4))); |
|
| 10 | } |
||
| 11 | |||
| 20 |