Esempio n. 1
0
 /**
  * getMatchedParams
  *
  * @param RouteInterface $route
  * @param array $matches
  *
  * @return array
  */
 private function getMatchedVars(RouteInterface $route, array $matches)
 {
     $vars = $route->getContext()->getVars();
     $params = array_merge($route->getDefaults(), array_filter(array_map([$this, 'getValue'], array_intersect_key($matches, $t = array_combine($vars, array_pad([], count($vars), null))))));
     return array_intersect_key($params, $t);
 }
Esempio n. 2
0
 /**
  * getPathPrefix
  *
  * @param RouteInterface $route
  * @param array $parameters
  * @param mixed $host
  *
  * @return mixed
  */
 private function getPathPrefix(RouteInterface $route, $host = null)
 {
     $context = $route->getContext();
     if (null === $host) {
         $host = $route->getHost() ? $route->getHost() : $this->request->getHost();
     }
     if (null !== $route->getHost() && !(bool) preg_match($context->getHostRegex(), $host)) {
         throw new \InvalidArgumentException('Host requirement does not match given host.');
     }
     return sprintf('%s://%s', $this->getRouteProtocol($route, $this->getRequest()), $host);
 }