Total Complexity | 5 |
Total Lines | 29 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
24 | final class TwigTemplateEngine implements TemplateEngineInterface |
||
25 | { |
||
26 | private ?TemplateWrapper $template = null; |
||
27 | |||
28 | public function __construct(private readonly Environment $twigEnvironment) |
||
29 | { |
||
30 | } |
||
31 | |||
32 | public function parse(string $source): TemplateEngineInterface |
||
37 | } |
||
38 | |||
39 | public function process(array $data = array()): string |
||
40 | { |
||
41 | if (null === $this->template) { |
||
42 | throw new MissingParsedTemplate( |
||
43 | "You need to set a template before using the process() method. ". |
||
44 | "Use TemplateEngine::parse() first." |
||
45 | ); |
||
46 | } |
||
47 | return $this->template->render($data); |
||
48 | } |
||
49 | |||
50 | public function sourceEngine(): Environment |
||
53 | } |
||
54 | } |
||
55 |