/** * Run Application */ public function run() { $route = $this->routeDispatcher->dispatch($this->request->method(), $this->request->path()); if ($route[0] == Status::FOUND) { if (is_callable($route[1])) { $this->response->setContent(call_user_func($route[1])); } elseif (is_array($route[1])) { $controllerName = $route[1]["controller"]; $actionMethod = $route[1]["method"]; $controller = new $controllerName($this); $content = $controller->{$actionMethod}($this->request); $this->response->setDataContent($content); } } else { $this->response->setNotFound(); } $this->response->send(); $this->terminate(); }
/** * @param Response $response * @return Response */ public function out(Response $response) { return $response->send(); }