RatesConfigurationRegistryCompilerPass::process()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 15
Code Lines 7

Duplication

Lines 15
Ratio 100 %

Code Coverage

Tests 7
CRAP Score 3

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 15
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 View Code Duplication
class RatesConfigurationRegistryCompilerPass implements CompilerPassInterface
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
22
{
23
    /**
24
     * {@inheritdoc}
25
     */
26 2
    public function process(ContainerBuilder $container)
27
    {
28
29 2
        if (!$container->hasDefinition('runopencode.exchange_rate.registry.rates')) {
30 1
            return;
31
        }
32
33 1
        $registry = $container->findDefinition('runopencode.exchange_rate.registry.rates');
34
35 1
        foreach (array_keys($container->findTaggedServiceIds('runopencode.exchange_rate.rate_configuration')) as $id) {
36
37
            $registry
38 1
                ->addMethodCall('add', [new Reference($id)]);
39
        }
40 1
    }
41
}
42