Conditions | 6 |
Paths | 13 |
Total Lines | 20 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 13 |
CRAP Score | 6 |
Changes | 0 |
1 | <?php |
||
26 | 3 | private function formatWord(string $word): Traversable |
|
27 | { |
||
28 | 3 | if ($word === '') { |
|
29 | 3 | yield ''; |
|
30 | 3 | return; |
|
31 | } |
||
32 | |||
33 | 3 | $char = mb_substr($word, 0, 1); |
|
34 | |||
35 | 3 | $chars = [$char]; |
|
36 | 3 | if ($char !== mb_strtolower($char)) { |
|
37 | 3 | $chars[] = mb_strtolower($char); |
|
38 | } |
||
39 | 3 | if ($char !== mb_strtoupper($char)) { |
|
40 | 3 | $chars[] = mb_strtoupper($char); |
|
41 | } |
||
42 | |||
43 | 3 | foreach ($this->formatWord(mb_substr($word, 1)) as $suffix) { |
|
44 | 3 | foreach ($chars as $formattedChar) { |
|
45 | 3 | yield $formattedChar.$suffix; |
|
46 | } |
||
50 |