Builds url from associative array produced by parse_str() function

@param array $parsedUrl
@return string
503415
protected function buildUrl($parsedUrl)
    {
        return (isset($parsedUrl['scheme'])   ?     $parsedUrl["scheme"].'://' : '').
               (isset($parsedUrl['user'])     ?     $parsedUrl["user"].':'     : '').
               (isset($parsedUrl['pass'])     ?     $parsedUrl["pass"].'@'     : '').
               (isset($parsedUrl['host'])     ?     $parsedUrl["host"]         : '').
               (isset($parsedUrl['port'])     ? ':'.$parsedUrl["port"]         : '').
               (isset($parsedUrl['path'])     ?     $parsedUrl["path"]         : '').
               (isset($parsedUrl['query'])    ? '?'.$parsedUrl["query"]        : '').
               (isset($parsedUrl['fragment']) ? '#'.$parsedUrl["fragment"]     : '');
    }
69551
protected function buildUrl($url)
    {
        if (strpos($url, '://') || 0 === strpos($url, '/')) {
            return $url;
        } elseif ($url === '') {
            return $url;
        } else {
            return Url::build($url);
        }
    }
943257
public function build_url( $url, $options = array() ) {

		$url = (array) $url;

		$allow_port = (int) pods_v( static::$type . '_allow_port', $options, 0 );

		// If port is not allowed, always set to empty
		if ( 0 === $allow_port ) {
			$url['port'] = '';
		}

		if ( function_exists( 'http_build_url' ) ) {
			return http_build_url( $url );
		}

		$defaults = array(
			'scheme'   => 'http',
			'host'     => '',
			'port'     => '',
			'path'     => '/',
			'query'    => '',
			'fragment' => '',
		);

		$url = array_merge( $defaults, $url );

		$new_url = array();

		$new_url[] = trim( $url['scheme'] . '://', ':' );
		$new_url[] = $url['host'];

		if ( ! empty( $url['port'] ) ) {
			$new_url[] = ':' . $url['port'];
		}

		$new_url[] = '/' . ltrim( $url['path'], '/' );

		if ( ! empty( $url['query'] ) ) {
			$new_url[] = '?' . ltrim( $url['query'], '?' );
		}

		if ( ! empty( $url['fragment'] ) ) {
			$new_url[] = '#' . ltrim( $url['fragment'], '#' );
		}

		// Pull all of the parts back together
		$new_url = implode( '', $new_url );

		return $new_url;

	}
78794
private function buildLinkHeaderString ($url)
    {
        $linkTypeMap = [
            '.CSS'  => 'style',
            '.JS'   => 'script',
            '.BMP'  => 'image',
            '.GIF'  => 'image',
            '.JPG'  => 'image',
            '.JPEG' => 'image',
            '.PNG'  => 'image',
            '.TIFF' => 'image',
        ];
        $type        = (new Collection($linkTypeMap))->first(function ($type, $extension) use ($url) {
            return $this->contains(strtoupper($url), $extension);
        });

        return is_null($type) ? null : "<{$url}>; rel=preload; as={$type}";
    }
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;
    }
152242
function buildURL( $urlPartsArray )
    {
        $url = "";
        foreach( $urlPartsArray as $urlPart )
        {
            if ( $url == "" )
            {
                $url = $urlPart;
                continue;
            }
            
            // Detect trailing /
            if ( ( strrpos( $url, "/" ) + 1 ) == strlen( $url ) )
            {
                $url .= $urlPart;
            }
            else
            {
                $url .= "/" . $urlPart;
            }   
        }
        return $url;
    }
333273
protected function normalizeUrl($url, array $parameters = [])
    {
        $normalizedUrl = $url;
        if (!empty($parameters)) {
            $normalizedUrl .= (false !== strpos($url, '?') ? '&' : '?').http_build_query($parameters, '', '&');
        }

        return $normalizedUrl;
    }
248596
private function buildUrl(array $url, array $params = array())
    {
        ksort($params);
        $url['query'] = http_build_query($params, '', '&');

        $scheme   = isset($url['scheme']) ? $url['scheme'].'://' : '';
        $host     = isset($url['host']) ? $url['host'] : '';
        $port     = isset($url['port']) ? ':'.$url['port'] : '';
        $user     = isset($url['user']) ? $url['user'] : '';
        $pass     = isset($url['pass']) ? ':'.$url['pass']  : '';
        $pass     = ($user || $pass) ? $pass . '@' : '';
        $path     = isset($url['path']) ? $url['path'] : '';
        $query    = isset($url['query']) && $url['query'] ? '?'.$url['query'] : '';
        $fragment = isset($url['fragment']) ? '#'.$url['fragment'] : '';

        return $scheme.$user.$pass.$host.$port.$path.$query.$fragment;
    }
486994
public static function multibyteParseUrl($url)
    {
        $enc_url = preg_replace_callback(
            '%[^:/@?&=#]+%usD',
            function ($matches) {
                return urlencode($matches[0]);
            },
            $url
        );

        $parts = parse_url($enc_url);

        if($parts === false) {
            throw new \InvalidArgumentException('Malformed URL: ' . $url);
        }

        foreach($parts as $name => $value) {
            $parts[$name] = urldecode($value);
        }

        return $parts;
    }
