Construct encoded URI string from an array

@param array $parameters
@return string
340122
protected function encode(array $parameters)
    {
        $uri = '';

        if ($parameters) {
            foreach ($parameters as $parameter => $value) {
                $uri .= $parameter . '=' . urlencode(stripslashes($value)) . '&';
            }
        }

        $uri = substr($uri, 0, strlen($uri)-1);

        return $uri;
    }
1023385
private function parameters($parameters): array
    {
        $values = (!is_array($parameters)) ? [$parameters] : $parameters;

        $strings = [];

        foreach ($values as $value) {
            $strings[] = self::make($value, $this->encoding);
        }

        return $strings;
    }
892328
private function baseString($url, $method, $parameters)
	{
		// Sort the parameters alphabetically
		uksort($parameters, 'strcmp');

		// Encode parameters.
		foreach ($parameters as $key => $value)
		{
			$key = $this->safeEncode($key);

			if (\is_array($value))
			{
				foreach ($value as $k => $v)
				{
					$v    = $this->safeEncode($v);
					$kv[] = "{$key}={$v}";
				}
			}
			else
			{
				$value = $this->safeEncode($value);
				$kv[]  = "{$key}={$value}";
			}
		}

		// Form the parameter string.
		$params = implode('&', $kv);

		// Signature base string elements.
		$base = array(
			$method,
			$url,
			$params,
		);

		// Return the base string.
		return implode('&', $this->safeEncode($base));
	}
680819
protected function url($path, array $parameters = null)
    {
    	$query = [
            'client_id' => $this->client_key,
    	    'redirect_uri' => $this->redirect_uri,
    	    'response_type' => 'code'
    	];

        if ($parameters)
            $query = array_merge($query, $parameters);

        $query = http_build_query($query);

        return sprintf('%s%s?%s', self::API_HOST, $path, $query);
    }
193854
protected function build(array $parameters)
    {
        $route    = preg_split('`([/.-])`', $this->route, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
        $regex    = array();
        $position = 0;

        foreach ($route as $index => $element) {
            switch ($element) {
                case '.':
                    $regex[$element . '-' . $index] = '\\' . $element;
                    break;
                case '/':
                case '-':
                    $regex[$element . '-' . $index] = $element;
                    break;

                default:

                    if (':' === substr($element, 0, 1)) {
                        $elementName = substr($element, 1);
                        $position++;

                        if (!isset($parameters[$elementName])) {
                            $parameters[$elementName] = new Parameter($elementName);
                        }

                        $regex[$elementName] = '(' . $parameters[$elementName]->getType() . ')';

                        $this->parameterCollection->add($parameters[$elementName]);
                    } else {
                        $regex[$element] = $element;
                    }
            }
        }

        $this->pattern = '`^' . implode('', $regex) . '$`i';
    }
866137
public static function buildUri($uri, array $replaceParams)
    {
        $encoded = array();
        foreach ($replaceParams as $index => $param) {
            $encoded[$index] = urlencode($param);
        }
        return strtr($uri, $encoded);
    }
438393
private function buildDirectiveParameters($parameters = array())
    {
        $result = array();

        foreach ($parameters as $key => $value) {
            $result[] = $key.'="'.$value.'"';
        }

        return implode(',', $result);
    }
1078218
public function formatParameters($parameters)
    {
        $parameters = Arr::wrap($parameters);

        foreach ($parameters as $key => $parameter) {
            if ($parameter instanceof UrlRoutable) {
                $parameters[$key] = $parameter->getRouteKey();
            }
        }

        return $parameters;
    }
690258
protected function buildDSNString(array &$parameters)
    {
        $dsn = [];
        foreach ($this->keys as $keyName) {
            if (\array_key_exists($keyName, $parameters) && \strlen($parameters[$keyName]) > 0) {
                $dsn[] = "{$keyName}={$parameters[$keyName]}";
            }
        }

        return \implode(";", $dsn);
    }
89144
public function formatUrl(array $parameters = []): string
    {
        $values = [];

        foreach ($this->parameterNames as $name) {
            if (!isset($parameters[$name])) {
                throw new \InvalidArgumentException("Missing route parameter '$name'");
            }

            $values[] = rawurlencode($parameters[$name]);
            unset($parameters[$name]);
        }

        if (!empty($parameters)) {
            throw new \InvalidArgumentException(
                'Unexpected route parameters: ' . implode(', ', array_keys($parameters))
            );
        }

        return vsprintf($this->format, $values);
    }
1101228
protected function prepareGet(array $parameters)
    {
        // Make a signable string
        $signable = http_build_query($parameters, null, '&');

        // Return the URL with the parameters
        return '?' . $signable . '&s=' . $this->makeSignature($signable);
    }
1134569
public function getUri($params = array())
    {
        $uri = $this->route;

        if (!empty($params)) {
            $uri = str_replace(array_keys($params), $params, $this->route);
        }

        return $uri;
    }
136815
public static function replaceDataUriParameters($uri, string $parameters)
    {
        $uri = self::filterUri($uri);

        return self::normalizePath($uri, (new DataPath($uri->getPath()))->withParameters($parameters));
    }
686494
protected function encode($method, array $parameters = [])
    {
        $this->encoder = $this->encoder ?: new XmlrpcEncoder();

        return $this->encoder->encodeCall($method, $parameters);
    }
1207445
protected function encodeParams(array $params = [], $quoted = false)
    {
        $encoded = [];

        foreach ($params as $key => $value) {
            if ($quoted) {
                $encodedValue = '"' . $this->urlencodeRfc3986($value) . '"';
            } else {
                $encodedValue = $this->urlencodeRfc3986($value);
            }
            $encoded[] = $this->urlencodeRfc3986($key) . '=' . $encodedValue;
        }

        return $encoded;
    }
877949
public function get($uri, $parameters = array())
    {
        return $this->request(self::METHOD_GET, $this->getUrl($uri), $parameters);
    }
549973
public function generateUrl(string $name, array $parameters = []): string
    {
        $definition = $this->provider->getRouteDefinitionByName($name);
        return $definition->formatUrl($parameters);
    }