public function urlFor($route = null, array $params = [], array $options = [])
{
if (null === $route) {
if (-1 === $this->routeIndex) {
throw new Exception\InvalidRouteException('Cannot call urlFor() with empty arguments; no route matched in this request');
}
$route = $this->routes[$this->routeIndex];
$params = array_merge($this->params()->getParams(), $params);
}
if (is_string($route)) {
if (!isset($this->namedRoutes[$route])) {
throw new Exception\InvalidRouteException(sprintf('Route by name "%s" not found; cannot generate URL', $route));
}
$route = $this->namedRoutes[$route];
}
if (!$route instanceof Route) {
throw new Exception\InvalidRouteException(sprintf('Invalid route type provided to %s; expects a string', __METHOD__));
}
return $this->request()->getBaseUrl() . $route->route()->assemble($params, $options);
}