Completed
Push — master ( 0eab77...b2f729 )
by Paul
05:35
created

APIAuthenticationCompilerPass::process()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 18
Code Lines 10

Duplication

Lines 18
Ratio 100 %

Importance

Changes 0
Metric Value
dl 18
loc 18
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 10
nc 3
nop 1
1
<?php
2
3
namespace Victoire\Bundle\APIBusinessEntityBundle\DependencyInjection\Compiler;
4
5
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
6
use Symfony\Component\DependencyInjection\ContainerBuilder;
7
use Symfony\Component\DependencyInjection\Reference;
8
9
/**
10
 * Class APIAuthenticationCompilerPass.
11
 */
12 View Code Duplication
class APIAuthenticationCompilerPass 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...
13
{
14
    /**
15
     * {@inheritdoc}
16
     */
17
    public function process(ContainerBuilder $container)
18
    {
19
        $chainDefinition = $container->getDefinition(
20
            'victoire_api_business_entity.chain.api_authentication_chain'
21
        );
22
        $taggedServices = $container->findTaggedServiceIds(
23
            'victoire_api_business_entity.api_authentication'
24
        );
25
26
        foreach ($taggedServices as $id => $tagAttributes) {
27
            foreach ($tagAttributes as $attributes) {
28
                $chainDefinition->addMethodCall(
29
                    'addAuthenticationMethod',
30
                    [new Reference($id)]
31
                );
32
            }
33
        }
34
    }
35
}
36