src/Url.php
private static function myParseUrlPath(?UrlInterface $baseUrl = null, string $pathString, ?UrlPathInterface &$path = null, ?string &$error = null): bool
    {
        // If path is empty and there is a base url, use the path from base url.
        if ($baseUrl !== null && $pathString === '') {
            $path = $baseUrl->getPath();

            return true;
        }

        // Parse path.
        try {
            $path = UrlPath::parse($pathString);
        } catch (UrlPathInvalidArgumentException $e) {
            $error = $e->getMessage();

            return false;
        }

        // If there is a base url, paths should be combined.
        if ($baseUrl !== null) {
            $path = $baseUrl->getPath()->withUrlPath($path);
        }

        return true;
    }
private static function myParseUrlPath(?UrlInterface $baseUrl = null, string $pathString, ?UrlPathInterface &$path = null, ?string &$error = null): bool
    {
        // If path is empty and there is a base url, use the path from base url.
        if ($baseUrl !== null && $pathString === '') {
            $path = $baseUrl->getPath();

            return true;
        }

        // Parse path.
        try {
            $path = UrlPath::parse($pathString);
        } catch (UrlPathInvalidArgumentException $e) {
            $error = $e->getMessage();

            return false;
        }

        // If there is a base url, paths should be combined.
        if ($baseUrl !== null) {
            $path = $baseUrl->getPath()->withUrlPath($path);
        }

        return true;
    }
private static function myParseUrlPath ( ? UrlInterface $ baseUrl = null , string $ pathString , ? UrlPathInterface & $ path = null , ? string & $ error = null ) : bool { // If path is empty and there is a base url, use the path from base url. if ( $ baseUrl !== null && $ pathString === '' ) { $ path = $ baseUrl -> getPath ( ) ; return true ; } // Parse path. try { $ path = UrlPath :: parse ( $ pathString ) ; } catch ( UrlPathInvalidArgumentException $ e ) { $ error = $ e -> getMessage ( ) ; return false ; } // If there is a base url, paths should be combined. if ( $ baseUrl !== null ) { $ path = $ baseUrl -> getPath ( ) -> withUrlPath ( $ path ) ; } return true ; }
Try to validate or 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           $error      The error text if parsing was not successful, undefined otherwise.

@return bool True if parsing was successful, false otherwise.
Try to validate or parse path .