protected function getScheme()
    {
        if (isset($_SERVER['REQUEST_SCHEME'])) {
            $scheme = $_SERVER['REQUEST_SCHEME'];
        } else if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']) {
            $scheme = 'https';
        } else {
            if ($_SERVER['SERVER_PORT'] == 443) {
                $scheme = 'https';
            } else {
                $scheme = 'http';
            }
        }
        
        return $scheme;
    }