Total Complexity | 7 |
Total Lines | 43 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
11 | class TypeMapper implements TypeMapperInterface |
||
12 | { |
||
13 | /** |
||
14 | * @var array |
||
15 | */ |
||
16 | protected $typeMappings = []; |
||
17 | |||
18 | /** |
||
19 | * @throws \Swis\JsonApi\Client\Exceptions\TypeMappingException |
||
20 | */ |
||
21 | 172 | public function setMapping(string $type, string $class): void |
|
32 | 82 | } |
|
33 | |||
34 | 128 | public function hasMapping(string $type): bool |
|
35 | { |
||
36 | 128 | return array_key_exists($type, $this->typeMappings); |
|
37 | } |
||
38 | |||
39 | 4 | public function removeMapping(string $type): void |
|
40 | { |
||
41 | 4 | unset($this->typeMappings[$type]); |
|
42 | 2 | } |
|
43 | |||
44 | /** |
||
45 | * @throws \Swis\JsonApi\Client\Exceptions\TypeMappingException |
||
46 | */ |
||
47 | 96 | public function getMapping(string $type): ItemInterface |
|
54 | } |
||
55 | } |
||
56 |