CallbackServiceCompilerPass   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 7
c 1
b 0
f 0
dl 0
loc 17
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 12 2
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