ServiceAliasCompilerPass   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 16
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 8 2
1
<?php
2
3
/*
4
 * This file is part of php-cache organization.
5
 *
6
 * (c) 2015 Aaron Scherer <[email protected]>, Tobias Nyholm <[email protected]>
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace Cache\AdapterBundle\DependencyInjection\CompilerPass;
13
14
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
15
use Symfony\Component\DependencyInjection\ContainerBuilder;
16
17
/**
18
 * @author Aaron Scherer <[email protected]>
19
 *
20
 * ServiceAliasCompilerPass Class
21
 */
22
class ServiceAliasCompilerPass implements CompilerPassInterface
23
{
24
    /**
25
     * You can modify the container here before it is dumped to PHP code.
26
     *
27
     * @param ContainerBuilder $container
28
     */
29 3
    public function process(ContainerBuilder $container)
30
    {
31 3
        $serviceIds = array_keys($container->findTaggedServiceIds('cache.provider'));
32 3
        foreach ($serviceIds as $serviceId) {
33 3
            $definition = $container->getDefinition($serviceId);
34 3
            $container->setAlias($definition->getClass(), $serviceId);
35
        }
36 3
    }
37
}
38