EventCompilerPass   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 3
dl 0
loc 15
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 9 2
1
<?php
2
3
namespace SfCod\SocketIoBundle\DependencyInjection\Compiler;
4
5
use SfCod\SocketIoBundle\Service\EventManager;
6
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
7
use Symfony\Component\DependencyInjection\ContainerBuilder;
8
use Symfony\Component\DependencyInjection\Reference;
9
10
/**
11
 * Class EventCompilerPass.
12
 */
13
class EventCompilerPass implements CompilerPassInterface
14
{
15
    /**
16
     * Find all job handlers and mark them as public in case to work properly with job queue.
17
     */
18
    public function process(ContainerBuilder $container)
19
    {
20
        $eventManager = $container->getDefinition(EventManager::class);
21
        $taggedServices = $container->findTaggedServiceIds('sfcod.socketio.event');
22
23
        foreach ($taggedServices as $id => $tags) {
24
            $eventManager->addMethodCall('addEvent', [new Reference($id)]);
25
        }
26
    }
27
}
28