You are here

private function SapiEmitter::emitHeaders in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/zendframework/zend-diactoros/src/Response/SapiEmitter.php \Zend\Diactoros\Response\SapiEmitter::emitHeaders()

Emit response headers.

Loops through each header, emitting each; if the header value is an array with multiple values, ensures that each is sent in such a way as to create aggregate headers (instead of replace the previous).

Parameters

ResponseInterface $response:

1 call to SapiEmitter::emitHeaders()
SapiEmitter::emit in vendor/zendframework/zend-diactoros/src/Response/SapiEmitter.php
Emits a response for a PHP SAPI environment.

File

vendor/zendframework/zend-diactoros/src/Response/SapiEmitter.php, line 66

Class

SapiEmitter

Namespace

Zend\Diactoros\Response

Code

private function emitHeaders(ResponseInterface $response) {
  foreach ($response
    ->getHeaders() as $header => $values) {
    $name = $this
      ->filterHeader($header);
    $first = true;
    foreach ($values as $value) {
      header(sprintf('%s: %s', $name, $value), $first);
      $first = false;
    }
  }
}