mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-23 22:04:25 +02:00
parent
c927c32442
commit
f95c789353
@ -153,6 +153,31 @@ class Response extends Zend_Controller_Response_Http
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get an array of every header value with a specified name
|
||||||
|
*
|
||||||
|
* @param string $name
|
||||||
|
* @param bool $lastOnly If this is true, the last value will be returned as a string.
|
||||||
|
*
|
||||||
|
* @return null|array|string
|
||||||
|
*/
|
||||||
|
public function getHeader($name, $lastOnly = false)
|
||||||
|
{
|
||||||
|
$result = ($lastOnly ? null : array());
|
||||||
|
$headers = $this->getHeaders();
|
||||||
|
foreach ($headers as $header) {
|
||||||
|
if ($header['name'] === $name) {
|
||||||
|
if ($lastOnly) {
|
||||||
|
$result = $header['value'];
|
||||||
|
} else {
|
||||||
|
$result[] = $header['value'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the request
|
* Get the request
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user