Completed
Push — master ( b55518...935c8b )
by Midori
36:45 queued 21:52
created

ViewableTrait   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 8
c 1
b 0
f 0
dl 0
loc 13
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace midorikocak\view;
6
7
trait ViewableTrait
8
{
9
    public ?View $view = null;
0 ignored issues
show
Bug introduced by
This code did not parse for me. Apparently, there is an error somewhere around this line:

Syntax error, unexpected '?', expecting T_FUNCTION or T_CONST
Loading history...
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
    }
21
}
22