request = $request; } public function get($path, $callback): void { $this->routes['GET'][$path] = $callback; } public function post($path, $callback): void { $this->routes['POST'][$path] = $callback; } /** * @throws PageNotFoundException */ public function resolve() { $path = $this->request->getPath(); $method = $this->request->method(); $callback = $this->routes[$method][$path] ?? false; if (!$callback) { throw new PageNotFoundException(); } Application::$app->controller = new $callback[0](); /* * TODO: * de adaugat aici middleware urile asociate unui controller */ return call_user_func($callback, $this->request); } }