Url builder helper

@param String $mode
@param array  $params

@return string
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);
    }
167047
public function url($path, array $params = [])
    {
        $urlBuilder = UrlBuilderFactory::create($this->config['base_url'], $this->config['sign_key']);

        return $urlBuilder->getUrl($path, $params);
    }
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;
	}
778963
public function getIndexUrl(array $params = array(), array $options = array())
    {
        return $this->url()->fromRoute($this->getEvent()->getRouteMatch()->getMatchedRouteName(),
            array_merge(array('action' => 'index'), $params),
            $options
        );
    }
1059463
public function queryString($params = [], $format = null) {
		$result = [];
		$query = [];

		foreach (array_filter([$this->query, $params]) as $querySet) {
			if (is_string($querySet)) {
				$result[] = $querySet;
				continue;
			}
			$query = array_merge($query, $querySet);
		}
		$query = array_filter($query);

		if ($format) {
			$q = null;
			foreach ($query as $key => $value) {
				if (!is_array($value)) {
					$q .= Text::insert($format, [
						'key' => urlencode($key),
						'value' => urlencode($value)
					]);
					continue;
				}
				foreach ($value as $val) {
					$q .= Text::insert($format, [
						'key' => urlencode("{$key}[]"),
						'value' => urlencode($val)
					]);
				}
			}
			$result[] = substr($q, 0, -1);
		} else {
			$result[] = http_build_query($query);
		}

		$result = array_filter($result);
		return $result ? "?" . join("&", $result) : null;
	}
454223
public function buildParameter(array $params)
	{
		$path = '';

		foreach ($params as $param)
		{
			$path .= $param;

			if (next($params) == true)
			{
				$path .= '|';
			}
		}

		return $path;
	}
37331
public function findSiteBy(array $params, $mode = AbstractQuery::HYDRATE_OBJECT)
    {
        /** @var $query QueryBuilder */
        $qb = $this->getFindByQueryBuilder($params, null, 'e');
        $qb->addSelect('x,y,z,a,l')
            ->innerJoin('e.siteType', 'x')
            ->leftJoin('e.parent', 'z')
            ->leftJoin('e.subDomains', 'a')
            ->leftJoin('e.linkedSites', 'l')
            ->leftJoin('e.rootPage', 'y');

        if ($mode != AbstractQuery::HYDRATE_OBJECT) {
            $qb->setEnableHydrationCache($this->isEnableResultCache());
        }

        $site = $qb->getQuery()->getOneOrNullResult($mode);

        return $site;
    }
492361
private function buildUri($uri, $params)
    {
        $parse_url = parse_url($uri);

        // Add our params to the parsed uri
        foreach ( $params as $k => $v ) {
            if (isset($parse_url[$k])) {
                $parse_url[$k] .= "&" . http_build_query($v);
            } else {
                $parse_url[$k] = http_build_query($v);
            }
        }

        // Put humpty dumpty back together
        return
            ((isset($parse_url["scheme"])) ? $parse_url["scheme"] . "://" : "")
            . ((isset($parse_url["user"])) ? $parse_url["user"]
            . ((isset($parse_url["pass"])) ? ":" . $parse_url["pass"] : "") . "@" : "")
            . ((isset($parse_url["host"])) ? $parse_url["host"] : "")
            . ((isset($parse_url["port"])) ? ":" . $parse_url["port"] : "")
            . ((isset($parse_url["path"])) ? $parse_url["path"] : "")
            . ((isset($parse_url["query"])) ? "?" . $parse_url["query"] : "")
            . ((isset($parse_url["fragment"])) ? "#" . $parse_url["fragment"] : "")
        ;
    }
106357
protected function buildUrl($parts, $params)
    {
        $url = '';

        if (isset($parts['host'])) {
            if ($this->isRelativeDomain) {
                $url .= '//'.$parts['host'];
            } else {
                $url .= $parts['scheme'].'://'.$parts['host'];
            }

            if (isset($parts['port'])) {
                $url .= ':'.$parts['port'];
            }
        }

        $url .= $parts['path'];

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

        return $url;
    }
3404
public URL buildUrl(final TmdbParameters params) {
        StringBuilder urlString = new StringBuilder(TMDB_API_BASE);

        LOG.trace("Method: '{}', Sub-method: '{}', Params: {}", method.getValue(), submethod.getValue(),
                ToStringBuilder.reflectionToString(params, ToStringStyle.SHORT_PREFIX_STYLE));

        // Get the start of the URL, substituting TV for the season or episode methods
        if (method == MethodBase.SEASON || method == MethodBase.EPISODE) {
            urlString.append(MethodBase.TV.getValue());
        } else {
            urlString.append(method.getValue());
        }

        // We have either a queury, or a ID request
        if (params.has(Param.QUERY)) {
            urlString.append(queryProcessing(params));
        } else {
            urlString.append(idProcessing(params));
        }

        urlString.append(otherProcessing(params));

        try {
            LOG.trace("URL: {}", urlString.toString());
            return new URL(urlString.toString());
        } catch (MalformedURLException ex) {
            LOG.warn("Failed to create URL {} - {}", urlString.toString(), ex.getMessage());
            return null;
        }
    }
968731
public function getHrefWithDoAppend(array $params): string
    {
        $href = [];
        $href[] = static::makeParam('p', $this->p);
        $href[] = $this->parseParameter('do', $this->do == '_default' ? '' : $this->do, $params);

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

        return '?' . implode('&', $href);
    }
183429
protected static function _buildWriteParams($params = array()) {
		$writeParams['equalKeysOnly'] = (
			isset($params['equalKeysOnly']) &&
			empty($params['equalKeysOnly']) ? false : true
		);

		return $writeParams;
	}
719977
public static function url($url, $params = null)
    {
        if (!is_array($params) || count($params) < 1) {
            return $url;
        }

        $pos = strpos($url, "?");

        # If there is no question mark in the url then set this as the first parameter
        if ($pos === false) {
            $url .= "?";

        # If the question mark is the last character then no appending is required
        } elseif ($pos != (mb_strlen($url) - 1)) {

            # If the last character is not an ampersand then append one
            if (mb_substr($url, -1) != "&") {
                $url .= "&";
            }
        }

        $url .= http_build_query($params);

        return $url;
    }
1147590
protected function getUrl($entity, $mode)
    {
        return $this->generateUrl($this->route_name.$mode, array('id' => $entity->getId()));
    }
880069
private function buildUrlByMethodName($method, array $parameters)
    {
        $url = $this
            ->apiUrls
            ->$method();

        return $this->host
            ? $this->buildUrlWithHost(
                $url,
                $parameters
            )
            : $this->buildUrlWithoutHost(
                $url,
                $parameters
            );
    }
469197
public function buildAuthUrl(array $params = [])
    {
        $defaultParams = [
            'appid' => $this->clientId,
            'response_type' => 'code',
            'redirect_uri' => $this->getReturnUrl(),
        ];
        if (!empty($this->scope)) {
            $defaultParams['scope'] = $this->scope;
        }

        if ($this->validateAuthState) {
            $authState = $this->generateAuthState();
            $this->setState('authState', $authState);
            $defaultParams['state'] = $authState;
        }

        return $this->composeUrl($this->authUrl, array_merge($defaultParams, $params));
    }
148799
public function buildUrl($method = '', $params = '', $append = true)
    {
        return $this->bbbServerBaseUrl . 'api/' . $method . ($append ? '?' . $this->buildQs($method, $params) : '');
    }