Completed
Pull Request — master (#81)
by
unknown
28:56
created

ExpressionLanguageCompilerPass::process()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 15
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 15
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 9
nc 3
nop 1
1
<?php
2
/**
3
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
4
 * @license For full copyright and license information view LICENSE file distributed with this source code.
5
 */
6
namespace Kaliop\eZMigrationBundle\DependencyInjection\CompilerPass;
7
8
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
9
use Symfony\Component\DependencyInjection\ContainerBuilder;
10
use Symfony\Component\DependencyInjection\Reference;
11
12
class ExpressionLanguageCompilerPass implements CompilerPassInterface
13
{
14
    public function process(ContainerBuilder $container)
15
    {
16
        if (!$container->hasDefinition('ez_migration_bundle.expression_language')) {
17
            return;
18
        }
19
20
        $providers = [];
21
        foreach ($container->findTaggedServiceIds('ez_migration_bundle.expression_language.function_provider') as $serviceId => $tags) {
22
            $providers[] = new Reference($serviceId);
23
        }
24
25
        $container
26
            ->getDefinition('ez_migration_bundle.expression_language')
27
            ->setArguments([null, $providers]);
28
    }
29
}
30