private static function myParse(?UrlInterface $baseUrl = null, string $url, ?SchemeInterface &$scheme = null, ?HostInterface &$host = null, ?int &$port = null, ?UrlPathInterface &$path = null, ?string &$queryString = null, ?string &$fragment = null, ?string &$error = null): bool
    {
        if ($baseUrl === null && $url === '') {
            $error = 'Url "" is empty.';

            return false;
        }

        // Split the url in its main components.
        self::mySplit($url, $schemeString, $authorityString, $pathString);

        // Parse scheme.
        if (!self::myParseScheme($baseUrl, $schemeString, $scheme, $error)) {
            $error = 'Url "' . $url . '" is invalid: ' . $error;

            return false;
        }

        // Parse authority.
        if (!self::myParseAuthority($baseUrl, $authorityString, $host, $port, $error)) {
            $error = 'Url "' . $url . '" is invalid: ' . $error;

            return false;
        }

        // Set default port if needed.
        if ($port === null) {
            $port = $scheme->getDefaultPort();
        }

        // Parse path.
        if (!self::myParsePath($baseUrl, $pathString, $path, $queryString, $fragment, $error)) {
            $error = 'Url "' . $url . '" is invalid: ' . $error;

            return false;
        }

        return true;
    }