| Total Complexity | 4 |
| Total Lines | 58 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 9 | class Maori implements CharacterMap |
||
| 10 | { |
||
| 11 | |||
| 12 | protected Collection $chars; |
||
| 13 | |||
| 14 | public array $mappedChars = [ |
||
| 15 | 'ā' => '1', |
||
| 16 | 'ē' => '2', |
||
| 17 | 'ī' => '3', |
||
| 18 | 'ō' => '4', |
||
| 19 | 'ū' => '5', |
||
| 20 | ]; |
||
| 21 | |||
| 22 | public function __construct() |
||
| 44 | ]); |
||
| 45 | } |
||
| 46 | |||
| 47 | |||
| 48 | public function getRandomChar() |
||
| 49 | { |
||
| 50 | |||
| 51 | return Str::upper($this->chars->random()); |
||
| 52 | } |
||
| 53 | |||
| 54 | |||
| 55 | public function mapChars($word) |
||
| 56 | { |
||
| 57 | return Str::replace(array_keys($this->mappedChars), $this->mappedChars, Str::lower($word)); |
||
| 58 | } |
||
| 59 | |||
| 60 | public function unmapChars($word) |
||
| 67 | } |
||
| 68 | } |
||
| 69 |