Passed
Push — master ( f281f2...2c849f )
by emilien
02:04
created

CallbackServiceCompilerPass   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 8 2
1
<?php
2
3
4
namespace Actiane\EntityChangeWatchBundle\DependencyInjection\Compiler;
5
6
use Actiane\EntityChangeWatchBundle\Generator\CallableGenerator;
7
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
8
use Symfony\Component\DependencyInjection\ContainerBuilder;
9
use Symfony\Component\DependencyInjection\Reference;
10
11
/**
12
 * Class CallbackServiceCompilerPass
13
 * @package Actiane\EntityChangeWatchBundle\DependencyInjection\Compiler
14
 */
15
class CallbackServiceCompilerPass implements CompilerPassInterface
16
{
17
    public function process(ContainerBuilder $container)
18
    {
19
        $definition = $container->findDefinition(CallableGenerator::class);
20
21
        $taggedServices = $container->findTaggedServiceIds('actiane.entitychangewatch.callback');
22
23
        foreach ($taggedServices as $id => $tags) {
24
            $definition->addMethodCall('addCallback', [$id, new Reference($id)]);
25
        }
26
    }
27
}
28