Overwrite all HTTP headers with the supplied array of headers
array $headers Associative array of header data.:
Overrides MessageInterface::setHeaders
public function setHeaders(array $headers) {
// Get the keys that are changing
$changed = array_keys($this->headers);
// Erase the old headers
$this->headers = array();
// Add the new headers
foreach ($headers as $key => $value) {
$changed[] = $key;
$this
->addHeader($key, $value);
}
// Notify of the changed headers
foreach (array_unique($changed) as $header) {
$this
->changedHeader(strtolower($header));
}
return $this;
}