0db003f6677c7734908c654e82c29dc6ffdf2698
[yaffs-website] / vendor / zendframework / zend-diactoros / src / Response / SapiEmitter.php
1 <?php
2 /**
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
6  */
7
8 namespace Zend\Diactoros\Response;
9
10 use Psr\Http\Message\ResponseInterface;
11
12 /**
13  * @deprecated since 1.8.0. The package zendframework/zend-httphandlerrunner
14  *     now provides this functionality.
15  */
16 class SapiEmitter implements EmitterInterface
17 {
18     use SapiEmitterTrait;
19
20     /**
21      * Emits a response for a PHP SAPI environment.
22      *
23      * Emits the status line and headers via the header() function, and the
24      * body content via the output buffer.
25      *
26      * @param ResponseInterface $response
27      */
28     public function emit(ResponseInterface $response)
29     {
30         $this->assertNoPreviousOutput();
31
32         $this->emitHeaders($response);
33         $this->emitStatusLine($response);
34         $this->emitBody($response);
35     }
36
37     /**
38      * Emit the message body.
39      *
40      * @param ResponseInterface $response
41      */
42     private function emitBody(ResponseInterface $response)
43     {
44         echo $response->getBody();
45     }
46 }