[ Index ] |
PHP Cross Reference of phpBB-3.3.14-deutsch |
[Summary view] [Print] [Text view]
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 12 namespace Symfony\Component\Routing\Matcher; 13 14 use Symfony\Component\Routing\Exception\ResourceNotFoundException; 15 use Symfony\Component\Routing\Route; 16 17 /** 18 * @author Fabien Potencier <fabien@symfony.com> 19 */ 20 abstract class RedirectableUrlMatcher extends UrlMatcher implements RedirectableUrlMatcherInterface 21 { 22 /** 23 * {@inheritdoc} 24 */ 25 public function match($pathinfo) 26 { 27 try { 28 $parameters = parent::match($pathinfo); 29 } catch (ResourceNotFoundException $e) { 30 if ('/' === substr($pathinfo, -1) || !\in_array($this->context->getMethod(), ['HEAD', 'GET'])) { 31 throw $e; 32 } 33 34 try { 35 $parameters = parent::match($pathinfo.'/'); 36 37 return array_replace($parameters, $this->redirect($pathinfo.'/', isset($parameters['_route']) ? $parameters['_route'] : null)); 38 } catch (ResourceNotFoundException $e2) { 39 throw $e; 40 } 41 } 42 43 return $parameters; 44 } 45 46 /** 47 * {@inheritdoc} 48 */ 49 protected function handleRouteRequirements($pathinfo, $name, Route $route) 50 { 51 // expression condition 52 if ($route->getCondition() && !$this->getExpressionLanguage()->evaluate($route->getCondition(), ['context' => $this->context, 'request' => $this->request ?: $this->createRequest($pathinfo)])) { 53 return [self::REQUIREMENT_MISMATCH, null]; 54 } 55 56 // check HTTP scheme requirement 57 $scheme = $this->context->getScheme(); 58 $schemes = $route->getSchemes(); 59 if ($schemes && !$route->hasScheme($scheme)) { 60 return [self::ROUTE_MATCH, $this->redirect($pathinfo, $name, current($schemes))]; 61 } 62 63 return [self::REQUIREMENT_MATCH, null]; 64 } 65 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Mon Nov 25 19:05:08 2024 | Cross-referenced by PHPXref 0.7.1 |