Example #1
0
 /**
  * @param Route $parent
  * @param Route $child
  * @return Route
  */
 protected function merge(Route $parent, Route $child)
 {
     !$child->scheme() && $parent->scheme() && ($child[Arg::SCHEME] = $parent->scheme());
     !$child->host() && $parent->host() && ($child[Arg::HOST] = $parent->host());
     !$child->port() && $parent->port() && ($child[Arg::PORT] = $parent->port());
     return $child;
 }
Example #2
0
 /**
  * @param Request $request
  * @param Route $route
  * @return Request|NotFound
  */
 function __invoke(Request $request, Route $route)
 {
     return !$route->host() || $this->match($request, $route) ? $request : ($this->optional($route, Arg::HOST) ? null : new NotFound());
 }