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

RatesConfigurationRegistryCompilerPass::process()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 15
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 3

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 15
ccs 7
cts 7
cp 1
rs 9.4285
cc 3
eloc 7
nc 3
nop 1
crap 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