Passed
Push — master ( 5248c8...e19594 )
by Jan
04:20
created

TypeLabelExtension   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 14
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getFunctions() 0 5 1
A __construct() 0 3 1
1
<?php
2
3
4
namespace App\Twig;
5
6
7
use App\Services\ElementTypeNameGenerator;
8
use Twig\Extension\AbstractExtension;
9
use Twig\TwigFunction;
10
11
final class TypeLabelExtension extends AbstractExtension
12
{
13
    private $nameGenerator;
14
15
    public function __construct(ElementTypeNameGenerator $elementTypeNameGenerator)
16
    {
17
        $this->nameGenerator = $elementTypeNameGenerator;
18
    }
19
20
    public function getFunctions()
21
    {
22
        return [
23
                new TwigFunction('elementType', [$this->nameGenerator, 'getLocalizedTypeLabel']),
24
                new TwigFunction('elementTypeName', [$this->nameGenerator, 'getTypeNameCombination']),
25
            ];
26
    }
27
}