RegisterProvider   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 87.5%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
c 1
b 0
f 1
lcom 0
cbo 3
dl 0
loc 18
ccs 7
cts 8
cp 0.875
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 11 2
1
<?php
2
3
namespace BrainExe\Expression\CompilerPass;
4
5
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
6
use Symfony\Component\DependencyInjection\ContainerBuilder;
7
use Symfony\Component\DependencyInjection\Reference;
8
use BrainExe\Core\Annotations\CompilerPass as CompilerPassAnnotation;
9
10
/**
11
 * @CompilerPassAnnotation
12
 */
13
class RegisterProvider implements CompilerPassInterface
14
{
15
16
    /**
17
     * {@inheritdoc}
18
     */
19 1
    public function process(ContainerBuilder $container)
20
    {
21 1
        $dispatcher = $container->getDefinition('EventDispatcher');
22 1
        $dispatcher->addMethodCall('addCatchall', [new Reference('Expression.Listener')]);
23
24 1
        $language   = $container->getDefinition('Expression.Language');
25 1
        $serviceIds = $container->findTaggedServiceIds('expression_language');
26 1
        foreach (array_keys($serviceIds) as $serviceId) {
27
            $language->addMethodCall('registerProvider', [new Reference($serviceId)]);
28
        }
29 1
    }
30
}
31