UrlProviderPass   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Test Coverage

Coverage 25%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 8
c 2
b 0
f 0
dl 0
loc 15
ccs 2
cts 8
cp 0.25
rs 10
wmc 4

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 10 4
1
<?php
2
/**
3
 * @author Gerard van Helden <[email protected]>
4
 * @copyright Zicht Online <http://zicht.nl>
5
 */
6
7
namespace Zicht\Bundle\UrlBundle\DependencyInjection\Compiler;
8
9
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
10
use Symfony\Component\DependencyInjection\ContainerBuilder;
11
use Symfony\Component\DependencyInjection\Reference;
12
13
/**
14
 * Registers all tagged services
15
 */
16
class UrlProviderPass implements CompilerPassInterface
17
{
18
    /**
19
     * @{inheritDoc}
20
     */
21 1
    public function process(ContainerBuilder $container)
22
    {
23 1
        if ($container->hasDefinition('zicht_url.provider.delegator')) {
24
            $definition = $container->getDefinition('zicht_url.provider.delegator');
25
            foreach ($container->findTaggedServiceIds('zicht_url.url_provider') as $id => $attributes) {
26
                $priority = 0;
27
                if (isset($attributes[0]['priority'])) {
28
                    $priority = (int)$attributes[0]['priority'];
29
                }
30
                $definition->addMethodCall('addProvider', array(new Reference($id), $priority));
31
            }
32
        }
33 1
    }
34
}
35