. */ namespace SP\Mvc\View\Components; use SP\Core\Exceptions\FileNotFoundException; use SP\Mvc\View\TemplateInterface; /** * Class DataTab * * @package SP\Mvc\View\Components */ final class DataTab { protected string $title; protected TemplateInterface $template; public function __construct(string $title, TemplateInterface $template) { $this->title = $title; $this->template = $template; } public function getTitle(): string { return $this->title; } public function setTitle(string $title): DataTab { $this->title = $title; return $this; } public function render(): string { try { return $this->template->render(); } catch (FileNotFoundException $e) { return $e->getMessage(); } } }