CallbackServiceCompilerPass::process()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 12
rs 10
cc 2
nc 2
nop 1
1
<?php declare(strict_types = 1);
2
3
namespace Actiane\EntityChangeWatchBundle\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 CallbackServiceCompilerPass
11
 */
12
class CallbackServiceCompilerPass implements CompilerPassInterface
13
{
14
    /**
15
     * @param ContainerBuilder $container
16
     */
17
    public function process(ContainerBuilder $container)
18
    {
19
        $definition = $container->findDefinition('actiane.entitywatch.callback_locator');
20
21
        $taggedServices = $container->findTaggedServiceIds('actiane.entitychangewatch.callback');
22
23
        $callbacks = [];
24
        foreach ($taggedServices as $id => $tags) {
25
            $callbacks[$id] = new Reference($id);
26
        }
27
28
        $definition->addArgument($callbacks);
29
    }
30
}
31