TransformerCompilerPass::process()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 3

Importance

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