3 * @see https://github.com/zendframework/zend-diactoros for the canonical source repository
4 * @copyright Copyright (c) 2015-2017 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 class SapiEmitter implements EmitterInterface
18 * Emits a response for a PHP SAPI environment.
20 * Emits the status line and headers via the header() function, and the
21 * body content via the output buffer.
23 * @param ResponseInterface $response
25 public function emit(ResponseInterface $response)
27 $this->assertNoPreviousOutput();
29 $this->emitHeaders($response);
30 $this->emitStatusLine($response);
31 $this->emitBody($response);
35 * Emit the message body.
37 * @param ResponseInterface $response
39 private function emitBody(ResponseInterface $response)
41 echo $response->getBody();