RegisterProvider::process()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 2.0078

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 11
ccs 7
cts 8
cp 0.875
rs 9.4286
cc 2
eloc 7
nc 2
nop 1
crap 2.0078
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