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