Completed
Pull Request — 2.x (#1258)
by
unknown
01:42
created

FormatResolverFactory::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14

Duplication

Lines 14
Ratio 100 %

Importance

Changes 0
Metric Value
dl 14
loc 14
rs 9.7998
c 0
b 0
f 0
cc 1
nc 1
nop 3
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\Factory\Resolver;
13
14
use Symfony\Component\DependencyInjection\ContainerBuilder;
15
use Symfony\Component\DependencyInjection\DefinitionDecorator;
16
17
/**
18
 * Class FormatResolverFactory
19
 *
20
 * @copyright 2017 IntechSystems, SIA
21
 * @author    Mihail Savluga
22
 */
23
class FormatResolverFactory extends WebPathResolverFactory
24
{
25
    /**
26
     * {@inheritDoc}
27
     */
28 View Code Duplication
    public function create(ContainerBuilder $container, $resolverName, array $config)
0 ignored issues
show
Duplication introduced by
This method 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...
29
    {
30
        $resolverDefinition = new DefinitionDecorator('liip_imagine.cache.resolver.prototype.format');
31
        $resolverDefinition->replaceArgument(2, $config['web_root']);
32
        $resolverDefinition->replaceArgument(3, $config['cache_prefix']);
33
        $resolverDefinition->addTag('liip_imagine.cache.resolver', [
34
            'resolver' => $resolverName,
35
        ]);
36
        $resolverId = 'liip_imagine.cache.resolver.'.$resolverName;
37
38
        $container->setDefinition($resolverId, $resolverDefinition);
39
40
        return $resolverId;
41
    }
42
43
    /**
44
     * {@inheritDoc}
45
     */
46
    public function getName()
47
    {
48
        return 'format';
49
    }
50
}
51