public function toUriString() : string
    {
        $uri = '';

        if (($scheme = $this->getScheme()) != '') {
            $uri .= $scheme . ':';
        }

        if (($authority = $this->getAuthority()) != '' || $scheme === 'file') {
            $uri .= '//' . $authority;
        }

        $uri .= $this->getPath();

        if (($query = $this->getQuery()) != '') {
            $uri .= '?' . $query;
        }

        if (($fragment = $this->getFragment()) != '') {
            $uri .= '#' . $fragment;
        }

        return $uri;
    }