DriverFactoryPass   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 5
c 2
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
    public const CONFIGURATOR_TAG_NAME = 'bdf_queue.driver_configurator';
16
17
    /**
18
     * {@inheritdoc}
19
     */
20 9
    public function process(ContainerBuilder $container)
21
    {
22 9
        $factory = $container->getDefinition(ConnectionDriverFactory::class);
23
24 9
        foreach ($container->findTaggedServiceIds(self::CONFIGURATOR_TAG_NAME) as $serviceId => $tag) {
25 9
            $factory->addMethodCall('registerConfigurator', [new Reference($serviceId)]);
26
        }
27
    }
28
}
29