TransformerCompilerPass   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 12
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 10 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Darkilliant\ImportBundle\DependencyInjection\CompilerPass;
6
7
use Darkilliant\ImportBundle\Registry\TransformerRegistry;
8
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
9
use Symfony\Component\DependencyInjection\ContainerBuilder;
10
use Symfony\Component\DependencyInjection\Reference;
11
12
/**
13
 * @internal
14
 */
15
class TransformerCompilerPass implements CompilerPassInterface
16
{
17 1
    public function process(ContainerBuilder $container)
18
    {
19 1
        $registryDefinition = $container->findDefinition(TransformerRegistry::class);
20 1
        $taggedServices = $container->findTaggedServiceIds('darkilliant_import_transformer');
21
22 1
        foreach ($taggedServices as $id => $tags) {
23 1
            foreach ($tags as $attributes) {
24 1
                $registryDefinition->addMethodCall('add', [
25 1
                    $attributes['alias'],
26 1
                    new Reference($id),
27
                ]);
28
            }
29
        }
30 1
    }
31
}
32