src/Url.php
private static function myParsePath(?UrlInterface $baseUrl = null, string $pathString, ?UrlPathInterface &$path = null, ?string &$queryString = null, ?string &$fragment = null, ?string &$error = null): bool
    {
        // Fragment.
        $parts = explode('#', $pathString, 2);
        $pathString = $parts[0];
        $fragment = count($parts) > 1 ? $parts[1] : null;

        if (!self::myValidateFragment($fragment, $error)) {
            return false;
        }

        // Query string.
        $parts = explode('?', $pathString, 2);
        $pathString = $parts[0];
        $queryString = count($parts) > 1 ? $parts[1] : null;

        if (!self::myValidateQueryString($queryString, $error)) {
            return false;
        }

        // Try parse url path.
        if (!self::myParseUrlPath($baseUrl, $pathString, $path, $error)) {
            return false;
        }

        // If path is empty and there is a base url, handle query string and fragment.
        if ($pathString === '' && $baseUrl !== null && $queryString === null) {
            $queryString = $baseUrl->getQueryString();
            $fragment = $fragment ?: $baseUrl->getFragment();
        }

        return true;
    }
private static function myParsePath(?UrlInterface $baseUrl = null, string $pathString, ?UrlPathInterface &$path = null, ?string &$queryString = null, ?string &$fragment = null, ?string &$error = null): bool
    {
        // Fragment.
        $parts = explode('#', $pathString, 2);
        $pathString = $parts[0];
        $fragment = count($parts) > 1 ? $parts[1] : null;

        if (!self::myValidateFragment($fragment, $error)) {
            return false;
        }

        // Query string.
        $parts = explode('?', $pathString, 2);
        $pathString = $parts[0];
        $queryString = count($parts) > 1 ? $parts[1] : null;

        if (!self::myValidateQueryString($queryString, $error)) {
            return false;
        }

        // Try parse url path.
        if (!self::myParseUrlPath($baseUrl, $pathString, $path, $error)) {
            return false;
        }

        // If path is empty and there is a base url, handle query string and fragment.
        if ($pathString === '' && $baseUrl !== null && $queryString === null) {
            $queryString = $baseUrl->getQueryString();
            $fragment = $fragment ?: $baseUrl->getFragment();
        }

        return true;
    }
private static function myParsePath ( ? UrlInterface $ baseUrl = null , string $ pathString , ? UrlPathInterface & $ path = null , ? string & $ queryString = null , ? string & $ fragment = null , ? string & $ error = null ) : bool { // Fragment. $ parts = explode ( '#' , $ pathString , 2 ) ; $ pathString = $ parts [ 0 ] ; $ fragment = count ( $ parts ) > 1 ? $ parts [ 1 ] : null ; if ( ! self :: myValidateFragment ( $ fragment , $ error ) ) { return false ; } // Query string. $ parts = explode ( '?' , $ pathString , 2 ) ; $ pathString = $ parts [ 0 ] ; $ queryString = count ( $ parts ) > 1 ? $ parts [ 1 ] : null ; if ( ! self :: myValidateQueryString ( $ queryString , $ error ) ) { return false ; } // Try parse url path. if ( ! self :: myParseUrlPath ( $ baseUrl , $ pathString , $ path , $ error ) ) { return false ; } // If path is empty and there is a base url, handle query string and fragment. if ( $ pathString === '' && $ baseUrl !== null && $ queryString === null ) { $ queryString = $ baseUrl -> getQueryString ( ) ; $ fragment = $ fragment ? : $ baseUrl -> getFragment ( ) ; } return true ; }
Parse path.

@param UrlInterface|null     $baseUrl     The base url or null if no base url is present.
@param string                $pathString  The path that is to be parsed.
@param UrlPathInterface|null $path        The path if parsing was successful, undefined otherwise.
@param string|null           $queryString The query string if parsing was successful, undefined otherwise.
@param string|null           $fragment    The fragment if parsing was successful, undefined otherwise.
@param string|null           $error       The error text if parsing was not successful, undefined otherwise.

@return bool True if parsing was successful, false otherwise.
Parse path .