Passed
Push — master ( b0f8c9...462be0 )
by Sébastien
03:24
created

DriverFactoryPass   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 13
ccs 4
cts 4
cp 1
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 6 2
1
<?php
2
3
namespace Bdf\QueueBundle\DependencyInjection\Compiler;
4
5
use Bdf\QueueBundle\ConnectionFactory\ConnectionDriverFactory;
6
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
7
use Symfony\Component\DependencyInjection\ContainerBuilder;
8
use Symfony\Component\DependencyInjection\Reference;
9
10
/**
11
 * Register all the custom factory for connection
12
 */
13
final class DriverFactoryPass implements CompilerPassInterface
14
{
15
    const CONFIGURATOR_TAG_NAME = 'bdf_queue.driver_configurator';
16
17
    /**
18
     * {@inheritdoc}
19
     */
20 7
    public function process(ContainerBuilder $container)
21
    {
22 7
        $factory = $container->getDefinition(ConnectionDriverFactory::class);
23
24 7
        foreach ($container->findTaggedServiceIds(self::CONFIGURATOR_TAG_NAME) as $serviceId => $tag) {
25 7
            $factory->addMethodCall('registerConfigurator', [new Reference($serviceId)]);
26
        }
27 7
    }
28
}
29