RegisterClientsPass   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Dependencies 3

Test Coverage

Coverage 100%
Metric Value
wmc 2
cbo 3
dl 0
loc 18
ccs 8
cts 8
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 12 2
1
<?php
2
3
/*
4
 * This file is part of the xAPI package.
5
 *
6
 * (c) Christian Flothmann <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Xabbuh\XApi\Bundle\ClientBundle\DependencyInjection\Compiler;
13
14
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
15
use Symfony\Component\DependencyInjection\ContainerBuilder;
16
use Symfony\Component\DependencyInjection\Reference;
17
18
/**
19
 * Compiler pass adding all configured xAPI clients to the xAPI client manager.
20
 *
21
 * @author Christian Flothmann <[email protected]>
22
 */
23
class RegisterClientsPass implements CompilerPassInterface
24
{
25
    /**
26
     * {@inheritDoc}
27
     */
28 3
    public function process(ContainerBuilder $container)
29
    {
30 3
        $definition = $container->getDefinition('xabbuh_xapi_client.client_manager');
31
32 3
        $clients = array();
33
34 3
        foreach ($container->getParameter('xabbuh_xapi_client.clients') as $name => $id) {
35 2
            $clients[$name] = new Reference($id);
36 3
        }
37
38 3
        $definition->setArguments(array($clients));
39 3
    }
40
}
41