You are here

protected function RedirectableUrlMatcher::handleRouteRequirements in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/routing/Matcher/RedirectableUrlMatcher.php \Symfony\Component\Routing\Matcher\RedirectableUrlMatcher::handleRouteRequirements()

Handles specific route requirements.

Parameters

string $pathinfo The path:

string $name The route name:

Route $route The route:

Return value

array The first element represents the status, the second contains additional information

Overrides UrlMatcher::handleRouteRequirements

File

vendor/symfony/routing/Matcher/RedirectableUrlMatcher.php, line 49

Class

RedirectableUrlMatcher
@author Fabien Potencier <fabien@symfony.com>

Namespace

Symfony\Component\Routing\Matcher

Code

protected function handleRouteRequirements($pathinfo, $name, Route $route) {

  // expression condition
  if ($route
    ->getCondition() && !$this
    ->getExpressionLanguage()
    ->evaluate($route
    ->getCondition(), array(
    'context' => $this->context,
    'request' => $this->request,
  ))) {
    return array(
      self::REQUIREMENT_MISMATCH,
      null,
    );
  }

  // check HTTP scheme requirement
  $scheme = $this->context
    ->getScheme();
  $schemes = $route
    ->getSchemes();
  if ($schemes && !$route
    ->hasScheme($scheme)) {
    return array(
      self::ROUTE_MATCH,
      $this
        ->redirect($pathinfo, $name, current($schemes)),
    );
  }
  return array(
    self::REQUIREMENT_MATCH,
    null,
  );
}