Conditions | 7 |
Paths | 6 |
Total Lines | 21 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 13 |
CRAP Score | 7 |
Changes | 0 |
1 | <?php |
||
20 | 4 | public function process(ContainerBuilder $container) |
|
21 | { |
||
22 | 4 | if (!$container->has('domain_event.locator')) { |
|
23 | 1 | return; |
|
24 | } |
||
25 | |||
26 | 3 | $current_locator = $container->findDefinition('domain_event.locator'); |
|
27 | 3 | $symfony_locator = $container->findDefinition('domain_event.locator.symfony'); |
|
28 | 3 | $container_locator = $container->findDefinition('domain_event.locator.container'); |
|
29 | |||
30 | 3 | if ($current_locator != $symfony_locator && $current_locator != $container_locator) { |
|
31 | 1 | return; |
|
32 | } |
||
33 | |||
34 | 2 | foreach ($container->findTaggedServiceIds('domain_event.listener') as $id => $attributes) { |
|
35 | 2 | foreach ($attributes as $attribute) { |
|
36 | 2 | $method = !empty($attribute['method']) ? $attribute['method'] : '__invoke'; |
|
37 | 2 | $current_locator->addMethodCall('registerService', [$attribute['event'], $id, $method]); |
|
38 | } |
||
39 | } |
||
40 | 2 | } |
|
41 | } |
||
42 |