Files
pta/app/Core/Controller.php
Loic Masi 5fbf76868f pour prod
2026-08-07 16:13:43 +02:00

20 lines
410 B
PHP

<?php
declare(strict_types=1);
namespace App\Core;
abstract class Controller
{
protected function render(string $view, array $data = []): void
{
$viewFile = dirname(__DIR__) . '/Views/' . $view . '.php';
if (!is_file($viewFile)) {
throw new \RuntimeException('Vue introuvable : ' . $view);
}
extract($data, EXTR_SKIP);
require $viewFile;
}
}