<?php

namespace App\Core;

class Controller
{
    protected array $data = [];
    protected string $layout = 'layout/main';

    protected function view(string $view, array $params = []): void
    {
        extract($params);
        $viewPath = __DIR__ . '/../views/' . $view . '.php';

        if (!file_exists($viewPath)) {
            throw new \RuntimeException("View {$view} not found");
        }

        require __DIR__ . '/../views/' . $this->layout . '.php';
    }
}

