Emits the status line and headers via the header() function, and the
body content via the output buffer.
public function emit(ResponseInterface $response, EmitterInterface $emitter = null) { if (!$emitter) { $emitter = new SapiStreamEmitter(); } $emitter->emit($response); }
/** * Emit the response using the PHP SAPI. * * @param \Psr\Http\Message\ResponseInterface $response The response to emit * @param \Zend\Diactoros\Response\EmitterInterface|null $emitter The emitter to use. * When null, a SAPI Stream Emitter will be used. * @return void */ public function emit(ResponseInterface $response, EmitterInterface $emitter = null) { $stream = $response->getBody(); if (!$emitter && !$stream->isSeekable()) { $emitter = new SapiEmitter(); } if (!$emitter) { $emitter = new SapiStreamEmitter(); } $emitter->emit($response); }