Add a custom header.

@param string $name The name of the custom header.
@param string $value The value of the custom header.
@throws \InvalidArgumentException
8484
public function add(string $name, string $value): void
    {
        $header = $this->make();
        $header->name = $name;
        $header->value = $value;
        $this->set($header);
    }
1361771
public function setHeader($name, $value)
    {
        $name = trim($name);
        $this->headers[$name] = trim($value);

        return $this;
    }
811081
public function setHeader($name, $value)
    {
        if (!$this->response->headers->has($name)) {
            $this->response->headers->set($name, $value);
        }
    }
1225676
public function changeHeader(string $name, string $value): void
    {
        // if (!array_key_exists($name, $this->headers)) {
            // throw new NotFoundException();
        // }
        $this->headers[$name] = $value;
    }
110058
public function addHeader(string $name, $value) : Message
    {
        $name = strtolower($name);

        if (is_array($value)) {
            $value = array_values($value);
            $this->headers[$name] = isset($this->headers[$name])
                ? array_merge($this->headers[$name], $value)
                : $value;
        } else {
            $this->headers[$name][] = $value;
        }

        return $this;
    }
578501
protected function setHeader(string $name, $value)
    {
        if (!$this->isHeaderNameValid($name)) {
            throw new InvalidHeaderException('Header name is invalid.');
        }

        $normalized = strtolower($name);
        $value = $this->filterHeader($value);

        // Header may have been previously set with a different case. If so, remove that header.
        if (isset($this->headerNameMap[$normalized]) && $this->headerNameMap[$normalized] !== $name) {
            unset($this->headers[$this->headerNameMap[$normalized]]);
        }

        $this->headerNameMap[$normalized] = $name;
        $this->headers[$name] = $value;
    }
367379
public function withHeader(string $name, $value): Builder
    {
        $this->headers[$name] = $value;

        return $this;
    }
1189952
public function addHeader(string $name, string $value = null)
    {
        if (!is_null($value)) {
            return $this->set('headers', $name, $value);
        }

        return $this->set('headers', $name, null);
    }
141641
public function addVarnishHeader($name, $value)
    {
        $header = $value;
        
        if ($this->hasVarnishHeader($name)) {
            $header = $this->getVarnishHeader($name);
            
            if (!is_array($header)) {
                $header = array($header);
            }
            
            $header[] = $value;
        } 
        
        $this->setVarnishHeader($name, $header);
        
        return $this;
    }
475820
public function addHeader($name, $value)
    {
        $this->getSwiftMessage()->getHeaders()->addTextHeader($name, $value);
        return $this;
    }
686808
public function addHeader($name, $value = null)
    {
        if (is_numeric($name)) {
            $status = $this->getStatus($name);
            if (!empty($status)) {
                $this->headers[] = "{$_SERVER['SERVER_PROTOCOL']} $name $status";
            }
        } elseif (isset($value)) {
            $this->headers[] = "$name: $value";
        }

        return $this;
    }
611715
protected function setHeader(string $name, $value)
    {
        \assert($this->isNameValid($name), "Invalid header name");

        if (\is_array($value)) {
            if (!$value) {
                $this->removeHeader($name);
                return;
            }

            $value = \array_values(\array_map("strval", $value));
        } else {
            $value = [(string) $value];
        }

        \assert($this->isValueValid($value), "Invalid header value");

        $name = \strtolower($name);
        $this->headers[$name] = $value;
    }
836225
protected function addHeader(string $name, string $value): void
    {
        $this->headers->add($name, $value);
    }
186476
public function addDefaultHeader($key, $value) {
		if (!is_string($key)) {
			throw new \InvalidArgumentException('The header key must be a string.');
		}

		$defaultHeaders[$key] = $value;
		return $this;
	}
1103137
public function header($name, $value = null)
    {
        if (!is_null($value)) {
            $this->headers->set($name, $value);
        }

        return $this->headers->get($name);
    }
780094
public function add(string $name, string $value): void
    {
        $key = strtolower($name);
        if (!isset($this->headers[$key])) {
            $this->headers[$key] = [$name, $value];

            return;
        }

        $this->headers[$key] = [$name, $this->headers[$key][1] . ', ' . $value];
    }
1296729
public function setHeader($name, $value)
    {
        if (isset($this->headers[$name])) {
            if (is_array($this->headers[$name])) {
                $this->headers[$name] = (array)$value;
            } else {
                $this->headers[$name] = $value;
            }
        } else {
            $this->headers[$name] = (array)$value;
        }

        return $this;
    }