PopulateDebugCommandPass::process()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 13
rs 9.8333
c 0
b 0
f 0
cc 2
nc 2
nop 1
1
<?php
2
3
namespace BornFree\TacticianDomainEventBundle\DependencyInjection\Compiler;
4
5
use BornFree\TacticianDomainEvent\EventDispatcher\EventSubscriberInterface;
6
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
7
use Symfony\Component\DependencyInjection\ContainerBuilder;
8
9
class PopulateDebugCommandPass implements CompilerPassInterface
10
{
11
    public function process(ContainerBuilder $container)
12
    {
13
        if (!$container->hasDefinition('tactician_domain_events.command.debug')) {
14
            return;
15
        }
16
17
        $command = $container->getDefinition('tactician_domain_events.command.debug');
18
        $subscribers = $container->findTaggedServiceIds('tactician.event_subscriber');
19
        $listeners = $container->findTaggedServiceIds('tactician.event_listener');
20
21
        $command->setArgument(1, $listeners);
22
        $command->setArgument(2, $subscribers);
23
    }
24
}
25