Completed
Push — master ( 404636...fb0f06 )
by Nikola
05:15
created

SourcesCompilerPass::process()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 11
Code Lines 5

Duplication

Lines 11
Ratio 100 %

Code Coverage

Tests 6
CRAP Score 3

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 11
loc 11
ccs 6
cts 6
cp 1
rs 9.4285
cc 3
eloc 5
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\Exception\ServiceNotFoundException;
15
use Symfony\Component\DependencyInjection\Reference;
16
17
/**
18
 * Class SourcesCompilerPass
19
 *
20
 * Compiler pass for sources
21
 *
22
 * @package RunOpenCode\Bundle\ExchangeRate\DependencyInjection\CompilerPass
23
 */
24 View Code Duplication
class SourcesCompilerPass 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...
25
{
26
    /**
27
     * {@inheritdoc}
28
     */
29 2
    public function process(ContainerBuilder $container)
30
    {
31 2
        if ($container->hasDefinition('runopencode.exchange_rate.registry.sources')) {
32
33 1
            $definition = $container->getDefinition('runopencode.exchange_rate.registry.sources');
34
35 1
            foreach ($container->findTaggedServiceIds('runopencode.exchange_rate.source') as $id => $tags) {
36 1
                $definition->addMethodCall('add', [new Reference($id)]);
37
            }
38
        }
39 2
    }
40
}
41