本文整理匯總了PHP中Symfony\Component\Routing\Matcher\UrlMatcher::handleRouteRequirements方法的典型用法代碼示例。如果您正苦於以下問題:PHP UrlMatcher::handleRouteRequirements方法的具體用法?PHP UrlMatcher::handleRouteRequirements怎麽用?PHP UrlMatcher::handleRouteRequirements使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Symfony\Component\Routing\Matcher\UrlMatcher
的用法示例。
在下文中一共展示了UrlMatcher::handleRouteRequirements方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: handleRouteRequirements
/**
* 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;
}