Conditions | 3 |
Paths | 2 |
Total Lines | 13 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 3.0175 |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
34 | 2 | private function delegateFactories( |
|
35 | ContainerConfig $dependencies, |
||
36 | string $service |
||
37 | ): ?callable { |
||
38 | 2 | if (false === $dependencies->has($service)) { |
|
39 | return null; |
||
40 | } |
||
41 | // Marshal from factory |
||
42 | 2 | $serviceFactory = $dependencies->get($service); |
|
43 | 2 | return static function (ContainerInterface $container) use ($service, $serviceFactory) { |
|
44 | 1 | return is_callable($serviceFactory) |
|
45 | 1 | ? $serviceFactory($container, $service) |
|
46 | 1 | : (new $serviceFactory())($container, $service); |
|
47 | 2 | }; |
|
50 |