annotate vendor/zendframework/zend-diactoros/src/Response/SapiEmitter.php @ 12:7a779792577d

Update Drupal core to v8.4.5 (via Composer)
author Chris Cannam
date Fri, 23 Feb 2018 15:52:07 +0000
parents 4c8ae668cc8c
children c2387f117808
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@12 4 * @copyright Copyright (c) 2015-2017 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 use RuntimeException;
Chris@0 12
Chris@0 13 class SapiEmitter implements EmitterInterface
Chris@0 14 {
Chris@0 15 use SapiEmitterTrait;
Chris@0 16
Chris@0 17 /**
Chris@0 18 * Emits a response for a PHP SAPI environment.
Chris@0 19 *
Chris@0 20 * Emits the status line and headers via the header() function, and the
Chris@0 21 * body content via the output buffer.
Chris@0 22 *
Chris@0 23 * @param ResponseInterface $response
Chris@0 24 */
Chris@12 25 public function emit(ResponseInterface $response)
Chris@0 26 {
Chris@12 27 $this->assertNoPreviousOutput();
Chris@0 28
Chris@12 29 $this->emitHeaders($response);
Chris@0 30 $this->emitStatusLine($response);
Chris@0 31 $this->emitBody($response);
Chris@0 32 }
Chris@0 33
Chris@0 34 /**
Chris@0 35 * Emit the message body.
Chris@0 36 *
Chris@0 37 * @param ResponseInterface $response
Chris@0 38 */
Chris@0 39 private function emitBody(ResponseInterface $response)
Chris@0 40 {
Chris@0 41 echo $response->getBody();
Chris@0 42 }
Chris@0 43 }