DriverFactoryPass::process()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 2
eloc 3
c 2
b 0
f 0
nc 2
nop 1
dl 0
loc 6
ccs 4
cts 4
cp 1
crap 2
rs 10
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