model = $model; } public function index(): void { $data = $this->model->getData(); $this->render('views/example_view.php', ['data' => $data]); } public function show(int $id): void { $item = $this->model->find($id); if ($item === null) { $this->notFound(); return; } $this->render('views/item_view.php', ['item' => $item]); } private function render(string $viewPath, array $data): void { extract($data); include $viewPath; } private function notFound(): void { http_response_code(404); include 'views/404.php'; } }