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