currentPath = $current_path; } public function finalMatch(RouteCollection $collection, Request $request) { $this->routes = $collection; $context = new RequestContext(); $context->fromRequest($request); $this->setContext($context); return $this->match($this->currentPath->getPath($request)); } /** * {@inheritdoc} */ protected function getAttributes(Route $route, $name, array $attributes): array { if ($route instanceof RouteObjectInterface && is_string($route->getRouteKey())) { $name = $route->getRouteKey(); } $attributes[RouteObjectInterface::ROUTE_NAME] = $name; $attributes[RouteObjectInterface::ROUTE_OBJECT] = $route; return $this->mergeDefaults($attributes, $route->getDefaults()); } }