| Conditions | 3 |
| Paths | 3 |
| Total Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 3.1406 |
| Changes | 0 | ||
| 1 | <?php |
||
| 19 | 4 | public function resolve(DefinitionInterface $definition) |
|
| 20 | { |
||
| 21 | 4 | $class = $definition->getValue(); |
|
| 22 | |||
| 23 | 4 | if (!is_string($class)) { |
|
| 24 | throw new InvalidArgumentException('Value of $definition->getValue() must be string'); |
||
| 25 | } |
||
| 26 | |||
| 27 | 4 | if (!class_exists($class)) { |
|
| 28 | NotFoundException::create($class); |
||
| 29 | } |
||
| 30 | |||
| 31 | 4 | $params = $this->getConstructorParams($class); |
|
| 32 | |||
| 33 | 4 | return new $class(...$params); |
|
| 34 | } |
||
| 35 | } |
||
| 36 |