protected function setUrlScheme($url, $scheme = '')
    {
        if (!($url = (string) $url)) {
            return $url; // Nothing to do.
        }
        $scheme = (string) $scheme;

        if (!$scheme) {
            $scheme = $this->currentUrlScheme();
        }
        if ($scheme !== '//') {
            $scheme = $this->nUrlScheme($scheme).'://';
        }
        return preg_replace('/^(?:[a-z0-9]+\:)?\/\//ui', $this->escRefs($scheme), $url);
    }