Add a header to the response.

@param string $key
@param string $value
@param bool   $replace

@return \Dingo\Api\Http\Response
501580
public function withHeader($key, $value, $replace = true)
    {
        return $this->header($key, $value, $replace);
    }
918494
public function addHeader($header, $value)
    {
        $header = strtolower($header);
        $this->headers[$header] = $value;
        return $this;
    }
370355
public function generic(string $string, $replace = null, $http_response_code = null)
    {
        $header = new Header($string);

        if (isset($replace)) {
            $header->setReplace($replace);
        }

        if (isset($http_response_code)) {
            $header->setHttpResponseCode($http_response_code);
        }

        $this->addHeader($header);
    }
15788
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]);
        }
    }
709757
public function withAddedHeader($header, $value)
    {
        if ($this->complete) {
            return $this;
        }

        $new = $this->psrResponse->withAddedHeader($header, $value);
        return new self($new);
    }
1267486
public function addHeader ($header, $value = null)
		{
			if ($value)
				$this->_headers[] = "$header: $value";
			else
				$this->_headers[] = $header;

			return $this;
		}
1290475
public function setHeader($key, $value)
    {
        $this->headers[strval($key)] = strval($value);
        return $this;
    }
216285
public function setHeaders(array $headers, $replace = false)
    {
        if ($replace) {
            $this->headers = $headers;
        } else {
            foreach ($headers as $key => $value) {
                $this->headers[$key] = $value;
            }
        }

        return $this;
    }
1149639
public function setHeader($name, $values = null, $replace = true)
    {
        if (is_array($name)) {
            foreach ($name as $key => $value) {
                $this->setHeader($key, $value);
            }
            return $this;
        }

        $values = (array)$values;
        if (true === $replace || !isset($this->headers[$name])) {
            $this->headers[$name] = $values;
        } else {
            $this->headers[$name] = array_merge($this->headers[$name], $values);
        }

        return $this;
    }
1224160
public static function sendHeader($header, $replace = true)
    {
        // don't send header in CLI mode
        if (!Common::isPhpCliMode() and !headers_sent()) {
            header($header, $replace);
        }
    }
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;
	}
328367
public function setVary($headers, $replace = TRUE) {

		$this->headers->set('Vary', $headers, $replace);
		return $this;

	}
1252603
public function add(string $key, $value, bool $override = false)
    {
        if (!$override && $this->exists($key)) {
            return;
        }

        $this->parameters[$key] = $value;
    }
1283625
public function pushHeader(string $key, string $value = null)
	{
		$headers = $this->getHeaders();

		$headers[$key] = $value;

		$this->setHeaders($headers);

		return $this;
	}
728508
public function addHeader(string $name, string $value): Response
    {
        $this->headers->add($name, $value);
        return $this;
    }
1057351
public function setHeader($key, $value, $replace = true, $http_response_code = null)
    {
        $this->swooleResponse->header($key. $value);
    }
1268543
public static function header(
		string $header_string, bool $replace=false
	) {
		if (strpos($header_string, 'HTTP/1') !== false) {
			self::$code = explode(' ', $header_string)[1];
		} else {
			self::$head[] = $header_string;
		}
	}