Splits the URL into an array
@param string $url The URL to be processed
@return array The pieces of the array
506974
protected function processURL(string $url) : array
    {
        $url = trim($url, '/');
        $url_array = explode('/', $url);
        return $url_array;
    }
631399
public static function parse($url)
    {
        if (!strlen($url)) {
            return null;
        }
        $_urls = array_merge( @parse_url($url), array('params'=>array()) );
        if (isset($_urls['query'])) {
            parse_str($_urls['query'], $_urls['params']);
        }
        return $_urls;  
    }
971277
protected function extractUrlVariables($url){
        $variables = array();
        $pattern = "/(\\".static::$_URL_VAR_CHARACTER.".*?[^\\/]*)/";
        if (preg_match($pattern,$url,$matches)){
            array_shift($matches);
            foreach($matches as $match){
                $variables[] = $match[0];
            }
        }
        return $variables;
    }
1170937
private function processURL($url) {

        // Clean up special characters in url params
        $url = str_replace("%20", " ", $url);

        // Store a private copy for use later
        $this->url = URLHelper::$testURL == null ? $url : URLHelper::$testURL;

        // Split it on protocol first if required.
        if (substr($url, 0, 4) == "http") {
            $splitProtocol = explode("://", $url);
            $requestSection = sizeof($splitProtocol) > 1 ? $splitProtocol [1] : $splitProtocol [0];
            $requestSection = substr($requestSection, strpos($requestSection, "/"));
        } else {
            $requestSection = $url;
        }
        $this->requestURI = $requestSection;

        // Now split it on question mark for query if required.
        $splitQuestionMark = explode("?", $requestSection);
        $queryStripped = $splitQuestionMark [0];

        // Now ensure no trailing or leading slash.
        if (substr($queryStripped, 0, 1) == '/') $queryStripped = substr($queryStripped, 1);
        if (substr($queryStripped, strlen($queryStripped) - 1) == '/') $queryStripped = substr($queryStripped, 0, strlen($queryStripped) - 1);

        // Now simply set the segments array to be the split on "/"
        $this->segments = explode("/", $queryStripped);

    }
1132224
private function parseUrl(string $url): array
    {
        $parts = parse_url($url);

        if ($parts === false || !isset($parts['host'])) {
            throw new \InvalidArgumentException(sprintf('Invalid connection URL given: "%s"', $url));
        }

        $params = [
            'login' => $parts['user'] ?? '',
            'password' => $parts['pass'] ?? '',
            'host' => $parts['host'],
            'port' => (int) ($parts['port'] ?? 5672),
            'vhost' => empty($parts['path']) || $parts['path'] === '/' ? '/' : substr($parts['path'], 1),
        ];

        parse_str($parts['query'] ?? '', $queryParams);

        return $params + $queryParams;
    }
605232
public static function fromUrl($url)
    {
        $elements = parse_url($url);
        $elements['pathinfo'] = isset($elements['path']) ? $elements['path'] : '';

        if (isset($elements['query'])) {
            parse_str($elements['query'], $queryParams);
            $elements['queryParams'] = $queryParams;
        }

        // Remove unwanted keys returned by parse_url() so that we don't have them as properties.
        unset($elements['path'], $elements['query'], $elements['user'], $elements['pass'], $elements['fragment']);

        return new static($elements);
    }
830977
public function extractShortUrl(string $url):array {
		$urls = [$url];

		while($url = $this->extract($url)){
			$urls[] = $url;
		}

		return $urls;
	}
1017532
protected function split($path)
  {
    if (is_array($path)) {
      $parts = $path;
    } else {
      $parts = explode("/", $path);
    }
    return $parts;
  }
345421
public static function splitUrl($url) {
		$splitData = array();
		if(preg_match('/(https?)*(:\/\/)*(.*)/', $url, $matches)) {
			$splitData[] = (isset($matches[1]) && !empty($matches[1])) ? $matches[1] : 'http';
			$splitData[] = (isset($matches[3]) && !empty($matches[3])) ? $matches[3] : '';
		}
		return $splitData;
	}
