Completed
Push — master ( 02c0b0...a6a077 )
by Joachim
13s queued 11s
created

RegisterRenderersPass   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 5
dl 0
loc 14
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 9 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Setono\TagBagBundle\DependencyInjection\Compiler;
6
7
use Setono\TagBagBundle\Renderer\CompositeRenderer;
8
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
9
use Symfony\Component\DependencyInjection\ContainerBuilder;
10
use Symfony\Component\DependencyInjection\Definition;
11
use Symfony\Component\DependencyInjection\Reference;
12
13
final class RegisterRenderersPass implements CompilerPassInterface
14
{
15
    /**
16
     * {@inheritdoc}
17
     */
18
    public function process(ContainerBuilder $container): void
19
    {
20
        $definition = new Definition(CompositeRenderer::class);
21
22
        foreach ($container->findTaggedServiceIds('setono_tag_bag.renderer') as $id => $attributes) {
23
            $definition->addArgument(new Reference($id));
24
        }
25
26
        $container->setDefinition('setono_tag_bag.renderer.composite', $definition);
27
    }
28
}
29