You are here

public function SapiEmitter::emit in Zircon Profile 8.0

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

Emits a response for a PHP SAPI environment.

Emits the status line and headers via the header() function, and the body content via the output buffer.

Parameters

ResponseInterface $response:

null|int $maxBufferLevel Maximum output buffering level to unwrap.:

Overrides EmitterInterface::emit

File

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

Class

SapiEmitter

Namespace

Zend\Diactoros\Response

Code

public function emit(ResponseInterface $response, $maxBufferLevel = null) {
  if (headers_sent()) {
    throw new RuntimeException('Unable to emit response; headers already sent');
  }
  $this
    ->emitStatusLine($response);
  $this
    ->emitHeaders($response);
  $this
    ->emitBody($response, $maxBufferLevel);
}