Conditions | 3 |
Paths | 2 |
Total Lines | 13 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
18 | 4 | protected function runPass(array $strings) |
|
19 | { |
||
20 | 4 | $singles = $this->getSingleCharStrings($strings); |
|
21 | 4 | $cnt = count($singles); |
|
22 | 4 | if ($cnt > 1 && $cnt < count($strings)) |
|
23 | { |
||
24 | // Remove the singles from the input, then prepend them as a new string |
||
25 | 1 | $strings = array_diff_key($strings, $singles); |
|
26 | 1 | array_unshift($strings, [array_values($singles)]); |
|
27 | } |
||
28 | |||
29 | 4 | return $strings; |
|
30 | } |
||
31 | |||
51 | } |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.