Total Complexity | 2 |
Total Lines | 34 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
8 | class MoleculeExtension extends \Twig_Extension |
||
9 | { |
||
10 | protected const FUNCTION_NAME = 'molecule'; |
||
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 $moleculeName, string $moleculeModule = self::MODULE) { |
||
23 | 1 | return $this->twigMolecule($moleculeName, $moleculeModule); |
|
24 | 1 | }, |
|
25 | [ |
||
26 | 1 | $this, |
|
27 | 1 | self::FUNCTION_NAME |
|
28 | ] |
||
29 | ) |
||
30 | ]; |
||
31 | } |
||
32 | |||
33 | /** |
||
34 | * @param $moleculeName |
||
35 | * @param $moleculeModule |
||
36 | * |
||
37 | * @return string |
||
38 | */ |
||
39 | 1 | private function twigMolecule(string $moleculeName, string $moleculeModule): string |
|
42 | } |
||
43 | |||
44 | } |