Returns the encoded URL for the route with the given name.
@param string $name Name of the route
@param string[] $parameters Values for the route parameters
@return string The encoded URL for the route
549973
public function generateUrl(string $name, array $parameters = []): string
    {
        $definition = $this->provider->getRouteDefinitionByName($name);
        return $definition->formatUrl($parameters);
    }
35449
public function generate($name, $params = []) {
		$url = '';
		$path = $this->generatePath($name, $params);

		if ($path) {
			if (isset($_SERVER['HTTP_X_FORWARDED_PROTO'])
				&& $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https'
			) {
				$scheme = 'https';
			} else {
				$scheme = 'http';
			}
			$url = $scheme . '://' . $_SERVER['HTTP_HOST'] . $path;
		}

		return $url;
	}
1234822
public function query($name, $parameters = [])
    {
        if (!isset($parameters['APPID'])) {
            $parameters['APPID'] = $this->apiKey;
        }

        if (!isset($parameters['units'])) {
            $parameters['units'] = $this->units;
        }

        if (!isset($parameters['lang'])) {
            $parameters['lang'] = $this->lang;
        }

        $baseUrl = $this->apiUrl.$name;

        $requestQueryParts = [];
        foreach ($parameters as $key => $value) {
            $requestQueryParts[] = $key.'='.rawurlencode($value);
        }
        $baseUrl .= '?'.implode('&', $requestQueryParts);

        $response = $this->guzzleClient->get($baseUrl);
        $response = json_decode($response->getBody()->getContents());

        return $response;
    }
413631
public function functionPath(string $name, array $parameters = []): string
    {
        return $this->getApp()->getService('routing')->generate($name, $parameters);
    }
1037347
public static function URL($name, $params = []){
      return ($r = static::tagged($name)) ? $r-> getURL($params) : new URL();
    }
521959
protected function parseUrl($url, $parameters)
    {
        // If provided $url is a route name...
        if ($this->route->has($url)) {
            $url = $this->url->route($url, $parameters);
        } else {
            $url = $this->url->to($url, $parameters);
        }

        return $url;
    }
1192033
public function getPath($parameters = null)
    {
        if (empty($parameters) || !is_array($parameters) || empty($this->patternString)) {
            return $this->path;
        }

        //If an array of parameters is specified and a pattern string exists, we can build a path for the route
        $pattern = $this->patternString;
        foreach ($parameters as $parameterName => $parameterValue) {
            $pattern = preg_replace('#\[?\{[^:]+:' . preg_quote($parameterName, '#') . '\}\]?#', $parameterValue, $pattern);
        }

        //Delete remaining unmatched parameters
        $pattern = preg_replace('#\/\[?\{[^}]+\}\]?#', '', $pattern);

        return $this->path . $pattern;
    }
939432
public function getRouteByName($name)
    {
        if (!isset($this->routes[$name])) {
            return null;
        }
        return $this->routes[$name];
    }
353345
public function generateUrl($name, array $parameters = array())
    {
        return $this->container->get('router.url_generator')->generate($name, $parameters, true);
    }
541309
public function getPath($name, $parameters = [], $relative = false)
    {
        return $this->generator->generate($name, $parameters, $relative ? UrlGeneratorInterface::RELATIVE_PATH : UrlGeneratorInterface::ABSOLUTE_PATH);
    }
1131822
public function url($name, $params = array())
	{
		if ( ! array_key_exists($name, $this->routes))
		{
			throw new \UnexpectedValueException("A route with the name {$name} was not found");
		}

		$route = $this->routes[$name];
		return $route->url($params);
	}
821786
protected function key(string $name, array $arguments = null): string
    {
        if ($this->name !== '') {
            return $this->name;
        }

        if ($arguments === null) {
            return $this->name = $name;
        }

        return $this->name = \sha1(Serialize::encode([$name, $arguments]));
    }
1311179
public function getNamedUrl($name, $params = array(), $version = null, $locale = null)
    {
        if ($version == null) {
            $version = Registry::get('version');
        }
        if ($locale == null) {
            $locale = Registry::get('locale');
        }
        $foundRoute = false;
        if (isset($this->allRoutesByVersionAndLocale[$version][$locale][$name])) {
            $url = $this->allRoutesByVersionAndLocale[$version][$locale][$name]['regexp'];
            $foundRoute = true;
        } elseif (isset($this->allRoutesByVersionAndLocale[$version]['*'][$name])) {
            $url = $this->allRoutesByVersionAndLocale[$version]['*'][$name]['regexp'];
            $foundRoute = true;
        } elseif (isset($this->allRoutesByVersionAndLocale['*']['*'][$name])) {
            $url = $this->allRoutesByVersionAndLocale['*']['*'][$name]['regexp'];
            $foundRoute = true;
        }
        if ($foundRoute) {
            preg_match_all('/\(([\w_]+):([^)]+)\)/im', $url, $result, PREG_SET_ORDER);
            for ($matchi = 0; $matchi < count($result); $matchi ++) {
                if (isset($params[$result[$matchi][1]])) {
                    $url = str_replace($result[$matchi][0], $params[$result[$matchi][1]], $url);
                }
            }
            return $url;
        } else {
            throw new \Exception('Cannot find route named "' . $name . '" (version=' . $version . ', locale=' . $locale . ')');
        }
    }
