Conditions | 2 |
Paths | 2 |
Total Lines | 22 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
18 | public function render(ViewInterface $view): string |
||
19 | { |
||
20 | $templateName = $view->getTemplate(); |
||
21 | $templatePath = sprintf('%s/%s.php', $this->templatePath, $templateName); |
||
22 | |||
23 | if (!file_exists($templatePath)) { |
||
24 | throw new TemplateNotFoundException(sprintf( |
||
25 | 'Template "%s" not found at "%s"', |
||
26 | $templateName, $templatePath |
||
27 | )); |
||
28 | } |
||
29 | |||
30 | $output = function () use ($view, $templatePath) { |
||
31 | ob_start(); |
||
32 | $renderer = $this; |
||
33 | require $templatePath; |
||
34 | |||
35 | return ob_get_clean(); |
||
36 | }; |
||
37 | |||
38 | return $output(); |
||
39 | } |
||
40 | } |
||
41 |