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