/** * Set the controller * for the route * * @param string $class */ public function setRouteControllerClass($class) { $method = strtolower(Router::getInstance()->getRequest()->getHttpMethod()); $routeMethod = strtolower($this->activeRoute->getType()); if ($routeMethod == 'any' || $method == $routeMethod) { if (true == class_exists($class)) { $this->controllerClass = $class; } else { HttpHeader::set(404, false); throw new View\Exception\ControllerClassNotFoundException('The class "' . $this->controllerClass . '" for the controller was not found.'); } } else { HttpHeader::set(404, false); throw new View\Exception\InvalidHttpMethodException('Invalid HTTP method found'); } }
/** * @return boolean */ public function equals(Route $route) { $fullFromRoute = preg_replace(self::VAR_MASK, '?', $route->getFullFrom()); $fullFromSelf = preg_replace(self::VAR_MASK, '?', $this->getFullFrom()); return $fullFromRoute == $fullFromSelf && $route->getType() == $this->getType(); }