Total Complexity | 3 |
Total Lines | 23 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
12 | final class UpperCaseMap implements CodeMap |
||
13 | { |
||
14 | /** |
||
15 | * @var Truncator Formatter for extracting the first character. |
||
16 | */ |
||
17 | private $charExtractor; |
||
18 | |||
19 | 3 | public function __construct() |
|
20 | { |
||
21 | 3 | $this->charExtractor = new Truncator(1); |
|
22 | 3 | $this->charExtractor->setNext(new LengthFilter(1, 1)); |
|
23 | 3 | } |
|
24 | |||
25 | /** |
||
26 | * {@inheritDoc} |
||
27 | */ |
||
28 | 3 | public function getMap(CharTree $charTree): array |
|
29 | { |
||
30 | 3 | $codeMap = []; |
|
31 | 3 | foreach ($this->charExtractor->apply($charTree) as $char) { |
|
32 | 1 | $codeMap[$char] = [mb_strtoupper($char)]; |
|
33 | } |
||
34 | 3 | return $codeMap; |
|
35 | } |
||
44 |