protected function getScheme(?string $scheme, ?string $domain = null) : string
    {
        if ($scheme === null || $scheme === '//') {
            return $this->tryGuessScheme($domain);
        }

        return $this->trim($scheme, ':/') . '://';
    }