Get the URL to a named route.

@param  string  $name
@param  mixed   $parameters
@param  bool|null  $secure

@return string

@throws \InvalidArgumentException
544900
public function route($name, $parameters = [], $secure = null)
    {
        if (! isset($this->app->router->namedRoutes[$name])) {
            throw new \InvalidArgumentException("Route [{$name}] not defined.");
        }

        $uri = $this->app->router->namedRoutes[$name];

        $parameters = $this->formatParameters($parameters);

        $uri = \preg_replace_callback('/\[([^\]]*)\]$/', function ($matches) use ($uri, &$parameters) {
            $uri = $this->replaceRouteParameters($matches[1], $parameters);

            return ($matches[1] == $uri) ? '' : $uri;
        }, $uri);

        $uri = $this->replaceRouteParameters($uri, $parameters);

        $uri = $this->to($uri, [], $secure);

        if (! empty($parameters)) {
            $uri .= '?'.\http_build_query($parameters);
        }

        return $uri;
    }
121525
public function callRoute($name, array $parameters = [], array $options = [])
    {
        try {
            $content = $this->router->dispatchRoute($name, $parameters, $options);
        } catch (\Exception $e) {
            return sprintf('<p style="display:block;boder:1px solid red;" class="error">%s</p>', $e->getMessage());
        }

        return is_string($content) ? $content : '';
    }
429952
public function getPath($name)
    {
        if (array_key_exists($name, $this->paths)) {
            return '/' . $this->paths[$name];
        } else {
            throw new \InvalidArgumentException(sprintf('Path "%s" is not defined. Maybe you forgot to add it to tuna_cms_admin.paths config?', $name));
        }
    }
100718
public function urlIfCan($authorization, string $path, string $text, array $parameters = [], $secure = null)
    {
        return $this->addIfCan($authorization, Link::toUrl($path, $text, $parameters, $secure));
    }
46786
public function to($url, $extra = [], $secure = null)
    {
        if ($this->isValidUrl($url)) {
            return $url;
        }

        $scheme = $this->getScheme($secure);

        $params = $this->setParams($extra);

        $url = $this->setUrl($url);

        $url = $scheme.$url.$params;

        return self::locate($url);
    }
1159312
public function generatePath($name, array $parameters = array())
    {
        return $this->container->get('router.url_generator')->generate($name, $parameters, false);
    }
844615
protected function getRoute($name, $parameters = [], $absolute = true)
    {
        return route($this->getRouteName($name), $parameters, $absolute);
    }
660947
public function url($uri, $secure = null)
    {
        // If path is full, so we just return.
        if (preg_match('#^http|//:#', $uri))
        {
            return $uri;
        }

        $path = $this->getCurrentPath().$uri;

        if(substr($path, 0, 6)=='public') $path = substr($path, 7);

        return $this->configAssetUrl($path, $secure);
    }
571281
public function getUrl($name, $parameters = [], $schemeRelative = false)
    {
        return $this->generator->generate($name, $parameters, $schemeRelative ? UrlGeneratorInterface::NETWORK_PATH : UrlGeneratorInterface::ABSOLUTE_URL);
    }
1013737
public function make($path = null, $params = [], $secure = false)
    {
        $this->secure = $secure;
        $params_index = strpos($path, '?');
        $query        = $params_index === false ? '' : parse_url($path, PHP_URL_QUERY);
        $path         = $params_index === false ? $path : substr($path, 0, $params_index);
        $path_params  = [];
        if ($query) {
            parse_str($query, $path_params);
        }

        $this->params = array_merge($path_params, $params);

        if (substr($path, 0, 4) === 'http') {
            $this->url = $path;
        } else {
            $scheme    = $this->secure ? 'https' : request()->getScheme();
            $site_root = request()->getHost() ? $scheme . '://' . request()->getHost() . '/' : '/';
            $this->url = $site_root . ltrim($path, '/');
        }

        return $this;
    }
1116737
public static function url($name, $parameters = []) {
		return URequest::getUrl ( self::getRouteByName ( $name, $parameters, false ) );
	}
352994
public function pathFor($name, $vars = [], array $options = [])
    {
        if ($name == 'base') {
            return $this->basePath;
        }
        
        foreach ($this->routes as $route) {
            $route->build();
            
            if ($route->name() == $name) {
                if ($path = $this->buildRouteUrl($route, $vars, $options)) {
                    return $path;
                }
            }
        }
        
        $routeParams = [];
        if (is_array($vars)) {
            $routeParams = array_merge($routeParams, $vars);
        } elseif ($vars instanceof Base) {
            $routeParams['record'] = get_class($vars);
            $routeParams['id'] = $vars->id();
        }
        
        $routeParams = implode(', ', array_map(function($name, $val) { return $name . '=>' . $val; }, array_keys($routeParams), $routeParams));
        $message = "Couldn't find route with name '%s' and options { %s }";
        throw new Exception\InvalidArgumentException(sprintf(
            $message,
            $name,
            $routeParams
        ));
    }
423348
public function getUrl($name, $params = array())
	{
		return static::API_DOMAIN . $name . (empty($params) ? '' : ('?' . $this->http_build_query($params)));
	}
1310021
public function getParam($name) {
        if (empty($name) || !is_string($name)) {
            throw new \InvalidArgumentException('Paramater name must be not empty string');
        }

        if (isset($this->params[$name]) || array_key_exists($name, $this->params)) {
            return $this->params[$name];
        }
        throw new ConfigurationException(sprintf('Parameter %s doesn\'t exists', $name));
    }
1174157
public function getMobileUrl($name, $params)
	{
		return static::API_MOBILE_DOMAIN . $name . (empty($params) ? '' : ('?' . $this->http_build_query($params)));
	}
1363191
public function getAuthLoginUrl($name, $params = array())
	{
		return static::AUTH_DOMAIN . $name . (empty($params) ? '' : ('?' . $this->http_build_query($params)));
	}
171898
public function getRoute($name, array $args = [])
    {
        if (!isset($this->names[$name])) {
            return null;
        }

        $route = $this->callbacks[$this->names[$name]];

        if (strpos($route->pattern, '(') === false) {
            // If we don't have any route parameters, just return the pattern
            // straight off. No need for any regex stuff.
            return $route->pattern;
        }

        // Convert all placeholders to %o = optional and %r = required
        $from    = ['/(\([^\/]+[\)]+[\?])/', '/(\([^\/]+\))/'];
        $to      = ['%o', '%r'];
        $pattern = preg_replace($from, $to, $route->pattern);

        $frags = explode('/', trim($pattern, '/'));
        $url   = [];

        // Loop thru the pattern fragments and insert the arguments
        foreach ($frags as $frag) {
            if ($frag == '%r') {
                if (!$args) {
                    // A required parameter, but no more arguments.
                    throw new Exception('Missing route parameters');
                }
                $url[] = array_shift($args);
                continue;
            }

            if ($frag == "%o") {
                if (!$args) {
                    // No argument for the optional parameter,
                    // just continue the iteration.
                    continue;
                }
                $url[] = array_shift($args);
                continue;
            }

            $url[] = $frag;
        }

        return '/' . implode('/', $url);
    }