| Total Complexity | 3 |
| Total Lines | 21 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 7 | class View |
||
| 8 | { |
||
| 9 | private RendererInterface $renderer; |
||
|
|
|||
| 10 | |||
| 11 | /** @var string is a filename */ |
||
| 12 | private string $template = ''; |
||
| 13 | |||
| 14 | public function __construct(RendererInterface $renderer) |
||
| 15 | { |
||
| 16 | $this->renderer = $renderer; |
||
| 17 | } |
||
| 18 | |||
| 19 | public function setTemplate(string $template) |
||
| 20 | { |
||
| 21 | $this->template = $template; |
||
| 22 | } |
||
| 23 | |||
| 24 | public function render(array $data): string |
||
| 25 | { |
||
| 26 | //preg_match_all('/\$[a-zA-z0-9-_]+?\b/', $templateContents, $templateVars); |
||
| 27 | return $this->renderer->render($this->template, $data); |
||
| 28 | } |
||
| 30 |