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