| @@ 64-75 (lines=12) @@ | ||
| 61 | /** |
|
| 62 | * @inheritDoc |
|
| 63 | */ |
|
| 64 | public function toCurrent(array $variables = [], array $query = []): UriInterface |
|
| 65 | { |
|
| 66 | $route = $this->request->getAttribute('route'); |
|
| 67 | ||
| 68 | if ($route === null) { |
|
| 69 | throw new RouteNotFoundException( |
|
| 70 | sprintf('Unable to generate an URL for current.') |
|
| 71 | ); |
|
| 72 | } |
|
| 73 | ||
| 74 | return $this->buildRouteUri($route, $variables, $query); |
|
| 75 | } |
|
| 76 | ||
| 77 | /** |
|
| 78 | * @inheritDoc |
|
| @@ 80-91 (lines=12) @@ | ||
| 77 | /** |
|
| 78 | * @inheritDoc |
|
| 79 | */ |
|
| 80 | public function toRoute(string $routeName, array $variables = [], array $query = []): UriInterface |
|
| 81 | { |
|
| 82 | $route = $this->routes->findByName($routeName); |
|
| 83 | ||
| 84 | if ($route === null) { |
|
| 85 | throw new RouteNotFoundException( |
|
| 86 | sprintf('Unable to generate an URL for the named route "%s" as such route does not exist.', $routeName) |
|
| 87 | ); |
|
| 88 | } |
|
| 89 | ||
| 90 | return $this->buildRouteUri($route, $variables, $query); |
|
| 91 | } |
|
| 92 | ||
| 93 | /** |
|
| 94 | * Adds port to URI if it is needed. |
|