3 * @see https://github.com/zendframework/zend-diactoros for the canonical source repository
4 * @copyright Copyright (c) 2015-2018 Zend Technologies USA Inc. (http://www.zend.com)
5 * @license https://github.com/zendframework/zend-diactoros/blob/master/LICENSE.md New BSD License
8 namespace Zend\Diactoros\Response;
10 use Psr\Http\Message\ResponseInterface;
13 * @deprecated since 1.8.0. The package zendframework/zend-httphandlerrunner
14 * now provides this functionality.
16 class SapiEmitter implements EmitterInterface
21 * Emits a response for a PHP SAPI environment.
23 * Emits the status line and headers via the header() function, and the
24 * body content via the output buffer.
26 * @param ResponseInterface $response
28 public function emit(ResponseInterface $response)
30 $this->assertNoPreviousOutput();
32 $this->emitHeaders($response);
33 $this->emitStatusLine($response);
34 $this->emitBody($response);
38 * Emit the message body.
40 * @param ResponseInterface $response
42 private function emitBody(ResponseInterface $response)
44 echo $response->getBody();