<?php

require_once __DIR__ . '/View.php';

abstract class Controller
{
    protected function render(string $view, array $data = []): void
    {
        if (!class_exists('View', false)) {
            require_once __DIR__ . '/View.php';
        }

        View::render($view, $data);
    }

    protected function redirect(string $path): void
    {
        header('Location: ' . BASE_URL . '/' . ltrim($path, '/'));
        exit;
    }
}
