Conditions | 5 |
Paths | 6 |
Total Lines | 21 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 30 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
21 | public function process(ContainerBuilder $container) |
||
22 | { |
||
23 | if (!$container->has('domain_event.locator.voter')) { |
||
24 | return; |
||
25 | } |
||
26 | |||
27 | $current_locator = $container->findDefinition('domain_event.locator'); |
||
28 | $voter_locator = $container->findDefinition('domain_event.locator.voter'); |
||
29 | |||
30 | // register services only if current locator is voter locator |
||
31 | if ($voter_locator === $current_locator) { |
||
32 | foreach ($container->findTaggedServiceIds('domain_event.listener') as $id => $attributes) { |
||
33 | $voter_locator->addMethodCall('register', [new Reference($id)]); |
||
34 | } |
||
35 | } |
||
36 | |||
37 | // BC: get services from old tag |
||
38 | foreach ($container->findTaggedServiceIds('domain_event.voter_listener') as $id => $attributes) { |
||
39 | $voter_locator->addMethodCall('register', [new Reference($id)]); |
||
40 | } |
||
41 | } |
||
42 | } |
||
43 |