public function setHeader($name, $values, $replaceExistingHeader = true)
{
switch ($name) {
case 'Content-Type':
if (is_array($values)) {
if (count($values) !== 1) {
throw new \InvalidArgumentException('The "Content-Type" header must be unique and thus only one field value may be specified.', 1454949291);
}
$values = (string) $values[0];
}
if (stripos($values, 'charset') === false && stripos($values, 'text/') === 0) {
$values .= '; charset=' . $this->charset;
}
break;
}
$this->headers->set($name, $values, $replaceExistingHeader);
return $this;
}