14394
protected static function splitUrlVersion($version)
    {
        $pos = strpos($version, '#');

        // number version or empty version
        if (false !== $pos) {
            $url = substr($version, 0, $pos);
            $version = substr($version, $pos);
        } else {
            $url = $version;
            $version = '#';
        }

        return array($url, $version);
    }
1134274
public function processUrl($url) {
        $splittedUrl = explode('/', $url);
        $langCodes = $this->getCodes();

        if (isset($langCodes[$splittedUrl[0]])) {
            if($this->_accepted_languages !== null && is_array($this->_accepted_languages)) {
                if( in_array($splittedUrl[0], $this->_accepted_languages)){
                    $this->_selectedLanguage = array_shift($splittedUrl);
                }
                else {
                    $this->_selectedLanguage = $this->_defaultLang;
                }
            }
            else {
                $this->_selectedLanguage = array_shift($splittedUrl);
            }
            $this->saveLanguage();

            $processedUrl = implode('/', $splittedUrl);
        }
        elseif(isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) && isset($langCodes[substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2)])) {
            $this->_selectedLanguage = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
            if($this->_accepted_languages === null) {
                $this->_selectedLanguage = $this->_defaultLang;
            }
            elseif (is_array($this->_accepted_languages)){
                if (!in_array($this->_selectedLanguage, $this->_accepted_languages)) {
                    $this->_selectedLanguage = $this->_defaultLang;
                }
            }
            $this->saveLanguage();

            $processedUrl = $url;
        }
        else {
            $this->_selectedLanguage = $this->_defaultLang;
            $this->saveLanguage();

            $processedUrl = $url;
        }
        return $processedUrl;
    }
1312558
public function parseUrl($url) {
		$url = parse_url($url);
		$url['vars'] = array();
		if (!isset($url['fragment'])) {
			$url['fragment'] = null;
		}
		if (isset($url['query'])) {
			parse_str($url['query'], $url['vars']);
		}

		return $url;
	}
86211
protected static function parseUrl($url)
    {
        $components = @parse_url($url);
        if (! empty($components)) {
            return $components;
        }

        if (is_null(static::$is_parse_url_bugged)) {
            static::$is_parse_url_bugged = ! is_array(@parse_url("//example.org:80"));
        }

        //bugfix for https://bugs.php.net/bug.php?id=68917
        if (static::$is_parse_url_bugged &&
            strpos($url, '/') === 0 &&
            is_array($components = @parse_url('http:'.$url))
        ) {
            unset($components['scheme']);
            return $components;
        }
        throw new RuntimeException(sprintf("The given URL: `%s` could not be parse", $url));
    }
1042878
public function crawl( $url ) {

		$this->parse($url);

		while( $url = array_shift($this->sitemaps) ) {

			$this->parse($url);
		}

		return $this->urls;
	}
1261403
public function parse($url)
    {
        $hostname = $this->extractHostname($url);

        // If received hostname is valid IP address, result will be formed from it.

        if (IP::isValid($hostname)) {
            return new $this->resultClassName(null, $hostname, null);
        }

        list($subDomain, $host, $suffix) = $this->extractParts($hostname);

        return new $this->resultClassName($subDomain, $host, $suffix);
    }
985665
private function getQueryParameterFromUrl($url)
    {
        $parameters = array();
        foreach (\preg_split('/&(amp;)?/i', \preg_split('/[?]/ui', $url)[1]) as $value) {
            $chunks                 = \explode('=', $value);
            $parameters[$chunks[0]] = $chunks[1];
        }

        return $parameters;
    }
545860
public static function getParamsAsArray($url)
    {
        $query = parse_url($url, PHP_URL_QUERY);
        if (!$query) {
            return [];
        }
        $params = [];
        parse_str($query, $params);

        return $params;
    }