Retrieve an HTTP header by name. Performs a case-insensitive search of all headers.
string $header Header to retrieve.:
bool $string Set to true to get the header as a string:
string|Header|null Returns NULL if no matching header is found. Returns a string if $string is set to TRUE. Returns a Header object if a matching header is found.
Overrides MessageInterface::getHeader
public function getHeader($header, $string = false) {
$key = strtolower($header);
if (!isset($this->headers[$key])) {
return null;
}
return $string ? (string) $this->headers[$key] : $this->headers[$key];
}