Set HTTP headers here.

@param   $name
@param   $value
@param   $replace

@return $this
182296
public function setHeader($name, $value, $replace = false)
    {
        // Add multiple headers for the reponse as array
        if (is_array($name)) {
            foreach ($name as $headerKey => $headerValue) {
                $this->headers->set($headerKey, $headerValue, $replace);
            }

            return $this;
        }

        $this->headers->set($name, $value, $replace);

        return $this;
    }
1219398
protected function setHeader($name, $value)
    {
        $name  = $this->prepareHeaderName($name);
        $value = $this->prepareHeaderValue($value);

        $normalized = strtolower($name);
        if (! isset($this->headerNames[$normalized])) {
            $this->headerNames[$normalized] = $name;
        }

        $header = $this->headerNames[$normalized];

        $this->rawHeaders[$header] = $value;

        return $this;
    }
865785
public final function header(string $name, string $value = null)
    {
        return ($value === null) ? $this->getHeader($name) : $this->setHeader($name, $value);
    }
379082
public function withHeader($name, $value)
    {
        $request = clone $this;
        $request->headers->set($name, $value);

        return $request;
    }
501580
public function withHeader($key, $value, $replace = true)
    {
        return $this->header($key, $value, $replace);
    }
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;
    }
818455
public function withHeader($name, $value): self
    {
        $this->assertHeaderName($name);

        $clone = clone $this;
        $clone->headers->set($name, $value);

        if ($clone->getStatusCode() === 200 && strtolower($name) === 'location') {
            $clone = $clone->withStatus(302);
        }

        return $clone;
    }
673620
public function addHeader($name, $value)
    {
        Validate::isString($name, 'name');
        Validate::isString($value, 'value');

        $this->_headers[$name] = $value;
    }
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;
    }
1001517
public function withHeader($name, $value) : self
    {
        $new = clone $this;

        return $new->setResponse($this->response->withHeader($name, $value));
    }
1245864
public function withHeader($name, $value)
    {
        if (array_key_exists($name, $this->headers) && in_array($value, $this->headers[$name])) {
            return $this;
        }

        $instance = clone $this;
        $instance->headers[$name] = array_filter((array)$value);
        return $instance;
    }
1344070
final public function withHeader($name, $value): self
    {
        $message = clone $this;

        //Make sure to remove the current header with the same
        //name to avoid casing-duplication (location, Location, LOCATION)
        if ($message->hasHeader($name)) {
            $message = $message->withoutHeader($name);
        }

        $message->addHeaders([$name => $value]);
        return $message;
    }
1024473
public function withAddedHeader($name, $value): self
    {
        $this->assertHeaderName($name);

        $clone = clone $this;
        $clone->headers->add($name, $value);

        return $clone;
    }
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;
    }
1168212
public function setHeader($name, $value)
    {
        $this->getResponse()->headers->set($name, $value);

        return $this;
    }
1140630
public function replacePath($value, $replace)
    {
        $this->data['path'] = str_replace($value, $replace, $this->data['path']);
        return $this;
    }
410901
public function header($name, $value = null)
    {
        if (!is_null($value)) {
            $this[$name] = $value;
        }

        return $this[$name];
    }