annotate vendor/zendframework/zend-diactoros/src/Response/SapiEmitter.php @ 4:a9cd425dd02b

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:11:55 +0000
parents 5311817fb629
children
rev   line source
Chris@0 1 <?php
Chris@0 2 /**
Chris@2 3 * @see https://github.com/zendframework/zend-diactoros for the canonical source repository
Chris@2 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@2 12 /**
Chris@2 13 * @deprecated since 1.8.0. The package zendframework/zend-httphandlerrunner
Chris@2 14 * now provides this functionality.
Chris@2 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@2 28 public function emit(ResponseInterface $response)
Chris@0 29 {
Chris@2 30 $this->assertNoPreviousOutput();
Chris@0 31
Chris@2 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 }