Conditions | 10 |
Paths | 4 |
Total Lines | 11 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
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 |
||
71 | protected function compileMatches($c, $a, $b, $i, $j, $comparator, &$matches) |
||
72 | { |
||
73 | if ($i > 0 && $j > 0 && $comparator($a[$i - 1], $b[$j - 1])) { |
||
74 | $this->compileMatches($c, $a, $b, $i - 1, $j - 1, $comparator, $matches); |
||
75 | $matches[$i] = $j; |
||
76 | } elseif ($j > 0 && ($i === 0 || $c[$i][$j - 1] >= $c[$i - 1][$j])) { |
||
77 | $this->compileMatches($c, $a, $b, $i, $j - 1, $comparator, $matches); |
||
78 | } elseif ($i > 0 && ($j === 0 || $c[$i][$j - 1] < $c[$i - 1][$j])) { |
||
79 | $this->compileMatches($c, $a, $b, $i - 1, $j, $comparator, $matches); |
||
80 | } |
||
81 | } |
||
82 | } |
||
83 |