| Conditions | 5 |
| Paths | 7 |
| Total Lines | 24 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 14 |
| CRAP Score | 5 |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | 4 | public function process(ContainerBuilder $container) |
|
| 16 | { |
||
| 17 | 4 | if (!$container->hasDefinition('tree_house.queue.event_listener.flush')) { |
|
| 18 | 1 | return; |
|
| 19 | } |
||
| 20 | |||
| 21 | 3 | $listener = $container->getDefinition('tree_house.queue.event_listener.flush'); |
|
| 22 | |||
| 23 | 3 | foreach (['doctrine', 'doctrine_mongodb'] as $id) { |
|
| 24 | 3 | if ($container->hasDefinition($id)) { |
|
| 25 | 2 | $flusherId = sprintf('tree_house.queue.flusher.%s', $id); |
|
| 26 | |||
| 27 | 2 | $definition = new DefinitionDecorator('tree_house.queue.flusher.doctrine_abstract'); |
|
| 28 | 2 | $definition->addArgument(new Reference($id)); |
|
| 29 | 2 | $container->setDefinition($flusherId, $definition); |
|
| 30 | |||
| 31 | 3 | $listener->addMethodCall('addFlusher', [new Reference($flusherId)]); |
|
| 32 | } |
||
| 33 | } |
||
| 34 | |||
| 35 | 3 | foreach ($container->findTaggedServiceIds('tree_house.queue.flusher') as $id => list($tag)) { |
|
| 36 | 1 | $listener->addMethodCall('addFlusher', [new Reference($id)]); |
|
| 37 | } |
||
| 38 | 3 | } |
|
| 39 | } |
||
| 40 |