Failed Conditions
Pull Request — 0.3 (#20)
by jean
06:00
created

ProcessNotifierCompilerPass::process()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 1
dl 0
loc 8
ccs 0
cts 7
cp 0
crap 6
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Darkilliant\ProcessBundle\DependencyInjection\CompilerPass;
6
7
use Darkilliant\ProcessBundle\ProcessNotifier\ChainProcessNotifier;
8
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
9
use Symfony\Component\DependencyInjection\ContainerBuilder;
10
use Symfony\Component\DependencyInjection\Reference;
11
12
class ProcessNotifierCompilerPass implements CompilerPassInterface
13
{
14
    public function process(ContainerBuilder $container)
15
    {
16
        $registryDefinition = $container->findDefinition(ChainProcessNotifier::class);
17
        $taggedServices = $container->findTaggedServiceIds('darkilliant_process_notifier');
18
19
        foreach ($taggedServices as $id => $tags) {
20
            $registryDefinition->addMethodCall('add', [
21
                new Reference($id),
22
            ]);
23
        }
24
    }
25
}
26