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

TypeLabelExtension::getFunctions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 5
rs 10
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
}