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

CallbackServiceCompilerPass::process()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 1
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