public function getScheme()
{
if (isset($_SERVER['REQUEST_SCHEME'])) {
return $_SERVER['REQUEST_SCHEME'];
} elseif (isset($_SERVER['HTTPS'])) {
if ($_SERVER['HTTPS'] === 'on') {
return 'https';
} else {
return 'http';
}
} else {
throw new RequestException('`HTTPS` field not exists in $_SERVER');
}
}