| Conditions | 8 |
| Paths | 10 |
| Total Lines | 26 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 13 |
| CRAP Score | 8.4218 |
| 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 | |||
| 41 | 2 | foreach ($container->findTaggedServiceIds('domain_event.subscriber') as $id => $attributes) { |
|
| 42 | $subscriber = $container->findDefinition($id); |
||
| 43 | $current_locator->addMethodCall('registerSubscriberService', [$id, $subscriber->getClass()]); |
||
| 44 | } |
||
| 45 | } |
||
| 46 | } |
||
| 47 |