@param string $url

@return string
512712
public function convertUrl(string $url): string
    {
        $parsed = parse_url($url);
        if ($parsed === false) {
            throw new InvalidArgumentException('The given string does not look like a URL', 206);
        }

        // Nothing to do
        if ($parsed['host'] === null) {
            return $url;
        }
        $parsed['host'] = $this->convert($parsed['host']);

        return http_build_url($parsed);
    }
21711
private function getUrl($url)
    {
        // Check for URL scheme
        if (parse_url($url, PHP_URL_SCHEME) === null) {
            $url = Arr::get($this->config, 'base_uri') . $url;
        }

        return $url;
    }
566129
public function generate($url)
    {
        $time = time();
        $query = parse_url($url, PHP_URL_QUERY);
        parse_str($query, $query);

        $query = $this->filterKeys($query, $this->params);
        $query['timestamp'] = $time;

        $signature = $this->generateToken($query);

        return $url . '&timestamp=' . $time . '&signature=' . $signature;
    }
11010
protected function formatUrl(string $url): string
    {
        $uri = $this->urlPrefix.$url;

        return $uri === '/' ? '/' : ltrim(rtrim($uri, '/'), '/');
    }
991018
protected function fetchUrl(string $url): string
    {
        $curl = curl_init($url);
        curl_setopt_array($curl, [
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_TIMEOUT => $this->timeOut
        ]);
        $data = curl_exec($curl);
        $statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
        $error = curl_error($curl);
        curl_close($curl);

        if ($error) {
            throw new FetchFailedException(sprintf("A cURL error occurred for \"%s\": %s", $url, $error));
        }

        if ($statusCode !== 200) {
            throw new FetchFailedException(sprintf("URL \"%s\" responded with status code %d.", $url, $statusCode));
        }

        if (!$data) {
            throw new FetchFailedException(sprintf("URL \"%s\" returned no data.", $url));
        }

        return $data;
    }
59109
public static function removeQueryString($url) {
        $pos = strpos($url, '?');
        if ( $pos === false ) return $url;
        $url = substr($url,0,$pos);
        return $url;
    }
679241
private function cleanUrl($url)
    {
        if (strlen($url) > 1 && strrpos($url, '/') === strlen($url) - 1) {
            $url = substr($url, 0, -1);
        }
        if (strrpos($url, '.php') === strlen($url) - 4) {
            $url = substr($url, 0, -4);
        }
        return $url;
    }
142174
private function parseUrl($url)
	{
		$newUrl = preg_replace($this->patterns, $this->replacements, $url);
		$newUrl = trim($newUrl, '\/?');
		$newUrl = trim($newUrl, '\/');

		return $newUrl;
	}
742301
private function getUrlOrigin($url)
    {
        return array(
            parse_url($url, PHP_URL_SCHEME),
            parse_url($url, PHP_URL_HOST),
            parse_url($url, PHP_URL_PORT),
        );
    }
354041
final static function normalize(string $url):string{#{{{

    if(isset(
      $_SERVER['REQUEST_SCHEME'],
      $_SERVER['REQUEST_HOST'],
      $_SERVER['REQUEST_PORT'],
      $_SERVER['REQUEST_URI'],
      $_SERVER['SERVER_PORT']
    ) || PHP_SAPI ==='cli')
      return $url;

    $arr = parse_url($url);
    if($arr===false) return '';

    $a = [
      $arr['scheme']??$_SERVER['REQUEST_SCHEME'],
      '://',
      $arr['user']??'',
      ':',
      $arr['pass']??'',
      '@',
      $arr['host']??$_SERVER['HTTP_HOST'],
      ':',
      $arr['port']??$_SERVER['SERVER_PORT'],
      substr($_SERVER['REQUEST_URI'],0, strrpos($_SERVER['REQUEST_URI'],'/')+1),
      $arr['path']??'',
      '?',
      $arr['query']??'',
      '#',
      $arr['fragment']??'',
    ];

    if(!in_array($a[0], ['http','https'])) return '';

    if($a[12]==='')            unset($a[11],$a[12]);
    if($a[14]==='')            unset($a[13],$a[14]);
    if($a[8]==80)              unset($a[7],$a[8]);
    if($a[4]==='')             unset($a[3],$a[4]);
    if($a[2]==='')             unset($a[2],$a[3],$a[4],$a[5]);
    if(strpos($a[10],'/')===0) unset($a[9]);

    while(strpos($a[10],'../')===0){
      $a[10] = substr($a[10],3);
      $a[9] = dirname($a[9]);
      if($a[9]!=='/') $a[9] .= '/';
    }

    while(strpos($a[10],'./')===0){
      $a[10] = substr($a[10],2);
    }

    if($a[10]==='.') unset($a[10]);

    return implode($a);
  }
1058008
protected function prepareUrl($url)
    {
        $replacement = ($this->removeHostFromUrl ? '' : '$1') . ($this->removeScriptFromUrl ? '' : '$2');

        return preg_replace('#(https?\://[^/]+)(/[^/\.]+\.php)?#', $replacement, $url);
    }
520311
public function getDesiredUrl(?string $url = null)
  {
    if (isset($_GET['url'])) {
      $url = $_GET['url'] . (count($_GET) > 0 ? '?' : '');
      unset($_GET['url']);

      foreach ($_GET as $key => $value) {
        $url .= (ends_with($url, '?') ? '' : '&') . $key . '=' . $value;
      }
    }

    if ($url != null) return $url;
    return false;
  }
877493
protected function cleanUrl($url)
    {
        $parts = parse_url($url);
        $fragment = empty($parts['fragment']) ? '' : '#'.$parts['fragment'];
        $path = empty($parts['path']) ? '/' : $parts['path'];

        return preg_replace('/^\/[^\.\/]+\.php\//', '/', $path).$fragment;
    }
1172699
public static function getAbsoluteUrl($url = null)
    {
        if (is_null($url)) {
            return '';
        }
        if (self::isUrl($url)) {
            return $url;
        }
        $url            = '/'.self::resolvePath($url);
        $current_url    = self::getRequestUrl(true, true);
        $curr           = substr($current_url, 0, strrpos($current_url, '/') );
        return $curr.$url;
    }
439796
private function split($url)
    {
        $parts = parse_url($url) + array(
                'scheme' => 'http',
                'query' => '',
                'path' => '',
            );

        $parts['prefix'] = '';
        if (isset($parts['host'])) {
            $parts['prefix'] = sprintf('%s://%s', $parts['scheme'], $parts['host']);
        }

        return $parts;
    }
951440
public function getAbsolute($url)
    {
        if (empty($url)) {
            return '';
        }

        if (strpos($url, 'data:') === 0) {
            return $url;
        }

        if (preg_match('|^\w+://|', $url)) {
            return $url;
        }

        if (strpos($url, '://') === 0) {
            return $this->getScheme().$url;
        }

        if (strpos($url, '//') === 0) {
            return $this->getScheme().":$url";
        }

        if ($url[0] === '/') {
            return $this->getScheme().'://'.$this->getHost().$url;
        }

        return $this->getScheme().'://'.$this->getHost().$this->getDirectories().$url;
    }
279701
private function getPath($url)
    {
        $url = trim($url);
        $parsed = $this->parseURL($url);
        if ($parsed !== false) {
            $this->url = $url;
            return $parsed['custom'];
        }
        return $url;
    }