Completed
Pull Request — master (#1411)
by Floran
09:07
created

ConfigSourcePass   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 87.5%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 3
dl 0
loc 19
ccs 7
cts 8
cp 0.875
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 13 3
1
<?php
2
3
/*
4
 * This file is part of the FOSElasticaBundle package.
5
 *
6
 * (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
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 8
    public function process(ContainerBuilder $container)
24
    {
25 8
        if (!$container->hasDefinition('fos_elastica.config_manager')) {
26
            return;
27
        }
28
29 8
        $sources = [];
30 8
        foreach (array_keys($container->findTaggedServiceIds('fos_elastica.config_source')) as $id) {
31 8
            $sources[] = new Reference($id);
32
        }
33
34 8
        $container->getDefinition('fos_elastica.config_manager')->replaceArgument(0, $sources);
35 8
    }
36
}
37