Completed
Pull Request — master (#90)
by Arnaud
02:31
created

ResponderCompilerPass::process()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 15
Code Lines 9

Duplication

Lines 15
Ratio 100 %

Importance

Changes 0
Metric Value
dl 15
loc 15
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 9
nc 3
nop 1
1
<?php
2
3
namespace LAG\AdminBundle\DependencyInjection\CompilerPass;
4
5
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
6
use Symfony\Component\DependencyInjection\ContainerBuilder;
7
use Symfony\Component\DependencyInjection\Reference;
8
9 View Code Duplication
class ResponderCompilerPass implements CompilerPassInterface
10
{
11
    public function process(ContainerBuilder $container)
12
    {
13
        if (!$container->has('lag.admin.responder.storage')) {
14
            return;
15
        }
16
        $storage = $container->getDefinition('lag.admin.responder.storage');
17
        $responderIds = $container->findTaggedServiceIds('responder');
18
    
19
        foreach ($responderIds as $responderId => $attributes) {
20
            $storage->addMethodCall('add', [
21
                $responderId,
22
                new Reference($responderId),
23
            ]);
24
        }
25
    }
26
}
27