AuthenticationAttributesProviderPass   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 3
dl 0
loc 22
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B process() 0 19 5
1
<?php
2
3
namespace Kuleuven\AuthenticationBundle\Compiler;
4
5
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
6
use Symfony\Component\DependencyInjection\ContainerBuilder;
7
use Symfony\Component\DependencyInjection\Reference;
8
9
class AuthenticationAttributesProviderPass implements CompilerPassInterface
10
{
11
    public function process(ContainerBuilder $container)
12
    {
13
        if (!$container->has('kuleuven_authentication.service.shibboleth_attributes_injector_manager')) {
14
            return;
15
        }
16
17
        $definition = $container->findDefinition('kuleuven_authentication.service.shibboleth_attributes_injector_manager');
18
19
        $taggedServices = $container->findTaggedServiceIds('kuleuven_authentication.shibboleth_attributes_injector');
20
21
        foreach ($taggedServices as $id => $tags) {
22
            foreach ($tags as $attributes) {
23
                $definition->addMethodCall('addProvider', [
24
                    new Reference($id),
25
                    isset($attributes['priority']) ? $attributes['priority'] : 0,
26
                ]);
27
            }
28
        }
29
    }
30
}
31