DictionaryFactoryBuildingPass   A
last analyzed

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 6
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
declare(strict_types=1);
4
5
namespace Knp\DictionaryBundle\DependencyInjection\Compiler;
6
7
use Knp\DictionaryBundle\Dictionary\Factory\Aggregate;
8
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
9
use Symfony\Component\DependencyInjection\ContainerBuilder;
10
use Symfony\Component\DependencyInjection\Reference;
11
12
final class DictionaryFactoryBuildingPass implements CompilerPassInterface
13
{
14
    /**
15
     * @var string
16
     */
17
    public const TAG_FACTORY = 'knp_dictionary.factory';
18
19 1
    public function process(ContainerBuilder $containerBuilder): void
20
    {
21 1
        foreach (array_keys($containerBuilder->findTaggedServiceIds(self::TAG_FACTORY)) as $id) {
22
            $containerBuilder
23 1
                ->findDefinition(Aggregate::class)
24 1
                ->addMethodCall('addFactory', [new Reference($id)])
25
            ;
26
        }
27 1
    }
28
}
29