/** * @param Request $request * @param Route $route * @return Request */ function __invoke(Request $request, Route $route) { if (!$route->wildcard()) { return $request; } $params = $this->params($request); $options = $this->options($route); $request[Arg::PARAMS] = $this->match($params, $options, $this->parts($params, $options)); return $request; }
/** * @param Route $route * @return \Closure|null */ protected function wildcard(Route $route) { return !$route->wildcard() ? null : function ($path, array $params = []) use($route) { foreach ($params as $key => $value) { null !== $value && ($path .= Arg::SEPARATOR . $key . Arg::SEPARATOR . $value); } return $path; }; }