Passed
Pull Request — 0.3 (#20)
by jean
03:19
created

ProcessNotifierCompilerPass   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 10
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 8 2
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 1
    public function process(ContainerBuilder $container)
15
    {
16 1
        $registryDefinition = $container->findDefinition(ChainProcessNotifier::class);
17 1
        $taggedServices = $container->findTaggedServiceIds('darkilliant_process_notifier');
18
19 1
        foreach ($taggedServices as $id => $tags) {
20 1
            $registryDefinition->addMethodCall('add', [
21 1
                new Reference($id),
22
            ]);
23
        }
24 1
    }
25
}
26