Return url, if key from parameter exists - add parameter value to url

@param array $params

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

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

        return '?' . implode('&', $href);
    }
49339
public function buildAuthUrl(array $params = [])
    {
        $defaultParams = [
            'client_id' => $this->clientId,
            'response_type' => 'code',
            'redirect_uri' => $this->getReturnUrl(),
            'xoauth_displayname' => Yii::$app->name,
            'state' => $this->state,
            'duration' => $this->duration,
        ];
        if (!empty($this->scope)) {
            $defaultParams['scope'] = $this->scope;
        }

        return $this->composeUrl($this->authUrl, array_merge($defaultParams, $params));
    }
362734
public function create_url($url , $param){

        $url .= "?";
        $i = 0;
        foreach ($param as $k=>$v){
            $i++;
            if ($i == count($param)){
                $url .= $k . '=' . $v;
            }else{
                $url .= $k . '=' . $v . '&';
            }

        }

        return $url;
    }
415748
protected function convertParamsToQuery(array $params)
    {
        $query = array();

        foreach ($params as $key => $val) {
            if (is_array($val)) {
                $val = implode(',', $val);
            } elseif ($val instanceof \DateTime) {
                $val = $val->format('Y-m-d');
            } elseif (is_bool($val)) {
                if ($val) {
                    $val = 1;
                } else {
                    continue;
                }
            } else {
                $val = urlencode($val);
            }
            $query[] = $key . '=' . $val;
        }

        return implode('&', $query);
    }
269298
public function buildQuery($params)
	{
		if (!is_array($params) || count($params) == 0)
		{
			return false;
		}

		return urldecode(http_build_query($params, '', '&'));
	}
192170
public function setUrl($params){

		//set the urlInputData
		$this->urlInputData = $params;

		//merge the url data with the whole inputData array
		$this->inputData = $this->Merge($this->inputData, $this->urlInputData);

		//set the urlInputDataSet to true
		$this->urlInputDataSet = true;

		//return this object instance
		return $this;

	}
1348269
public function getUrl(array $params = [])
    {
        $params = $this->getParams($params);
        $constructedUrl = $this->url;
        if (count($params)) {
            $constructedUrl .= '?';
            foreach ($params as $key => $val) {
                $constructedUrl .= $key . '=' . $val . '&';
            }
            $constructedUrl = substr($constructedUrl, 0, -1);
        }
        return $constructedUrl;
    }
1358913
protected function buildUrl($uri, $params)
    {
        $host = $this->buildHostString();

        if (strpos($uri, "/") !== 0) {
            $uri = "/" . $uri;
        }

        $url = $host . $uri;


        if ($params === null) {
            $params = array();
        }

        $url .= $this->buildQueryString($params);

        return $url;
    }
856730
private function buildUrl($method, $params)
    {
        $url = $this->address.$method;

        return $url."?".http_build_query($params);
    }
856956
public static function appendParamsToUrl($url, $params)
    {
        if (empty($params)) {
            return $url;
        }

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

        return $url . '?' . $getParams;
    }
1369281
protected function getPathParams(array $params = []): string
    {
        if (empty($params)) {
            return '';
        }
        $path = $params['path'] ?? [];
        if (is_string($path)) {
            return $path;
        }
        $path = collect($path)->map(function ($entry) {
            return (string) $entry;
        })->all();
        return implode('/', $path);
    }
308006
private static function getCacheKeyForCall(array $params)
    {
        static $domainLevel = null;

        $params += $_GET;
        $keyStr = '';
        foreach ($params as $param) {
            $keyStr .= serialize($param);
        }

        $keyStr .= Request::domainPrefix(
            $domainLevel ?? $domainLevel = count(explode('.', Config::application('domain')))
        );

        return md5($keyStr);
    }
219535
public function put($url, array $params = [])
    {
        return $this->request($this->createUrl($url), self::METHOD_PUT, $params);
    }
516998
protected function appendParamsToUrl(string $url, array $params): string
    {
        if (empty($params['_fields'])) {
            unset($params['_fields']);
        }

        if (empty($params)) {
            return $url;
        }

        // If the _fields param is set transform it to a single string so that
        // it's not urlencoded as an array
        if (isset($params['_fields']) && \is_array($params['_fields'])) {
            $params['_fields'] = array_unique(array_merge($params['_fields'], ['id']));
            $params['_fields'] = implode(',', $params['_fields']);
        }

        // If there is no question mark in the URL we can just add the params
        // to the query string and exit early
        if (strpos($url, '?') === false) {
            return $url . '?' . http_build_query($params, '', '&');
        }

        list($path, $query) = explode('?', $url, 2);

        parse_str($query, $existingParams);

        $params = array_merge($params, $existingParams);

        return $path . '?' . http_build_query($params, '', '&');
    }
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,['('=>'',')'=>'']))),'/')?:'/');
    }
53158
public function getUrl($params): string
    {
        // prepare params
        $params = $this->getParams($params);

        // retrieve URL
        return Router::getUrl(
            $this->getModule(),
            $this->getController(),
            $params
        );
    }
135672
public static function host(array $params = []) : string {
		$protocol = !empty($params['protocol']) ? $params['protocol'] : '';
		$port = !empty($params['port']) ? (':' . $params['port']) : '';
		if (!$protocol) $protocol = self::isSSL() ? 'https' : 'http';
		if (!empty($params['host_parts'])) {
			$host = implode('.', $params['host_parts']);
		} else {
			$host = !empty($params['ip']) ? (getenv('SERVER_ADDR') . ':' . getenv('SERVER_PORT')) : getenv('HTTP_HOST');
		}
		if (!empty($params['level3'])) {
			$host = str_replace('www.', '', $host);
			$host = @$params['level3'] . '.' . $host;
		}
		$result = $protocol . '://' . $host . $port . (!empty($params['request']) ? $_SERVER['REQUEST_URI'] : '/');
		// append mvc
		if (!empty($params['mvc'])) {
			$result = rtrim($result, '/') . $params['mvc'];
		}
		// append parameters
		if (!empty($params['params'])) {
			$result.= '?' . http_build_query2($params['params']);
		}
		return $result;
	}