Conditions | 3 |
Paths | 3 |
Total Lines | 11 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 3 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
21 | 172 | public function setMapping(string $type, string $class): void |
|
22 | { |
||
23 | 172 | if (! class_exists($class)) { |
|
24 | 4 | throw new TypeMappingException(sprintf('Class %s not found.', $class)); |
|
25 | } |
||
26 | |||
27 | 168 | if (! is_subclass_of($class, ItemInterface::class)) { |
|
28 | 4 | throw new TypeMappingException(sprintf('Class %s must implement %s.', $class, ItemInterface::class)); |
|
29 | } |
||
30 | |||
31 | 164 | $this->typeMappings[$type] = $class; |
|
32 | 82 | } |
|
56 |