path = $path; } public function render(string $template, array $data = []): string { $file = "{$this->path}$template.php"; if (!is_file($file) || !is_readable($file)) { throw new \Exception("Unable to locate template $file"); } extract($data); ob_start(); require_once($file); return ob_get_clean(); } }