Total Complexity | 2 |
Total Lines | 34 |
Duplicated Lines | 0 % |
Coverage | 66.67% |
Changes | 0 |
1 | <?php |
||
8 | class TemplateExtension extends \Twig_Extension |
||
9 | { |
||
10 | protected const FUNCTION_NAME = 'template'; |
||
11 | |||
12 | protected const MODULE = 'Atomic'; |
||
13 | |||
14 | /** |
||
15 | * @return array|\Twig_Function[] |
||
16 | */ |
||
17 | 1 | public function getFunctions(): array |
|
18 | { |
||
19 | return [ |
||
20 | 1 | new \Twig_SimpleFunction( |
|
21 | 1 | self::FUNCTION_NAME, |
|
22 | function (string $templateName, string $templateModule = self::MODULE) { |
||
23 | return $this->twigTemplate($templateName, $templateModule); |
||
24 | 1 | }, |
|
25 | [ |
||
26 | 1 | $this, |
|
27 | 1 | self::FUNCTION_NAME |
|
28 | ] |
||
29 | ) |
||
30 | ]; |
||
31 | } |
||
32 | |||
33 | /** |
||
34 | * @param $templateName |
||
35 | * @param $templateModule |
||
36 | * |
||
37 | * @return string |
||
38 | */ |
||
39 | private function twigTemplate(string $templateName, string $templateModule): string |
||
42 | } |
||
43 | |||
44 | } |