You are here

public function HttpResponse::setHeader in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/zendframework/zend-feed/src/PubSubHubbub/HttpResponse.php \Zend\Feed\PubSubHubbub\HttpResponse::setHeader()

Set a header

If $replace is true, replaces any headers already defined with that $name.

Parameters

string $name:

string $value:

bool $replace:

Return value

\Zend\Feed\PubSubHubbub\HttpResponse

1 call to HttpResponse::setHeader()
HttpResponse::setContent in vendor/zendframework/zend-feed/src/PubSubHubbub/HttpResponse.php
Set body content

File

vendor/zendframework/zend-feed/src/PubSubHubbub/HttpResponse.php, line 86

Class

HttpResponse

Namespace

Zend\Feed\PubSubHubbub

Code

public function setHeader($name, $value, $replace = false) {
  $name = $this
    ->_normalizeHeader($name);
  $value = (string) $value;
  if ($replace) {
    foreach ($this->headers as $key => $header) {
      if ($name == $header['name']) {
        unset($this->headers[$key]);
      }
    }
  }
  $this->headers[] = [
    'name' => $name,
    'value' => $value,
    'replace' => $replace,
  ];
  return $this;
}