DataSourceryBundleExtensionServicePass::process()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 12
Code Lines 6

Duplication

Lines 12
Ratio 100 %

Importance

Changes 0
Metric Value
dl 12
loc 12
c 0
b 0
f 0
rs 9.4285
cc 3
eloc 6
nc 3
nop 1
1
<?php
2
3
namespace Netdudes\DataSourceryBundle\DependencyInjection\Compiler;
4
5
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
6
use Symfony\Component\DependencyInjection\ContainerBuilder;
7
use Symfony\Component\DependencyInjection\Reference;
8
9 View Code Duplication
class DataSourceryBundleExtensionServicePass 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...
10
{
11
    /**
12
     * You can modify the container here before it is dumped to PHP code.
13
     *
14
     * @param ContainerBuilder $container
15
     *
16
     * @api
17
     */
18
    public function process(ContainerBuilder $container)
19
    {
20
        if (!$container->hasDefinition('netdudes_data_sourcery.uql_extension_container')) {
21
            return;
22
        }
23
24
        $extensionContainer = $container->getDefinition('netdudes_data_sourcery.uql_extension_container');
25
26
        foreach ($container->findTaggedServiceIds('netdudes_data_sourcery.extension') as $id => $attributes) {
27
            $extensionContainer->addMethodCall('addExtension', [new Reference($id)]);
28
        }
29
    }
30
}
31