for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace midorikocak\view;
trait ViewableTrait
{
public ?View $view = null;
public string $template = '';
abstract public function toArray(): array;
public function render(): string
$this->view ??= new View(new FileRenderer());
if ($this->template === '') {
return '';
}
$this->view->setTemplate($this->template);
return $this->view->render($this->toArray());