Completed
Push — travis ( f73ca9 )
by Asmir
03:03
created

AddExtensionsPass   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 90.91%

Importance

Changes 0
Metric Value
wmc 3
c 0
b 0
f 0
lcom 0
cbo 3
dl 0
loc 18
ccs 10
cts 11
cp 0.9091
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 14 3
1
<?php
2
namespace Goetas\TwitalBundle\DependencyInjection\Compiler;
3
4
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
5
use Symfony\Component\DependencyInjection\ContainerBuilder;
6
use Symfony\Component\DependencyInjection\Reference;
7
8
/**
9
 *
10
 * @author Asmir Mustafic <[email protected]>
11
 *
12
 */
13
class AddExtensionsPass implements CompilerPassInterface
14
{
15
16 1
    public function process(ContainerBuilder $container)
17
    {
18 1
        if (false === $container->hasDefinition('twital')) {
19
            return;
20
        }
21
22 1
        $twitalDefinition = $container->getDefinition("twital");
23 1
        $extensionsIds = $container->findTaggedServiceIds("twital.extension");
24 1
        foreach ($extensionsIds as $extensionId => $params) {
25 1
            $twitalDefinition->addMethodCall('addExtension', array(
26 1
                new Reference($extensionId)
27 1
            ));
28 1
        }
29
    }
30
}