| Conditions | 3 |
| Paths | 4 |
| Total Lines | 14 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 19 | public function getByClassName(string $className): PrintRequest\Parameter |
||
| 20 | { |
||
| 21 | try { |
||
| 22 | $reflection = new ReflectionClass($className); |
||
| 23 | $class = $reflection->newInstance( |
||
| 24 | $this->dependenciesFactory, |
||
| 25 | ); |
||
| 26 | } catch (ReflectionException $e) { |
||
| 27 | throw new DomainException($e->getMessage(), $e->getCode(), $e); |
||
| 28 | } |
||
| 29 | if (!is_a($class, PrintRequest\Parameter::class)) { |
||
| 30 | throw new DomainException(sprintf('The class *%s* is not subclass of Parameter', get_class($class))); |
||
| 31 | } |
||
| 32 | return $class; |
||
| 33 | } |
||
| 35 |