/** * @param AppRequest $appRequest * @return ControllerRoute * @throws AemosCriticalException */ private function findConfiguredRoute(AppRequest $appRequest) { $tmpRoute = new ControllerRoute($appRequest->getRequestUrl(), new ControllerPointer(""), $appRequest->getRequestType()); if (!isset($this->controllerRoutes[$tmpRoute->getRoot()]) || !isset($this->controllerRoutes[$tmpRoute->getRoot()][$tmpRoute->getLength()])) { throw new AemosCriticalException("Requested page not found", HttpStatusCode::notFound()); } foreach ($this->controllerRoutes[$tmpRoute->getRoot()][$tmpRoute->getLength()] as $key => $route) { if ($route->equals($tmpRoute)) { return $route; } } throw new AemosCriticalException("Requested page not found", HttpStatusCode::notFound()); }
public function equals(ControllerRoute $otherRoute) { if (!$otherRoute instanceof ControllerRoute) { return false; } if ($otherRoute == null) { return false; } if ($otherRoute->getRoot() != $this->getRoot()) { return false; } if ($otherRoute->getLength() != $this->getLength()) { return false; } return $this->compareVariables($otherRoute) && $this->compareMethods($otherRoute); }