public function toUrl($name = '', $params = []) { if (array_key_exists($name, $this->names) && !empty($this->routes[$this->names[$name]])) { $route = new Route($this->routes[$this->names[$name]][0]); return $route->toUrl($params); } throw new NotFoundException(sprintf('The route name requested: %s cannot be found', $name)); }