Creates an url from string
@param string $url
@return Url
546632
public static function FromString($url)
    {
        $parts = \parse_url($url);
        $scheme = isset($parts['scheme']) ? $parts['scheme'] : '';
        $host = isset($parts['host']) ? $parts['host'] : '';
        $port = isset($parts['port']) ? $parts['port'] : '';
        $user = isset($parts['user']) ? $parts['user'] : '';
        $password = isset($parts['pass']) ? $parts['pass'] : '';
        $path = isset($parts['path']) ? $parts['path'] : '';
        $query = isset($parts['query']) ? $parts['query'] : '';
        $fragment = isset($parts['fragment']) ? $parts['fragment'] : '';
        return new self($scheme, $host, $port, $user, $password, $path, $query, $fragment);
    }
623194
private function buildUrl($url)
    {
        if (!is_array($url)) {
            if (strpos($url, '://')) {
                return (string) $url;
            }
            return (string) $this->baseUrl->combine($url);
        } elseif (strpos($url[0], '://')) {
            return \GuzzleHttp\uri_template($url[0], $url[1]);
        }

        return (string) $this->baseUrl->combine(
            \GuzzleHttp\uri_template($url[0], $url[1])
        );
    }
1181737
protected function parseStringUrl(?string $url) : string
    {
        $parts = parse_url($url);

        if (isset($parts['query'])) {
            parse_str($parts['query'], $query);
        }

        return $this->create(
            $parts['scheme'] ?? null,
            $parts['host'] ?? null,
            $parts['path'] ?? null,
            $query ?? null,
            $parts['fragment'] ?? null,
            (Str::endsWith($url, '/')
                && (isset($parts['path'])
                    && ($parts['path'] !== '/' || !empty($parts['path']))) )
        );
    }
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;
    }
62700
public static function normalizeURL($url)
  {
    $url_parts = self::splitURL($url);
    
    if ($url_parts == null) return null;
    
    $url_normalized = self::buildURLFromParts($url_parts, true);
    return $url_normalized;
  }
1004014
protected function createUri($url)
	{
		if ($url instanceof Uri)
		{
			return $url;
		}

		// Create full URL if we are only appending variables to it
		if (substr($url, 0, 1) == '&')
		{
			$vars = array();

			if (strpos($url, '&amp;') !== false)
			{
				$url = str_replace('&amp;', '&', $url);
			}

			parse_str($url, $vars);

			$vars = array_merge($this->vars(), $vars);

			foreach ($vars as $key => $var)
			{
				if ($var == '')
				{
					unset($vars[$key]);
				}
			}

			$url = 'index.php?' . urldecode(http_build_query($vars, '', '&'));
		}

		return new Uri($url);
	}
1245361
public function buildUrl($url)
    {
        if (strncmp($url, '/', 1) === 0) {
            return $url;
        }
        $baseUrl = isset($this->grid->controllerUrl) ? $this->grid->controllerUrl : '';

        return $baseUrl ? Url::to($baseUrl . '/' . $url) : Url::to($url);
    }
496668
public function setUrl($url)
    {
        $this->url = $url;

        // Check if the url ends with a slash
        if ($this->url && substr($this->url, -1) !== '/') {
            $this->url .= '/';
        }

        return $this;
    }
100056
public function url($url)
    {
        if (strpos($url, 'https:') === 0) {
            $this->def['ssl'] = true;
        } else {
            if (strpos($url, 'http:') === false && strpos($url, '//') === false) {
                $url = 'http://' . $url;
            }
        }
        
        $this->def['url'] = $url;
        return $this;
    }
417617
public static function urlContains($url)
    {
        return new static(
            function (WebDriver $driver) use ($url) {
                return mb_strpos($driver->getCurrentURL(), $url) !== false;
            }
        );
    }
434572
public static function google(Url $url)
    {
        if (($value = $url->getQueryParameter('url'))) {
            return Url::create($value);
        }

        return $url;
    }
1080861
public function addUrl($url)
    {
        $page = new Page($url);
        $this->addContent($page->getHTML(), $url);

        return $this;
    }
166196
public static function prepareUrl($url)
    {
        // $url = urlencode($url);

        $replacement = [
            '&' => '&amp;',
            "'" => '&apos;',
            '"' => '&quot;',
            '>' => '&gt;',
            '<' => '&lt;',
        ];

        $url = str_replace(array_keys($replacement), array_values($replacement), $url);

        return $url;
    }
242659
private function cleanURL(string $url = '')
    {
        $url = str_replace(' ', '-', $url); 				// Replaces all spaces with hyphens
        $url = preg_replace('/[^A-Za-z0-9\/\-]+/', '-', $url);	// Replaces special characters with hyphens

        // remove "/" prefix on generated URL
        if (substr($url, 0, 1) == '/') {
            return preg_replace('/\//', '', $url, 1);
        }

        return $url;
    }
227518
public function createUrl($uri = '/')
    {
        if (!isset($this->urlBase)) {
            $ssl = $this->isSSL();
            $protocol = 'http' . (($ssl) ? 's' : '');

            $host = $this->host;
            if (strpos($host, ':') === false) {
                $port = $this->serverData['SERVER_PORT'];
                $port = ((!$ssl && $port == '80') || ($ssl && $port == '443')) ? '' : ':' . $port;
                $host = $this->host . $port;
            }

            $this->urlBase = $protocol . '://' . $host;
        }

        if ($uri !== '' && strpos($uri, '/') === false) {
            $uri = '/' . $uri;
        }

        return $this->urlBase . $uri;
    }
422970
private function getHostFromUrl($url)
    {
        if (strpos($url, '//')) {
            $url = substr($url, strpos($url, '//') + 2);
        }
        if (($p = strpos($url, '/')) !== false) {
            $url = substr($url, 0, $p);
        }
        return $url;
    }
712364
private static function cleanUrl($url)
    {
        $result = '';
        $inner = false;

        for ($i = 0; $i < strlen($url); $i++) {
            if (!$inner) {
                if ($url[$i] != '{') {
                    $result .= $url[$i];
                } else {
                    $result .= '{';
                    $inner = true;
                }
            } else {
                if ($url[$i] == '}') {
                    $result .= '}';
                    $inner = false;
                }
            }
        }

        return $result;
    }