Completed
Push — master ( caead5...f1379b )
by Peter
06:59
created

VoterListenerPass   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 3
dl 0
loc 17
ccs 0
cts 10
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 11 3
1
<?php
2
/**
3
 * GpsLab component.
4
 *
5
 * @author    Peter Gribanov <[email protected]>
6
 * @copyright Copyright (c) 2016, Peter Gribanov
7
 * @license   http://opensource.org/licenses/MIT
8
 */
9
namespace GpsLab\Bundle\DomainEvent\DependencyInjection\Compiler;
10
11
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
12
use Symfony\Component\DependencyInjection\ContainerBuilder;
13
use Symfony\Component\DependencyInjection\Reference;
14
15
class VoterListenerPass implements CompilerPassInterface
16
{
17
    /**
18
     * @param ContainerBuilder $container
19
     */
20
    public function process(ContainerBuilder $container)
21
    {
22
        if (!$container->has('domain_event.locator.voter')) {
23
            return;
24
        }
25
26
        $definition = $container->findDefinition('domain_event.locator.voter');
27
        foreach ($container->findTaggedServiceIds('domain_event.voter_listener') as  $id => $attributes) {
28
            $definition->addMethodCall('register', [new Reference($id)]);
29
        }
30
    }
31
}
32