public function handle(MinorRequest $minorRequest) { $this->minorRequest = $minorRequest; $this->minorResponse = MinorResponse::getInstance(); list($controllerName, $actionName, $params) = $this->router->dispatcher($this->minorRequest->getUrl()); if (!($controllerName && $actionName && is_array($params))) { if (!Config::get(['app' => 'DEBUG']) && ($handler = Config::get(['app' => '404_HANDLER'])) && $handler instanceof \Closure) { $handler($minorRequest->getRequestUrl()); } else { throw new AppException('404 Not Found'); } } else { $res = $this->invoke($controllerName, $actionName, $params); $res === $this->minorResponse ? $this->minorResponse = $res : $this->minorResponse->appendContent($res); } return $this->minorResponse; }
public static function buildMinorRequest() { $minorRequest = MinorRequest::getInstance(self::getUrl(), $_SERVER['REQUEST_URI'], self::getBaseUrl($_SERVER['REQUEST_URI']), self::getMethod(), $_GET, $_POST, self::getMinorCookie(), self::getMinorSession(), null, null, null, $_SERVER); return $minorRequest; }
protected function forwardUrl($url) { $minorRequest = MinorRequest::getInstance($url); return $this->app->handle($minorRequest); }