Completed
Push — ezp-31088-refactor-content-mod... ( ab3ba3...3726c8 )
by
unknown
14:09
created

ContextAwareTwigVariablesExtension   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getGlobals() 0 4 1
1
<?php
2
3
/**
4
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
5
 * @license For full copyright and license information view LICENSE file distributed with this source code.
6
 */
7
declare(strict_types=1);
8
9
namespace eZ\Bundle\EzPublishCoreBundle\Templating\Twig;
10
11
use eZ\Publish\Core\MVC\ConfigResolverInterface;
12
use Twig\Extension\AbstractExtension;
13
use Twig\Extension\GlobalsInterface;
14
15
final class ContextAwareTwigVariablesExtension extends AbstractExtension implements GlobalsInterface
16
{
17
    /** @var \eZ\Publish\Core\MVC\ConfigResolverInterface */
18
    private $configResolver;
19
20
    public function __construct(
21
        ConfigResolverInterface $configResolver
22
    ) {
23
        $this->configResolver = $configResolver;
24
    }
25
26
    public function getGlobals(): array
27
    {
28
        return $this->configResolver->getParameter('twig_variables');
29
    }
30
}
31