Open Journal Systems  3.3.0
lib/vendor/symfony/http-foundation/ExpressionRequestMatcher.php
1 <?php
2 
3 /*
4  * This file is part of the Symfony package.
5  *
6  * (c) Fabien Potencier <fabien@symfony.com>
7  *
8  * For the full copyright and license information, please view the LICENSE
9  * file that was distributed with this source code.
10  */
11 
13 
14 use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
15 
22 {
23  private $language;
24  private $expression;
25 
26  public function setExpression(ExpressionLanguage $language, $expression)
27  {
28  $this->language = $language;
29  $this->expression = $expression;
30  }
31 
32  public function matches(Request $request)
33  {
34  if (!$this->language) {
35  throw new \LogicException('Unable to match the request as the expression language is not available.');
36  }
37 
38  return $this->language->evaluate($this->expression, array(
39  'request' => $request,
40  'method' => $request->getMethod(),
41  'path' => rawurldecode($request->getPathInfo()),
42  'host' => $request->getHost(),
43  'ip' => $request->getClientIp(),
44  'attributes' => $request->attributes->all(),
45  )) && parent::matches($request);
46  }
47 }
Symfony\Component\HttpFoundation\Request\getClientIp
getClientIp()
Definition: lib/vendor/symfony/http-foundation/Request.php:974
Symfony\Component\HttpFoundation\ExpressionRequestMatcher
Definition: lib/vendor/symfony/http-foundation/ExpressionRequestMatcher.php:21
Symfony\Component\HttpFoundation\Request\getPathInfo
getPathInfo()
Definition: lib/vendor/symfony/http-foundation/Request.php:1005
Symfony\Component\HttpFoundation\Request\getMethod
getMethod()
Definition: lib/vendor/symfony/http-foundation/Request.php:1401
Symfony\Component\HttpFoundation\Request
Definition: lib/vendor/symfony/http-foundation/Request.php:31
Symfony\Component\HttpFoundation\RequestMatcher
Definition: lib/vendor/symfony/http-foundation/RequestMatcher.php:19
Symfony\Component\HttpFoundation\ExpressionRequestMatcher\setExpression
setExpression(ExpressionLanguage $language, $expression)
Definition: lib/vendor/symfony/http-foundation/ExpressionRequestMatcher.php:26
Symfony\Component\HttpFoundation
Definition: lib/vendor/symfony/http-foundation/AcceptHeader.php:12
Symfony\Component\HttpFoundation\ExpressionRequestMatcher\matches
matches(Request $request)
Definition: lib/vendor/symfony/http-foundation/ExpressionRequestMatcher.php:32
Symfony\Component\HttpFoundation\Request\getHost
getHost()
Definition: lib/vendor/symfony/http-foundation/Request.php:1323