You are here

class ExpressionRequestMatcher in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/http-foundation/ExpressionRequestMatcher.php \Symfony\Component\HttpFoundation\ExpressionRequestMatcher

ExpressionRequestMatcher uses an expression to match a Request.

@author Fabien Potencier <fabien@symfony.com>

Hierarchy

Expanded class hierarchy of ExpressionRequestMatcher

1 file declares its use of ExpressionRequestMatcher
ExpressionRequestMatcherTest.php in vendor/symfony/http-foundation/Tests/ExpressionRequestMatcherTest.php

File

vendor/symfony/http-foundation/ExpressionRequestMatcher.php, line 21

Namespace

Symfony\Component\HttpFoundation
View source
class ExpressionRequestMatcher extends RequestMatcher {
  private $language;
  private $expression;
  public function setExpression(ExpressionLanguage $language, $expression) {
    $this->language = $language;
    $this->expression = $expression;
  }
  public function matches(Request $request) {
    if (!$this->language) {
      throw new \LogicException('Unable to match the request as the expression language is not available.');
    }
    return $this->language
      ->evaluate($this->expression, array(
      'request' => $request,
      'method' => $request
        ->getMethod(),
      'path' => rawurldecode($request
        ->getPathInfo()),
      'host' => $request
        ->getHost(),
      'ip' => $request
        ->getClientIp(),
      'attributes' => $request->attributes
        ->all(),
    )) && parent::matches($request);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ExpressionRequestMatcher::$expression private property
ExpressionRequestMatcher::$language private property
ExpressionRequestMatcher::matches public function Decides whether the rule(s) implemented by the strategy matches the supplied request. Overrides RequestMatcher::matches
ExpressionRequestMatcher::setExpression public function
RequestMatcher::$attributes private property
RequestMatcher::$host private property
RequestMatcher::$ips private property
RequestMatcher::$methods private property
RequestMatcher::$path private property
RequestMatcher::$schemes private property
RequestMatcher::matchAttribute public function Adds a check for request attribute.
RequestMatcher::matchHost public function Adds a check for the URL host name.
RequestMatcher::matchIp public function Adds a check for the client IP.
RequestMatcher::matchIps public function Adds a check for the client IP.
RequestMatcher::matchMethod public function Adds a check for the HTTP method.
RequestMatcher::matchPath public function Adds a check for the URL path info.
RequestMatcher::matchScheme public function Adds a check for the HTTP scheme.
RequestMatcher::__construct public function