public function getHeaders($case = null)
{
static $result;
if ($result === null && function_exists('apache_request_headers')) {
$result = apache_request_headers();
} elseif ($result === null) {
$result = array();
foreach ($_SERVER as $key => $value) {
if (strncasecmp($key, 'HTTP_', 5) !== 0) {
continue;
}
$key = str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($key, 5)))));
$result[$key] = $value;
}
}
if ($case !== null) {
return array_change_key_case($result, $case);
}
return $result;
}