Register a header and return your index, if `Response::dispatch`
was previously executed the header will be set directly and will not be
registered

@param string $name
@param string $value
@param bool   $replace
@return void
348080
public static function putHeader($name, $value, $replace = true)
    {
        if (self::$dispatchedHeaders || App::state() > 2) {
            header($name . ': ' . ltrim($value), $replace);
        } else {
            self::$headers[] = array($name, $value, $replace);
        }
    }
1330929
public function set(string $name, string $value): void
    {
        $key = strtolower($name);
        $this->headers[$key] = [$name, $value];
    }
1224160
public static function sendHeader($header, $replace = true)
    {
        // don't send header in CLI mode
        if (!Common::isPhpCliMode() and !headers_sent()) {
            header($header, $replace);
        }
    }
224542
public function addHeader($name, $value, $replace = false)
    {
        if ($name == '' || $value == '') return;
        $name = $this->normalizeHeaderName($name);
        $this->headers[] = array('name' => $name, 'value' => $value, 'replace' => $replace);
    }
410901
public function header($name, $value = null)
    {
        if (!is_null($value)) {
            $this[$name] = $value;
        }

        return $this[$name];
    }
501580
public function withHeader($key, $value, $replace = true)
    {
        return $this->header($key, $value, $replace);
    }
423023
public function setHeader(string $name, string $value)
    {
        switch ($this->type) {
            case 'psr-7':
                $this->response = $this->response->withHeader($name, $value);
                break;

            case 'laravel':
            case 'symfony':
                $this->response->headers->set($name, $value);
                break;

            case 'thinkphp':
                $this->response->header($name, $value);
                break;

            default:
                $this->response[$name] = $value;
                break;
        }

        return $this;
    }
365206
public static void replaceHeader(Map<String, String> headers, String name, String value) {
		removeHeader(headers, name);
		headers.put(name, value);
	}
651246
public function withAddedHeader($name, $value): self
    {
        $request = clone $this;
        $request->headers->set($name, $value, false);

        return $request;
    }
416858
public function addHeader(string $name, string $value): void
    {
        parent::addHeader($name, $value);
    }
1213549
public function withHeader($name, $value)
    {
        $instance = clone $this;
        $instance->headers->set($name, $value);
        return $instance;
    }
865785
public final function header(string $name, string $value = null)
    {
        return ($value === null) ? $this->getHeader($name) : $this->setHeader($name, $value);
    }
814033
public function addHeader($name, $value)
    {
        if (isset($this->headers[$name])) {
            if (is_array($this->headers[$name])) {
                $this->headers[$name][] = $value;
            } else {
                $this->headers[$name] = $value;
            }
        } else {
            $this->headers[$name] = [$value];
        }

        return $this;
    }
1297871
public function addHeader(string $name, $value)
    {
        $lName = strtolower($name);
        if (isset($this->headers[$lName])) {
            $this->headers[$lName][1] = array_merge(
                $this->headers[$lName][1],
                (array) $value
            );
        } else {
            $this->headers[$lName] = [
                $name,
                (array) $value,
            ];
        }
    }
1349825
protected function addHeader(string $name, string $value) : self
    {
        $this->headers[$name] = $value;

        return $this;
    }
1361771
public function setHeader($name, $value)
    {
        $name = trim($name);
        $this->headers[$name] = trim($value);

        return $this;
    }
330340
final public function withAddedHeader($name, $value): self
    {
        return $this->withHeader($name, array_merge($this->getHeader($name), (array)$value));
    }