<?php
declare(strict_types=1);
namespace App\Core;

abstract class Controller {
    protected function view(string $view, array $data = []): void {
        extract($data, EXTR_SKIP);
        $viewFile = __DIR__ . '/../Views/' . $view . '.php';
        if (!file_exists($viewFile)) {
            http_response_code(404);
            include __DIR__ . '/../Views/errors/404.php';
            return;
        }
        include $viewFile;
    }
}
