Beispiel #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);
 }
Beispiel #2
0
 /**
  * parseHostVars
  *
  * @param RouteInterface $route
  *
  * @return array
  */
 private static function parseHostVars(RouteInterface $route)
 {
     if (null === ($host = $route->getHost())) {
         return ['expression' => null, 'tokens' => []];
     }
     return self::transpilePattern($host, true, $route->getConstraints(), $route->getDefaults());
 }
Beispiel #3
0
 /**
  * getRouteProtocol
  *
  * @param RouteInterface $route
  * @param RequestContextInterface $request
  *
  * @return string
  */
 private function getRouteProtocol(RouteInterface $route, RequestContextInterface $request)
 {
     $requestScheme = $request->getScheme();
     $schemes = $route->getSchemes();
     if (in_array($requestScheme, $schemes)) {
         return $requestScheme;
     }
     return current($schemes) ?: 'http';
 }