Create an URL based on an router alias

@param string		$alias
@param array  	$params
@param bool		$retain		Should we keep the get parameters?
@return string
168574
public static function alias( $alias, $params = array(), $retain = false )
	{
		$route_params = array();
		
		// to handle the suffix after a slash in an alias define
		$suffix = '';
		
		if ( strpos( $alias, '/' ) !== false && $alias !== '/' )
		{
			// slashes in aliases get appended as suffix
			list( $alias, $suffix ) = explode( '/', $alias );
			
			$suffix = '/'.$suffix;
		}
	

		// get the parameters with the numeric keys so we can 
		// pass them as route parameters like [any]-[num]-[num]/[any]/
		foreach( $params as $key => $value )
		{
			if ( is_int( $key ) )
			{
				$route_params[] = $value; unset( $params[$key] );
			}
		}

		return CCUrl::to( CCRouter::alias( $alias, $route_params ).$suffix, $params, $retain );
	}
661411
protected function get_url( $url, $params ) {
		if ( empty( $params ) ) {
			return $url;
		}
		$q = strpos( $url, '?' ) !== false ? '&' : '?';

		return $url . $q . http_build_query( $params );
	}
150499
private function buildUrlWithoutHost($url, array $parameters)
    {
        return $this
            ->urlGeneratorInterface
            ->generate(
                $url,
                $parameters,
                UrlGeneratorInterface::ABSOLUTE_URL
            );
    }
431759
private function buildUrl($mode, $params = [])
    {
        $urlParams = array_merge(['mode' => $mode, 'apikey' => $this->apiKey, 'output' => 'json'], $params);
        return 'http://' . $this->url . ':' . $this->port . "/api?" . http_build_query($urlParams);
    }
1162909
public function getUrl($service, $url, $params = [])
    {
        if (!empty($this->stubs[$service])) {
            $tokens = [];
            $params['url'] = $url;
            foreach ($this->tokens as $token) {
                $tokens['/{' . $token . '}/'] = urlencode(
                    !empty($params[$token]) ? $params[$token] : ''
                );
            }
            return preg_replace(array_keys($tokens), $tokens, $this->stubs[$service]);
        }
    }
455520
public function updateURLWithParameters($url, array $params)
    {
        if (empty($params)) {
            return $url;
        }

        $parts = parse_url($url);

        $scheme = isset($parts['scheme']) ? $parts['scheme'] : null;
        if ($scheme) {
            $scheme .= ':';
        }

        $host = isset($parts['host']) ? $parts['host'] : null;
        if ($host) {
            $host = "//$host";
        }
        $path = isset($parts['path']) ? $parts['path'] : null;

        //Merge parameters
        $query = isset($parts['query']) ? $parts['query'] : null;
        $params += $this->getParameterFromQuery($query);
        if (!empty($params)) {
            $query = '?' . http_build_query($params);
        }

        $fragment = isset($parts['fragment']) ? $parts['fragment'] : null;
        if ($fragment) {
            $fragment = "#$fragment";
        }

        return "{$scheme}{$host}{$path}{$query}$fragment";
    }
1092803
function reroute($url=NULL,$permanent=FALSE,$die=TRUE) {
		if (!$url)
			$url=$this->hive['REALM'];
		if (is_array($url))
			$url=call_user_func_array([$this,'alias'],$url);
		elseif (preg_match('/^(?:@?([^\/()?]+)(?:(\(.+?)\))*(\?.+)*)/',
			$url,$parts) &&
			isset($this->hive['ALIASES'][$parts[1]]))
			$url=$this->hive['ALIASES'][$parts[1]];
		$url=$this->build($url,isset($parts[2])?$this->parse($parts[2]):[]).
			(isset($parts[3])?$parts[3]:'');
		if (($handler=$this->hive['ONREROUTE']) &&
			$this->call($handler,[$url,$permanent,$die])!==FALSE)
			return;
		if ($url[0]!='/' && !preg_match('/^\w+:\/\//i',$url))
			$url='/'.$url;
		if ($url[0]=='/' && (empty($url[1]) || $url[1]!='/')) {
			$port=$this->hive['PORT'];
			$port=in_array($port,[80,443])?'':(':'.$port);
			$url=$this->hive['SCHEME'].'://'.
				$this->hive['HOST'].$port.$this->hive['BASE'].$url;
		}
		if ($this->hive['CLI'])
			$this->mock('GET '.$url.' [cli]');
		else {
			header('Location: '.$url);
			$this->status($permanent?301:302);
			if ($die)
				die;
		}
	}
