RegisterEventHandlersPass   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 11
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 9 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Setono\SyliusPaginationPlugin\DependencyInjection\Compiler;
6
7
use Setono\SyliusPaginationPlugin\EventHandler\CompositeEventHandler;
8
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
9
use Symfony\Component\DependencyInjection\ContainerBuilder;
10
use Symfony\Component\DependencyInjection\Definition;
11
use Symfony\Component\DependencyInjection\Reference;
12
13
final class RegisterEventHandlersPass implements CompilerPassInterface
14
{
15
    public function process(ContainerBuilder $container): void
16
    {
17
        $compositeEventHandler = new Definition(CompositeEventHandler::class);
18
19
        foreach ($container->findTaggedServiceIds('setono_sylius_pagination.event_handler') as $id => $attributes) {
20
            $compositeEventHandler->addArgument(new Reference($id));
21
        }
22
23
        $container->setDefinition('setono_sylius_pagination.event_handler.composite', $compositeEventHandler);
24
    }
25
}
26