NightlyTaskCompilerPass   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 3
dl 0
loc 19
ccs 0
cts 11
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 11 2
1
<?php
2
3
namespace Dekalee\NightlyTaskBundle\DependencyInjection\Compiler;
4
5
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
6
use Symfony\Component\DependencyInjection\ContainerBuilder;
7
use Symfony\Component\DependencyInjection\Reference;
8
9
/**
10
 * Class NightlyTaskCompilerPass
11
 */
12
class NightlyTaskCompilerPass implements CompilerPassInterface
13
{
14
    /**
15
     * You can modify the container here before it is dumped to PHP code.
16
     *
17
     * @param ContainerBuilder $container
18
     */
19
    public function process(ContainerBuilder $container)
20
    {
21
        $manager = $container->getDefinition('dekalee_nightly_task.bag.task');
22
        $strategies = $container->findTaggedServiceIds('dekalee_nightly.task.strategy');
23
        foreach ($strategies as $id => $strategy) {
24
            $strategy[0] = array_merge([
25
                'priority' => 0,
26
            ], $strategy[0]);
27
            $manager->addMethodCall('addTask', [new Reference($id), $strategy[0]['priority']]);
28
        }
29
    }
30
}
31