856956
public static function appendParamsToUrl($url, $params)
    {
        if (empty($params)) {
            return $url;
        }

        $getParams =  http_build_query($params, null, '&');

        return $url . '?' . $getParams;
    }
389972
public static function url($route = '', Array $params = [])
    {
        $dir = dirname($_SERVER['PHP_SELF']);
        $dir = $dir == DIRECTORY_SEPARATOR ? '':$dir;
        $scheme = isset($_SERVER['HTTPS']) && 'on' === $_SERVER['HTTPS'] ? 'https':'http';
        $baseUrl = $scheme.'://'.$_SERVER['HTTP_HOST'].$dir.'/?r='.$route;
        return empty($params) ? $baseUrl : $baseUrl . '&' . http_build_query($params);
    }
81535
public function createUrl(string $action, ?DataMap $params = null, bool $isFullUrl = false, array $fullUrlInfo = []): string
    {
        list ($moduleName, $controllerName, $actionName) = Application::$app->getFullAction($action);
        $resourcePath = $this->routeHandler->createUrl($moduleName, $controllerName, $actionName, $params);
        return $this->getPublicUrl($resourcePath, $isFullUrl, $fullUrlInfo);
    }
836017
public function url($action, $params=[]) {
		if(is_array($action))
			return $this->resolver->url($action, $params);
		else
			return $this->resolver->url([get_called_class(), $action], $params);
	}
931542
private function buildQueryUrl($params)
    {
        $url = parse_url($_SERVER['REQUEST_URI']);
        if (! array_key_exists('query', $url)) {
            $url['query'] = '';
        }
        parse_str($url['query'], $url['query']);
        if (! is_array($url['query'])) {
            $url['query'] = array();
        }
        // Remove 'start parameter if it exists
        if (array_key_exists('start', $url['query'])) {
            unset($url['query']['start']);
        }
        // Add extra parameters from argument
        $url['query'] = array_merge($url['query'], $params);
        $url['query'] = http_build_query($url['query']);
        $url = $url['path'] . ($url['query'] ? '?'.$url['query'] : '');
        
        return $url;
    }
670991
function reroute($url=NULL,$permanent=FALSE) {
		if (!$url)
			$url=$this->hive['REALM'];
		if (preg_match('/^(?:@(\w+)(?:(\(.+?)\))*)/',$url,$parts)) {
			if (empty($this->hive['ALIASES'][$parts[1]]))
				user_error(sprintf(self::E_Named,$parts[1]),E_USER_ERROR);
			$url=$this->hive['ALIASES'][$parts[1]];
		}
		$url=$this->build($url,
			isset($parts[2])?$this->parse($parts[2]):array());
		if (($handler=$this->hive['ONREROUTE']) &&
			$this->call($handler,array($url,$permanent))!==FALSE)
			return;
		if ($url[0]=='/')
			$url=$this->hive['BASE'].$url;
		if (PHP_SAPI!='cli') {
			header('Location: '.$url);
			$this->status($permanent?301:302);
			die;
		}
		$this->mock('GET '.$url);
	}
540857
final public function urlFor($routeName, array $params = array())
    {
        if (null === $this->router) {
            return '';
        }

        return $this->router->urlFor($routeName, $params);
    }
197526
def make_alias_redirect_url(self, path, endpoint, values, method, query_args):
        """"""
        url = self.build(endpoint, values, method, append_unknown=False,
                         force_external=True)
        if query_args:
            url += '?' + self.encode_query_args(query_args)
        assert url != path, 'detected invalid alias setting.  No canonical ' \
               'URL found'
        return url
1267147
public static function url($uri,$param=[])
    {
        if(!is_object(self::$ds)){
            self::$ds=new Register();
        }
        return self::$ds->url($uri,$param);
    }
1051576
public function getRoute(string $routeKey, array $params = []): string
    {
        $this->checkRouteIsDefined($routeKey);

        return route(
            $this->getAttribute('routes')[$routeKey]['alias'],
            array_merge($this->getAttribute('routes')[$routeKey]['parameters'], $params)
        );
    }