ResolversCompilerPass::process()   A
last analyzed

Complexity

Conditions 4
Paths 3

Size

Total Lines 13

Duplication

Lines 13
Ratio 100 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 13
loc 13
rs 9.8333
cc 4
nc 3
nop 1
1
<?php
2
3
/*
4
 * This file is part of the `liip/LiipImagineBundle` project.
5
 *
6
 * (c) https://github.com/liip/LiipImagineBundle/graphs/contributors
7
 *
8
 * For the full copyright and license information, please view the LICENSE.md
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Liip\ImagineBundle\DependencyInjection\Compiler;
13
14
use Symfony\Component\DependencyInjection\ContainerBuilder;
15
use Symfony\Component\DependencyInjection\Reference;
16
17 View Code Duplication
class ResolversCompilerPass extends AbstractCompilerPass
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
18
{
19
    /**
20
     * {@inheritdoc}
21
     */
22
    public function process(ContainerBuilder $container)
23
    {
24
        $tags = $container->findTaggedServiceIds('liip_imagine.cache.resolver');
25
26
        if (\count($tags) > 0 && $container->hasDefinition('liip_imagine.cache.manager')) {
27
            $manager = $container->getDefinition('liip_imagine.cache.manager');
28
29
            foreach ($tags as $id => $tag) {
30
                $manager->addMethodCall('addResolver', [$tag[0]['resolver'], new Reference($id)]);
31
                $this->log($container, 'Registered cache resolver: %s', $id);
32
            }
33
        }
34
    }
35
}
36