ExecutorCompilerPass   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 91.67%

Importance

Changes 2
Bugs 1 Features 1
Metric Value
wmc 3
c 2
b 1
f 1
lcom 0
cbo 3
dl 0
loc 33
ccs 11
cts 12
cp 0.9167
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 23 3
1
<?php
2
3
namespace Velikonja\LabbyBundle\DependencyInjection\Compiler;
4
5
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
6
use Symfony\Component\DependencyInjection\ContainerBuilder;
7
use Symfony\Component\DependencyInjection\Reference;
8
9
class ExecutorCompilerPass implements CompilerPassInterface
10
{
11
    /**
12
     * You can modify the container here before it is dumped to PHP code.
13
     *
14
     * @param ContainerBuilder $container
15
     *
16
     * @api
17
     */
18 2
    public function process(ContainerBuilder $container)
19
    {
20 2
        if (! $container->hasDefinition('velikonja_labby.executor.executor_runner')) {
21
            return;
22
        }
23
24 2
        $definition = $container->getDefinition(
25 2
            'velikonja_labby.executor.executor_runner'
26
        );
27
28 2
        $taggedServices = $container->findTaggedServiceIds(
29 2
            'velikonja_labby.executor'
30
        );
31
32 2
        foreach ($taggedServices as $id => $tags) {
33 2
            $definition->addMethodCall(
34 2
                'addExecutor',
35
                array(
36 2
                    new Reference($id)
37
                )
38
            );
39
        }
40 2
    }
41
}
42