Total Complexity | 5 |
Total Lines | 29 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7 | class EncoderCollection |
||
8 | { |
||
9 | /** @var BinnValueEncoder[] */ |
||
10 | private $encoders = []; |
||
11 | |||
12 | /** @var array */ |
||
13 | private $mapper = []; |
||
14 | |||
15 | public function getAll(): array |
||
16 | { |
||
17 | return $this->encoders; |
||
18 | } |
||
19 | |||
20 | public function findByType(int $type): ?BinnValueEncoder |
||
21 | { |
||
22 | if (array_key_exists($type, $this->mapper)) { |
||
23 | return $this->mapper[$type]; |
||
24 | } |
||
25 | |||
26 | return null; |
||
27 | } |
||
28 | |||
29 | public function add(int $type, BinnValueEncoder $encoder): void |
||
36 | } |
||
37 | } |
||
38 |