916023
protected function mbParseUrl($url)
  {
    $enc_url = preg_replace_callback(
      '%[^:/@?&=#]+%usD',
      function ($matches) {
        return urlencode($matches[0]);
      },
      $url
    );

    if ($parts = parse_url($enc_url)) {
      foreach ($parts as $name => $value) {
        $parts[$name] = urldecode($value);
      }
    }

    return $parts;
  }
1193931
private function buildUrl($url)
    {
        $url = $this->protocol . '://' . $url . '/';

        if ($this->date) {
            $url .= $this->date;
        } else {
            $url .= 'latest';
        }

        $url .= '?base=' . $this->base;

        if ($this->key) {
            $url .= '&access_key=' . $this->key;
        }

        if ($symbols = $this->symbols) {
            $url .= '&symbols=' . implode(',', $symbols);
        }

        return $url;
    }
419492
private function buildUrl($url)
    {
        // URI template (absolute or relative)
        if (!is_array($url)) {
            return strpos($url, '://')
                ? (string) $url
                : (string) $this->baseUrl->combine($url);
        }

        if (!isset($url[1])) {
            throw new \InvalidArgumentException('You must provide a hash of '
                . 'varname options in the second element of a URL array.');
        }

        // Absolute URL
        if (strpos($url[0], '://')) {
            return Utils::uriTemplate($url[0], $url[1]);
        }

        // Combine the relative URL with the base URL
        return (string) $this->baseUrl->combine(
            Utils::uriTemplate($url[0], $url[1])
        );
    }
514654
protected static function parseUrl($url)
    {
        $url_parts = Utils::multibyteParseUrl($url);

        if (isset($url_parts['scheme'])) {
            /** @var UniformResourceLocator $locator */
            $locator = Grav::instance()['locator'];

            // Special handling for the streams.
            if ($locator->schemeExists($url_parts['scheme'])) {
                if (isset($url_parts['host'])) {
                    // Merge host and path into a path.
                    $url_parts['path'] = $url_parts['host'] . (isset($url_parts['path']) ? '/' . $url_parts['path'] : '');
                    unset($url_parts['host']);
                }

                $url_parts['stream'] = true;
            }
        }

        return $url_parts;
    }
106624
public static function url($url) {
		if (
			is_array($url)
			|| (is_string($url) && (preg_match('@^' . implode('|', Common::$uriSchemes) . ':@i', $url) || preg_match('@^#@i', $url)))
		) {
			return $url;
		}

		// Reset current language that gets changed by `I18n.I18nRoute::parse()`.
		$reset = Configure::check('Config.language') && $lang = Configure::read('Config.language');
		$parsed = Router::parse($url);
		if ($reset) Configure::write('Config.language', $lang);

		if ($parsed === false) {
			return $url;
		}

		if (!empty($parsed['pass'])) {
			$parsed = array_merge($parsed, $parsed['pass']);
			unset($parsed['pass']);
		}

		if (!empty($parsed['named'])) {
			foreach ($parsed['named'] as $param => $val) {
				$parsed[$param] = $val;
			}
			unset($parsed['named']);
		}

		if (array_key_exists('lang', $parsed) && strpos($url, $parsed['lang']) !== 1) {
			unset($parsed['lang']);
		}

		return $parsed;
	}
824845
public static function preprocess($url_parsed) {
        if (preg_match('/\/([^\/]+)\.(rm|rmvb)$/i', $url_parsed['path'], $matches) == 1) {
            $filename = htmlspecialchars($matches[1] . '.' . $matches[2]);
            $extension = strtolower($matches[2]);
            return array(
                'filetype' => $extension,
                'url' => URL::build($url_parsed),
            );
        }
        return FALSE;
    }
461096
protected function parseUrl($url)
    {
        if (strpos($url, '//') === 0) {
            $url = "http:$url";
        }

        $this->info = parse_url($url);

        if (isset($this->info['query'])) {
            parse_str($this->info['query'], $this->info['query']);

            array_walk_recursive($this->info['query'], function (&$value) {
                $value = urldecode($value);
            });
        }

        if (isset($this->info['path'])) {
            $this->setPath($this->info['path']);
        }
    }
1065949
public static function build($url_parsed) {

        // add default values to prevent empty
        $url_parsed = (array) $url_parsed + array(
            'scheme' => '',
            'host' => '',
            'port' => '',
            'user' => '',
            'pass' => '',
            'path' => '',
            'query' => '',
            'fragment' => '',
        );

        $url = '';

        // add components that depends on host
        if (!empty($url_parsed['host'])){

            // scheme
            $url = empty($url_parsed['scheme']) ?
                '//' : $url_parsed['scheme'].'://';

            // components that depends on user
            if (!empty($url_parsed['user'])) {
                $url .= empty($url_parsed['pass']) ?
                    $url_parsed['user'] :
                    $url_parsed['user'] . ':' . $url_parsed['pass'] ;
                $url .= '@';
            }

            // host
            $url .= $url_parsed['host'];

            // port
            $url .= empty($url_parsed['port']) ?
                '' : ':' . ((int) $url_parsed['port']);

        }

        // path
        $url .= empty($url_parsed['path']) ?
            '' : $url_parsed['path'];

        // query
        $url .= empty($url_parsed['query']) ?
            '' : '?' . $url_parsed['query'];

        // fragment
        $url .= empty($url_parsed['fragment']) ? 
            '' : '#' . $url_parsed['fragment'];

        return $url;

    }