Completed
Push — api ( cecea0...116a36 )
by Kamil
29:57 queued 30s
created

LegacySonataBlockExtension   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

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
 * @experimental
13
 */
14
final class LegacySonataBlockExtension extends AbstractExtension
15
{
16
    /** @var array */
17
    private $whitelistedVariables;
18
19
    public function __construct(array $whitelistedVariables)
20
    {
21
        $this->whitelistedVariables = $whitelistedVariables;
22
    }
23
24
    public function getFunctions(): array
25
    {
26
        return [
27
            new TwigFunction('sonata_block_whitelisted_variables', [$this, 'getWhitelistedVariables']),
28
        ];
29
    }
30
31
    public function getWhitelistedVariables(): array
32
    {
33
        return $this->whitelistedVariables;
34
    }
35
}
36