Total Complexity | 3 |
Total Lines | 23 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php declare(strict_types=1); |
||
7 | final class TwigTemplateEngine implements TemplateEngine |
||
8 | { |
||
9 | private Environment $engine; |
||
10 | private string $ext; |
||
11 | |||
12 | /** |
||
13 | * TwigTemplateEngine Constructor. |
||
14 | * @param array<mixed> $templateDirs |
||
15 | * @param array<mixed> $options |
||
16 | * @param string $ext the template file extension. Default is <code>twig</code>. |
||
17 | * @param array<mixed> $globals |
||
18 | */ |
||
19 | public function __construct(array $templateDirs, array $options, string $ext = 'twig', array $globals = []) { |
||
20 | $loader = new FilesystemLoader($templateDirs); |
||
21 | $this->engine = new Environment($loader, $options); |
||
22 | foreach ($globals as $name => $value) { |
||
23 | $this->engine->addGlobal($name, $value); |
||
24 | } |
||
25 | $this->ext = $ext; |
||
26 | } |
||
27 | |||
28 | public function render($template, array $vars): string { |
||
30 | } |
||
31 | } |
||
32 |