Sets a header by name.
@api
string $key The key:
string|array $values The value or an array of values:
Boolean $replace Whether to replace the actual value of not (true by default):
public function set($key, $values, $replace = true) {
$key = strtr(strtolower($key), '_', '-');
$values = array_values((array) $values);
if (true === $replace || !isset($this->headers[$key])) {
$this->headers[$key] = $values;
}
else {
$this->headers[$key] = array_merge($this->headers[$key], $values);
}
if ('cache-control' === $key) {
$this->cacheControl = $this
->parseCacheControl($values[0]);
}
}