Completed
Push — 0.3.x ( 921e84...1e8c09 )
by Dmitry
14:16
created

ServiceProvidersPass   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 3
c 1
b 0
f 1
lcom 0
cbo 2
dl 0
loc 23
ccs 12
cts 12
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 17 3
1
<?php
2
3
namespace Krtv\Bundle\SingleSignOnIdentityProviderBundle\DependencyInjection\Compiler;
4
5
use Symfony\Component\DependencyInjection\ContainerBuilder;
6
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
7
8
/**
9
 * Class ServiceProvidersPass
10
 * @package Krtv\Bundle\SingleSignOnIdentityProviderBundle\DependencyInjection\Compiler
11
 */
12
class ServiceProvidersPass implements CompilerPassInterface
13
{
14
    /**
15
     * {@inheritDoc}
16
     */
17 1
    public function process(ContainerBuilder $container)
18
    {
19 1
        $services = array();
20
21 1
        $activeServices = $container->getParameter('krtv_single_sign_on_identity_provider.services');
22
23 1
        foreach ($container->findTaggedServiceIds('sso.service_provider') as $id => $attributes) {
24 1
            $name = $attributes[0]['service'];
25
26 1
            if (in_array($name, $activeServices)) {
27 1
                $services[$name] = $container->getDefinition($id);
28 1
            }
29 1
        }
30
31 1
        $container->getDefinition('krtv_single_sign_on_identity_provider.manager.service_manager')
32 1
            ->replaceArgument(3, $services);
33 1
    }
34
}
35