Completed
Push — master ( 3d485f...407dff )
by Paweł
66:49
created

OverrideTemplatesSystemPass   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 4
dl 0
loc 32
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B process() 0 26 4
1
<?php
2
3
/*
4
 * This file is part of the Superdesk Web Publisher Core Bundle.
5
 *
6
 * Copyright 2016 Sourcefabric z.ú. and contributors.
7
 *
8
 * For the full copyright and license information, please see the
9
 * AUTHORS and LICENSE files distributed with this source code.
10
 *
11
 * @copyright 2016 Sourcefabric z.ú
12
 * @license http://www.superdesk.org/license
13
 */
14
15
namespace SWP\Bundle\CoreBundle\DependencyInjection\Compiler;
16
17
use SWP\Bundle\CoreBundle\Container\RevisionAwareContainerRenderer;
18
use SWP\Bundle\CoreBundle\Factory\ContainerFactory;
19
use SWP\Bundle\CoreBundle\Service\RevisionAwareContainerService;
20
use Symfony\Component\DependencyInjection\ContainerBuilder;
21
use Symfony\Component\DependencyInjection\Reference;
22
23
final class OverrideTemplatesSystemPass extends AbstractOverridePass
24
{
25
    /**
26
     * {@inheritdoc}
27
     */
28
    public function process(ContainerBuilder $container)
29
    {
30
        $containerRenderer = $this->getDefinitionIfExists($container, 'swp.factory.container_renderer');
31
        if (null !== $containerRenderer) {
32
            $containerRenderer
33
                ->setArguments([
34
                    RevisionAwareContainerRenderer::class,
35
                ]);
36
        }
37
38
        $containerFactory = $this->getDefinitionIfExists($container, 'swp.factory.container');
39
        if (null !== $containerFactory) {
40
            $containerFactory
41
                ->setClass(ContainerFactory::class)
42
                ->setArguments([
43
                    $container->getParameter('swp.model.container.class'),
44
                    new Reference('swp_multi_tenancy.random_string_generator'),
45
                ]);
46
        }
47
48
        $containerService = $this->getDefinitionIfExists($container, 'swp_template_engine.container.service');
49
        if (null !== $containerService) {
50
            $containerService
51
                ->setClass(RevisionAwareContainerService::class);
52
        }
53
    }
54
}
55