IPcalc-u-later/src/Http/View/Engine/HtmlEngine.php
2024-11-27 20:07:22 +01:00

25 lines
No EOL
520 B
PHP

<?php
namespace Core\Http\View\Engine;
use Core\Http\View\Render;
class HtmlEngine extends Render
{
/**
* @inheritDoc
* @throws \Exception
*/
public function render(): void
{
$basePath = $_SERVER['DOCUMENT_ROOT'];
$viewsPath = app()->resourcePath('views/' . str_replace('.', '/', $this->view) . '.php');
if (!file_exists($viewsPath)) {
throw new \Exception('View not found');
}
extract($this->data);
include $viewsPath;
}
}