Reverse routing : obtain a complete URL for a named route with passed parameters
@param  array $params The parameter map of the route dynamic values.
@return URL
773690
public function getURL($params = []){
      $params = (array)$params;
      return new URL(rtrim(preg_replace('(/+)','/',preg_replace_callback('(:(\w+))',function($m) use ($params){
        return isset($params[$m[1]]) ? $params[$m[1]].'/' : '';
      },strtr($this->URLPattern,['('=>'',')'=>'']))),'/')?:'/');
    }
257504
private function prepareParametersUrl(array $params, array $allowedParams)
    {
        $allowedParams = array_flip($allowedParams);
        $params = array_intersect_key($params, $allowedParams);

        $paramsUrlItems = [];
        foreach ($params as $key => $param) {
            $paramsUrlItems[] = $key . '=' . urlencode($param);
        }

        $paramsUrl = join('&', $paramsUrlItems);
        if (strlen($paramsUrl) > 0) {
            $paramsUrl = '?' . $paramsUrl;
        }

        return $paramsUrl;
    }
180141
public static function makeUrl(array $params): string
    {
        $href = [];

        foreach ($params as $key => $value) {
            $href[] = static::makeParam($key, (string)$value);
        }

        return '?' . implode('&', $href);
    }
1151581
public function getUrl($name, array $parameters = array())
    {
        return $this->container->get('router.url_generator')->generate($name, $parameters, true);
    }
1175758
public function route($param = null)
    {
        $route = call_user_func($this->getRouteResolver());

        if (is_null($route) || is_null($param)) {
            return $route;
        } else {
            return $route->parameter($param);
        }
    }
661411
protected function get_url( $url, $params ) {
		if ( empty( $params ) ) {
			return $url;
		}
		$q = strpos( $url, '?' ) !== false ? '&' : '?';

		return $url . $q . http_build_query( $params );
	}
1309853
public static function url($page, array $params = [])
    {
        /*
         * Reuse existing controller or create a new one,
         * assuming that the method is called not during the front-end
         * request processing.
         */
        $controller = Controller::getController() ?: new Controller;

        return $controller->pageUrl($page, $params, true);
    }
1108532
protected function makeUrl( array$params ):string
	{
		$url= $this->url;

		foreach( $params['path']??[] as $key=>$value )
		{
			$url= str_replace( "{{$key}}", $value, $url );
		}

		if( $params['query']??null )
		{
			$url.= '?'.http_build_query( $params['query'] );
		}

		return $url;
	}
1142640
protected function urlize($params)
    {
        $string = "";
        foreach ($params as $key => $value) {
            $string .= $key . '=' . urlencode(trim($value)) . '&';
        }
        return rtrim($string, "& ");
    }
483816
private function getNestedParams(array $params)
    {
        $query = http_build_query($params, null, '&');
        $params = explode('&', $query);
        $result = [];

        foreach ($params as $param) {
            list($key, $value) = explode('=', $param, 2);
            $result[urldecode($key)] = urldecode($value);
        }

        return $result;
    }
1215180
public function getRelativeUrl(array $parameters = array())
    {
        $route = $this->request->attributes->get('_route');

        $parameters = array_merge($this->getParameters(), $parameters);

        return $this->router->generate($route, $parameters);
    }
915864
private function queryString($params)
	{
		$querystring = '?';
		foreach($params as $k => $v) {
			$querystring .= $k.'='.urlencode($v).'&';
		}
		return substr($querystring, 0, -1);
	}
288921
public function createUrl(array $parameters = array())
    {
        $final_parameters = $this->getFinalParameters();
        $path = $this->getBaseURL();

        // Override default parameters
        $final_parameters = array_merge($final_parameters, $parameters);

        return $path . "?" . http_build_query($final_parameters, null, '&') . $this->buildFragment();
    }
960303
protected function getRouteUri($name, $params = array())
    {
        // If the route needs additional parameters, we can't add it
        try {
            return $this->router->generate($name, $params, UrlGeneratorInterface::ABSOLUTE_URL);
        } catch (MissingMandatoryParametersException $e) {
            throw new \InvalidArgumentException(
                sprintf(
                    'The route "%s" cannot have the sitemap option because it requires parameters other than "%s"',
                    $name,
                    implode('", "', array_keys($params))
                ),
                0,
                $e
            );
        }
    }
1168524
public function toRoute($name, array $params = [])
    {
        $url = $this->getUrl()->fromRoute($name, $params);

        return $this->toUrl($url);
    }
928756
protected function _getCreateUrlTree(&$params)
    {
        $id = (int)ArrayHelper::getValue($params, 'id');
        $treeModel = ArrayHelper::getValue($params, 'model');

        $dir = ArrayHelper::getValue($params, 'dir');
        $site_code = ArrayHelper::getValue($params, 'site_code');

        ArrayHelper::remove($params, 'id');
        ArrayHelper::remove($params, 'model');

        ArrayHelper::remove($params, 'dir');
        ArrayHelper::remove($params, 'site_code');


        if ($treeModel && $treeModel instanceof Tree) {
            $tree = $treeModel;
            self::$models[$treeModel->id] = $treeModel;

            return $tree;
        }

        if ($id) {
            $tree = ArrayHelper::getValue(self::$models, $id);

            if ($tree) {
                return $tree;
            } else {
                $tree = CmsTree::findOne(['id' => $id]);
                self::$models[$id] = $tree;
                return $tree;
            }
        }


        if ($dir) {
            if (!$site_code && \Yii::$app->cms && \Yii::$app->cms->site) {
                $site_code = \Yii::$app->cms->site->code;
            }

            if ($site_code) {
                $cmsSite = CmsSite::getByCode($site_code);
            }

            if (!$cmsSite) {
                return null;
            }

            $tree = CmsTree::findOne([
                'dir' => $dir,
                'cms_site_id' => $cmsSite->id
            ]);

            if ($tree) {
                self::$models[$id] = $tree;
                return $tree;
            }
        }


        return null;
    }
687552
public static function joinUrlParams($params=[],$removeKeys=[])
    {
        if(!is_array($removeKeys)){
            $removeKeys=[$removeKeys];
        }
        $url="";
        foreach ($params as $k=>$v){
            if(!in_array($k, $removeKeys)){
                $url.="&".$k."=".urlencode($v);
            }
        }
        if(!empty($url)){
            $url=substr($url, 1);
        }
        return $url;
    }