Completed
Pull Request — master (#9)
by Roman
03:37
created

StepsCompilerPass   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 10
c 0
b 0
f 0
wmc 4

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 7 4
1
<?php
2
3
4
namespace Kami\ApiCoreBundle\DependencyInjection\Compiler;
5
6
7
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
8
use Symfony\Component\DependencyInjection\ContainerBuilder;
9
use Symfony\Component\DependencyInjection\Reference;
10
11
class StepsCompilerPass implements CompilerPassInterface
12
{
13
    public function process(ContainerBuilder $container)
14
    {
15
        $tags = $container->findTaggedServiceIds('kami_api_core.strategy_step');
16
        if (count($tags) > 0 && $container->hasDefinition('kami.api_core.request_processor.default')) {
17
            $requestProcessor = $container->getDefinition('kami.api_core.request_processor.default');
18
            foreach ($tags as $id => $tag) {
19
                $requestProcessor->addMethodCall('addStep', array($tag[0]['shortcut'], new Reference($id)));
20
            }
21
        }
22
    }
23
24
}