CachePass   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Test Coverage

Coverage 60%

Importance

Changes 1
Bugs 1 Features 0
Metric Value
eloc 6
c 1
b 1
f 0
dl 0
loc 12
ccs 3
cts 5
cp 0.6
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 7 2
1
<?php
2
/**
3
 * @author Gerard van Helden <[email protected]>
4
 * @copyright Zicht Online <http://zicht.nl>
5
 */
6
namespace Zicht\Bundle\UrlBundle\DependencyInjection\Compiler;
7
8
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
9
use Symfony\Component\DependencyInjection\ContainerBuilder;
10
11
/**
12
 * Replaces the url provider with a cache wrapper, if enabled.
13
 */
14
class CachePass implements CompilerPassInterface
15
{
16
    /**
17
     * @{inheritDoc}
18
     */
19 1
    public function process(ContainerBuilder $container)
20
    {
21 1
        if ($container->hasDefinition('zicht_url.cache')) {
22
            $container->setAlias('zicht_url.provider', 'zicht_url.cache_wrapper');
23
            $container->getDefinition('zicht_url.cache')->addTag('zicht_cache.cache_stats');
24
        } else {
25 1
            $container->setAlias('zicht_url.provider', 'zicht_url.provider.delegator');
26
        }
27 1
    }
28
}
29