Build a URL path based on a route name and associated parameters.
@param string $name
@param array $parameters
188558
public function buildUrl($name, $parameters=array(), $baseUrl=null)
	{
		$url = $this->routeByName($name)->interpolate($parameters);

		if($baseUrl)
			return (string) $baseUrl->relative($url);
		else if(isset($this->_baseUrl))
			return $this->_baseUrl->relative($url);
		else
			return $url;
	}
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;
	}
1077799
public static function path($name, $parameters = [], $absolute = false) {
		return self::getRouteByName ( $name, $parameters, $absolute );
	}
123799
public function route($name = ''){
        $routes = AsCollector::getAs();

        if (isset($routes[$name])) {
            $this->to($routes[$name]);
        }else{
            throw new RouteNotFoundException(sprintf('%s Route Not Found'));
        }
    }
555351
protected function buildRequest(Route $route, $name = null, array $parameters = array())
    {
        if (null !== $name) {
            $uri = $this->router->generate($name, $parameters);
        } else {
            $uri = $route->getPath();
        }

        return new Request(
            [], // GET
            [], // POST
            [], // Attributes
            [], // Cookies
            [], // Files
            [
                'REQUEST_URI'     => $uri,
                'DOCUMENT_URI'    => $uri,
                'SCRIPT_FILENAME' => realpath($this->kernel->getRootDir().'/../web').$this->baseUrl.'/app.php',
                'SCRIPT_NAME'     => $this->baseUrl.'/app.php'
            ], // Server
            null // Content
        );
    }
1373136
public function getRoutesByNames($names, $parameters = [])
    {
        $qb = $this->pageRepository->createQueryBuilder('p');
        $qb
            ->select('p.route, p.controller, t.path, t.locale')
            ->join('p.translations', 't')
            ->andWhere($qb->expr()->eq('p.static', 0))
        ;
        if (is_array($names) && !empty($names)) {
            $qb->andWhere($qb->expr()->in('p.route', $names));
        } elseif (is_string($names) && 0 < strlen($names)) {
            $qb->andWhere($qb->expr()->eq('p.route', $qb->expr()->literal($names)));
        }

        $results = $qb->getQuery()->getArrayResult();

        return $this->transformResultsToRoutes($results);
    }
353345
public function generateUrl($name, array $parameters = array())
    {
        return $this->container->get('router.url_generator')->generate($name, $parameters, true);
    }
1028084
public static function linkRoute($name, $title = null, $parameters = array(), $attributes = array())
    {
        $html = self::getInstance()->html;
        $args = func_get_args();
        return call_user_func_array(array($html, __FUNCTION__), $args);
    }
541309
public function getPath($name, $parameters = [], $relative = false)
    {
        return $this->generator->generate($name, $parameters, $relative ? UrlGeneratorInterface::RELATIVE_PATH : UrlGeneratorInterface::ABSOLUTE_PATH);
    }
1361850
protected function createRoutes(string $name): void
    {
        $apiFile = base_path($this->moduleName().'/'.$name.'/Routes/api.php');
        if (! $this->files->exists($apiFile)) {
            $this->files->put($apiFile, $this->files->get(__DIR__.'/stubs/routes/api.stub'));
        }

        $webFile = base_path($this->moduleName().'/'.$name.'/Routes/web.php');
        if (! $this->files->exists($webFile)) {
            $this->files->put($webFile, $this->files->get(__DIR__.'/stubs/routes/web.stub'));
        }
    }
802040
public function buildUrlWithParameters(array $parameters = [])
    {
        $url = $this->url;

        if (!$this->hasParameters() && !$parameters) {
            return $url;
        }

        foreach ($parameters as $key => $value) {
            $url = str_replace('{' . $key . '}', $value, $url);
        }
        return $url;
    }
1240021
protected function constructActionUrl(array $parameters = array())
    {
        switch($this->uriBuildMethod) {
            case self::PLAIN_URL_BUILD_METHOD;
                return $this->baseUrl;
                break;
            case self::ADDS_ON_URL_BUILD_METHOD;
                return $this->replaceAddsOn($this->baseUrl, $parameters);
                break;
            default;
                throw new Exception\BadConfiguredActionException(
                    sprintf('Unknown url build method: %s', $this->uriBuildMethod),
                    $this
                );
                break;
        }
    }
785425
public function generateRouting(array $parameters)
    {
        if ($this->isSymfony4()) {
            return;
        }

        $relPath = '/Resources/config/';
        $sourceDir = $this->skeletonDir.$relPath;
        $targetDir = $this->bundle->getPath().$relPath;

        $this->renderSingleFile($sourceDir, $targetDir, 'routing.yml', $parameters, true);

        $this->assistant->writeLine('Generating routing : <info>OK</info>');
    }
337804
public function route($name, $parameters = [])
    {
        $this->link_type = self::LINK_ROUTE;
        $this->link_value = [$name, $parameters];
        $this->checkActive();

        return $this;
    }
1127107
public function relativePathFor(string $name, array $substitutions = [], array $queryParams = []): string
    {
        $route = $this->getNamedRoute($name);
        $pattern = $route->getPath();
        $routeDatas = $this->parser->parse($pattern);
        // $routeDatas is an array of all possible routes that can be made. There is
        // one routedata for each optional parameter plus one for no optional parameters.
        //
        // The most specific is last, so we look for that first.
        $routeDatas = array_reverse($routeDatas);
        $segments = [];
        foreach ($routeDatas as $routeData) {
            foreach ($routeData as $item) {
                if (is_string($item)) {
                    // this segment is a static string
                    $segments[] = $item;

                    continue;
                }
                // This segment has a parameter: first element is the name
                if (! array_key_exists($item[0], $substitutions)) {
                    // we don't have a data element for this segment: cancel
                    // testing this routeData item, so that we can try a less
                    // specific routeData item.
                    $segments = [];
                    $segmentName = $item[0];

                    break;
                }
                $segments[] = $substitutions[$item[0]];
            }
            if (! empty($segments)) {
                // we found all the parameters for this route data, no need to check
                // less specific ones
                break;
            }
        }

        if (empty($segments)) {
            throw new InvalidArgumentException('Missing data for URL segment: ' . $segmentName);
        }

        $url = implode('', $segments);

        if ($queryParams) {
            $url .= '?' . http_build_query($queryParams);
        }

        return $url;
    }
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 : '';
    }
458339
protected function generateUrl($name, $parameters = array(), $referenceType = RouterInterface::ABSOLUTE_PATH)
    {
        return $this->router->generate($name, $parameters, $referenceType);
    }