Beispiel #1
0
 /**
  * (non-PHPdoc)
  * @see \Slince\Router\Validator\ValidatorInterface::validate()
  */
 function validate(RouteInterface $route, RequestContext $context)
 {
     $matches = [];
     $result = !$route->getCompiledRoute()->getHostRegex() || preg_match($route->getCompiledRoute()->getHostRegex(), $context->getHost(), $matches);
     if ($result) {
         $route->setReport(self::$id, $matches);
     }
     return $result;
 }
Beispiel #2
0
 /**
  * (non-PHPdoc)
  * @see \Slince\Router\Validator\ValidatorInterface::validate()
  */
 function validate(RouteInterface $route, RequestContext $context)
 {
     $matches = [];
     $result = preg_match($route->getCompiledRoute()->getRegex(), rawurldecode($context->getParameter('path')), $matches);
     if ($result) {
         $route->setReport(self::$id, $matches);
     }
     return $result;
 }