Completed
Push — 1.7-legacy-sonata ( f1faa7 )
by Kamil
05:36
created

LegacySonataBlockExtension   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 0
dl 0
loc 22
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getFunctions() 0 6 1
A getWhitelistedVariables() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Sylius\Bundle\UiBundle\Twig;
6
7
use Twig\Extension\AbstractExtension;
8
use Twig\TwigFunction;
9
10
/**
11
 * @internal
12
 */
13
final class LegacySonataBlockExtension extends AbstractExtension
14
{
15
    /** @var array */
16
    private $whitelistedVariables;
17
18
    public function __construct(array $whitelistedVariables)
19
    {
20
        $this->whitelistedVariables = $whitelistedVariables;
21
    }
22
23
    public function getFunctions(): array
24
    {
25
        return [
26
            new TwigFunction('sonata_block_whitelisted_variables', [$this, 'getWhitelistedVariables']),
27
        ];
28
    }
29
30
    public function getWhitelistedVariables(): array
31
    {
32
        return $this->whitelistedVariables;
33
    }
34
}
35