Пример #1
0
 /**
  * Handles specific route requirements.
  *
  * @param string $pathinfo The path
  * @param string $name     The route name
  * @param string $route    The route
  *
  * @return array The first element represents the status, the second contains additional information
  */
 protected function handleRouteRequirements($pathinfo, $name, Route $route)
 {
     $pathinfo = File::normalizePath($pathinfo, '/', false);
     $status = parent::handleRouteRequirements($pathinfo, $name, $route);
     if (self::REQUIREMENT_MATCH == $status[0] && 0 < count($route->getRequirements('HTTP-'))) {
         if (null === ($request = $this->getContext()->getRequest())) {
             return array(self::REQUIREMENT_MISMATCH, null);
         }
         $requestMatcher = new RequestMatcher(null, null, null, null, array(), $route->getRequirements('HTTP-'));
         $status = array($requestMatcher->matches($request) ? self::REQUIREMENT_MATCH : self::REQUIREMENT_MISMATCH, null);
     }
     return $status;
 }