413477
protected static function getParameterName($name, $parameters)
    {
        if (array_key_exists($name, $parameters)) {
            return $name;
        }

        if (array_key_exists($snakedName = Str::snake($name), $parameters)) {
            return $snakedName;
        }
    }
1228905
public function url($name, array $parameters = [], $schemeRelative = false)
    {
        if ($name instanceof TreeNodeInterface) {
            return $this->router->generate($name, $parameters, $schemeRelative ? UrlGeneratorInterface::NETWORK_PATH : UrlGeneratorInterface::ABSOLUTE_URL);
        } elseif ($name instanceof ContentTreeContext) {
            return $this->router->generate($name->getNode(), $parameters, $schemeRelative ? UrlGeneratorInterface::NETWORK_PATH : UrlGeneratorInterface::ABSOLUTE_URL);
        } elseif ($name instanceof ElementStructureValue) {
            if ($name->getType() === 'link') {
                $link = $name->getValue();
                if ($link['type'] === 'internal' || $link['type'] === 'intrasiteroot') {
                    $tree = $this->contentTreeManager->findByTreeId($link['tid']);
                    if ($tree) {
                        $node = $tree->get($link['tid']);

                        return $this->router->generate($node, $parameters, $schemeRelative ? UrlGeneratorInterface::NETWORK_PATH : UrlGeneratorInterface::ABSOLUTE_URL);
                    }
                } elseif ($link['type'] === 'external') {
                    return $link['url'];
                } elseif ($link['type'] === 'mailto') {
                    return 'mailto:'.$link['recipient'];
                }
            }
        } elseif (is_array($name) && isset($name['type']) && in_array($name['type'], array('internal', 'intrasiteroot', 'external', 'mailto'))) {
            $link = $name;
            if ($link['type'] === 'internal' || $link['type'] === 'intrasiteroot') {
                $tree = $this->contentTreeManager->findByTreeId($link['tid']);
                if ($tree) {
                    $node = $tree->get($link['tid']);

                    return $this->router->generate($node, $parameters, $schemeRelative ? UrlGeneratorInterface::NETWORK_PATH : UrlGeneratorInterface::ABSOLUTE_URL);
                }
            } elseif ($link['type'] === 'external') {
                return $link['url'];
            } elseif ($link['type'] === 'mailto') {
                return 'mailto:'.$link['recipient'];
            }
        } elseif (strlen($name) && (is_int($name) || (int) $name)) {
            $tree = $this->contentTreeManager->findByTreeId((int) $name);
            if ($tree) {
                $node = $tree->get((int) $name);

                return $this->router->generate($node, $parameters, $schemeRelative ? UrlGeneratorInterface::NETWORK_PATH : UrlGeneratorInterface::ABSOLUTE_URL);
            }
        } elseif (is_string($name)) {
            return $this->router->generate($name, $parameters, $schemeRelative ? UrlGeneratorInterface::NETWORK_PATH : UrlGeneratorInterface::ABSOLUTE_URL);
        }

        return '';
    }
487043
public function routeNameToUrlString($name, array $args = [])
    {
        foreach ($args as $offset => $arg) {
            if ( !$arg ) {
                unset($args[ $offset ]);
            }
        }

        try {
            $url = $this->generate($name, $args);
        } catch (RouteNotFound $exception) {
            try {
                $newName = 'default.' . $name;
                $url     = $this->generate($newName, $args);
            } catch (RouteNotFound $e) {
                throw new RouteNotFound(sprintf('Route with name "%s" or "%s" not found', $newName, $name));
            }
        }

        if ( FALSE !== strstr($url, '{') ) {
            throw new RouteNotFound(
                sprintf('Route with name "%s" needs parameters. Temporary resulted into: %s', $name, $url)
            );
        }

        return $this->request->getBaseUrl() . $url;
    }
1151581
public function getUrl($name, array $parameters = array())
    {
        return $this->container->get('router.url_generator')->generate($name, $parameters, true);
    }