Completed
Pull Request — master (#1015)
by Kévin
09:16 queued 06:42
created

ConfigSourcePass::process()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 13
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 3.0123
Metric Value
dl 0
loc 13
ccs 8
cts 9
cp 0.8889
rs 9.4285
cc 3
eloc 7
nc 3
nop 1
crap 3.0123
1
<?php
2
3
/**
4
 * This file is part of the FOSElasticaBundle project.
5
 *
6
 * (c) Tim Nagel <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace FOS\ElasticaBundle\DependencyInjection\Compiler;
13
14
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
15
use Symfony\Component\DependencyInjection\ContainerBuilder;
16
use Symfony\Component\DependencyInjection\Reference;
17
18
class ConfigSourcePass implements CompilerPassInterface
19
{
20
    /**
21
     * {@inheritDoc}
22
     */
23 11
    public function process(ContainerBuilder $container)
24
    {
25 11
        if (!$container->hasDefinition('fos_elastica.config_manager')) {
26
            return;
27
        }
28
29 11
        $sources = array();
30 11
        foreach (array_keys($container->findTaggedServiceIds('fos_elastica.config_source')) as $id) {
31 11
            $sources[] = new Reference($id);
32 11
        }
33
34 11
        $container->getDefinition('fos_elastica.config_manager')->replaceArgument(0, $sources);
35 11
    }
36
}
37