TwigExtension   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
eloc 6
c 3
b 0
f 0
dl 0
loc 25
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getFilters() 0 4 1
A getName() 0 3 1
A __construct() 0 3 1
1
<?php
2
3
namespace DH\DoctrineAuditBundle\Twig\Extension;
4
5
use Doctrine\Persistence\ManagerRegistry;
6
use Twig\Extension\AbstractExtension;
7
use Twig\TwigFilter;
8
9
class TwigExtension extends AbstractExtension
10
{
11
    /**
12
     * @var ManagerRegistry
13
     */
14
    protected $doctrine;
15
16
    public function __construct(ManagerRegistry $doctrine)
17
    {
18
        $this->doctrine = $doctrine;
19
    }
20
21
    public function getFilters(): array
22
    {
23
        return [
24
            new TwigFilter('json_decode', 'json_decode'),
25
        ];
26
    }
27
28
    /**
29
     * {@inheritdoc}
30
     */
31
    public function getName(): string
32
    {
33
        return 'twig_extensions';
34
    }
35
}
36