| Total Complexity | 2 |
| Total Lines | 13 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 7 | trait ViewableTrait |
||
| 8 | { |
||
| 9 | public ?View $view = null; |
||
|
|
|||
| 10 | public string $template = ''; |
||
| 11 | |||
| 12 | public function render(): string |
||
| 13 | { |
||
| 14 | $this->view ??= new View(new FileRenderer()); |
||
| 15 | if ($this->template === '') { |
||
| 16 | return ''; |
||
| 17 | } |
||
| 18 | $this->view->setTemplate($this->template); |
||
| 19 | return $this->view->render($this->toArray()); |
||
| 20 | } |
||
| 22 |