Mercurial > hg > isophonics-drupal-site
annotate vendor/zendframework/zend-diactoros/src/Response/SapiEmitter.php @ 19:fa3358dc1485 tip
Add ndrum files
author | Chris Cannam |
---|---|
date | Wed, 28 Aug 2019 13:14:47 +0100 |
parents | c2387f117808 |
children |
rev | line source |
---|---|
Chris@0 | 1 <?php |
Chris@0 | 2 /** |
Chris@12 | 3 * @see https://github.com/zendframework/zend-diactoros for the canonical source repository |
Chris@16 | 4 * @copyright Copyright (c) 2015-2018 Zend Technologies USA Inc. (http://www.zend.com) |
Chris@0 | 5 * @license https://github.com/zendframework/zend-diactoros/blob/master/LICENSE.md New BSD License |
Chris@0 | 6 */ |
Chris@0 | 7 |
Chris@0 | 8 namespace Zend\Diactoros\Response; |
Chris@0 | 9 |
Chris@0 | 10 use Psr\Http\Message\ResponseInterface; |
Chris@0 | 11 |
Chris@16 | 12 /** |
Chris@16 | 13 * @deprecated since 1.8.0. The package zendframework/zend-httphandlerrunner |
Chris@16 | 14 * now provides this functionality. |
Chris@16 | 15 */ |
Chris@0 | 16 class SapiEmitter implements EmitterInterface |
Chris@0 | 17 { |
Chris@0 | 18 use SapiEmitterTrait; |
Chris@0 | 19 |
Chris@0 | 20 /** |
Chris@0 | 21 * Emits a response for a PHP SAPI environment. |
Chris@0 | 22 * |
Chris@0 | 23 * Emits the status line and headers via the header() function, and the |
Chris@0 | 24 * body content via the output buffer. |
Chris@0 | 25 * |
Chris@0 | 26 * @param ResponseInterface $response |
Chris@0 | 27 */ |
Chris@12 | 28 public function emit(ResponseInterface $response) |
Chris@0 | 29 { |
Chris@12 | 30 $this->assertNoPreviousOutput(); |
Chris@0 | 31 |
Chris@12 | 32 $this->emitHeaders($response); |
Chris@0 | 33 $this->emitStatusLine($response); |
Chris@0 | 34 $this->emitBody($response); |
Chris@0 | 35 } |
Chris@0 | 36 |
Chris@0 | 37 /** |
Chris@0 | 38 * Emit the message body. |
Chris@0 | 39 * |
Chris@0 | 40 * @param ResponseInterface $response |
Chris@0 | 41 */ |
Chris@0 | 42 private function emitBody(ResponseInterface $response) |
Chris@0 | 43 { |
Chris@0 | 44 echo $response->getBody(); |
Chris@0 | 45 } |
Chris@0 | 46 } |