Completed
Push — master ( 4bd62c...3a81a8 )
by Nikola
04:28
created

RatesConfigurationRegistryCompilerPass   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 15 3
1
<?php
2
/*
3
 * This file is part of the Exchange Rate Bundle, an RunOpenCode project.
4
 *
5
 * (c) 2017 RunOpenCode
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
namespace RunOpenCode\Bundle\ExchangeRate\DependencyInjection\CompilerPass;
11
12
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
13
use Symfony\Component\DependencyInjection\ContainerBuilder;
14
use Symfony\Component\DependencyInjection\Reference;
15
16
/**
17
 * Class RatesConfigurationRegistryCompilerPass
18
 *
19
 * @package RunOpenCode\Bundle\ExchangeRate\DependencyInjection\CompilerPass
20
 */
21
class RatesConfigurationRegistryCompilerPass implements CompilerPassInterface
22
{
23
    /**
24
     * {@inheritdoc}
25
     */
26 3
    public function process(ContainerBuilder $container)
27
    {
28
29 3
        if (!$container->hasDefinition('runopencode.exchange_rate.registry.rates')) {
30 1
            return;
31
        }
32
33 2
        $registry = $container->findDefinition('runopencode.exchange_rate.registry.rates');
34
35 2
        foreach (array_keys($container->findTaggedServiceIds('runopencode.exchange_rate.rate_configuration')) as $id) {
36
37
            $registry
38 2
                ->addMethodCall('add', [new Reference($id)]);
39
        }
40 2
    }
41
}
42