Conditions | 3 |
Paths | 3 |
Total Lines | 13 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
27 | public function __invoke(ContainerInterface $container, string $name, array $options = null): object |
||
28 | { |
||
29 | if (!class_exists($name, true)) { |
||
30 | throw new ServiceFactoryException( |
||
31 | sprintf( |
||
32 | 'Unable to create a new object from requested service \'%s\': ' |
||
33 | . 'The service name does not resolve to a valid class name', |
||
34 | $name |
||
35 | ) |
||
36 | ); |
||
37 | } |
||
38 | |||
39 | return (null === $options) ? new $name() : new $name(...$options); |
||
40 | } |
||
42 |