Conditions | 3 |
Paths | 3 |
Total Lines | 20 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 14 |
CRAP Score | 3.0026 |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
12 | 16 | public function __invoke(ContainerConfig $dependencies): ContainerConfig |
|
13 | { |
||
14 | 16 | foreach ($dependencies->get('delegators') as $service => $delegatorNames) { |
|
15 | 2 | $factory = $this->delegateFactories($dependencies, $service); |
|
16 | 2 | if (!is_callable($factory)) { |
|
17 | continue; |
||
18 | } |
||
19 | 2 | $dependencies->set(ContainerDelegatorFactory::class, static function () use ($delegatorNames, $factory) { |
|
20 | 1 | return new ContainerDelegatorFactory($delegatorNames, $factory); |
|
|
|||
21 | 2 | }); |
|
22 | 2 | $dependencies->set( |
|
23 | 2 | $service, |
|
24 | 2 | static function (ContainerInterface $container) use ($service) { |
|
25 | 1 | $callable = $container->get(ContainerDelegatorFactory::class); |
|
26 | 1 | return $callable($container, $service); |
|
27 | 2 | } |
|
28 | ); |
||
29 | } |
||
30 | |||
31 | 16 | return $dependencies; |
|
32 | } |
||
50 |