You are here

public function HttpResponse::sendHeaders 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::sendHeaders()

Send all headers

Sends any headers specified. If an {@link setHttpResponseCode() HTTP response code} has been specified, it is sent with the first header.

Return value

void

1 call to HttpResponse::sendHeaders()
HttpResponse::send in vendor/zendframework/zend-feed/src/PubSubHubbub/HttpResponse.php
Send the response, including all headers

File

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

Class

HttpResponse

Namespace

Zend\Feed\PubSubHubbub

Code

public function sendHeaders() {
  if (count($this->headers) || 200 != $this->statusCode) {
    $this
      ->canSendHeaders(true);
  }
  elseif (200 == $this->statusCode) {
    return;
  }
  $httpCodeSent = false;
  foreach ($this->headers as $header) {
    if (!$httpCodeSent && $this->statusCode) {
      header($header['name'] . ': ' . $header['value'], $header['replace'], $this->statusCode);
      $httpCodeSent = true;
    }
    else {
      header($header['name'] . ': ' . $header['value'], $header['replace']);
    }
  }
  if (!$httpCodeSent) {
    header('HTTP/1.1 ' . $this->statusCode);
  }
}