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

RegisterRenderersPass::process()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 9
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
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