comparison vendor/zendframework/zend-diactoros/src/Response/SapiStreamEmitter.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
comparison
equal deleted inserted replaced
11:bfffd8d7479a 12:7a779792577d
1 <?php 1 <?php
2 /** 2 /**
3 * Zend Framework (http://framework.zend.com/) 3 * @see https://github.com/zendframework/zend-diactoros for the canonical source repository
4 * 4 * @copyright Copyright (c) 2015-2017 Zend Technologies USA Inc. (http://www.zend.com)
5 * @see http://github.com/zendframework/zend-diactoros for the canonical source repository
6 * @copyright Copyright (c) 2015-2016 Zend Technologies USA Inc. (http://www.zend.com)
7 * @license https://github.com/zendframework/zend-diactoros/blob/master/LICENSE.md New BSD License 5 * @license https://github.com/zendframework/zend-diactoros/blob/master/LICENSE.md New BSD License
8 */ 6 */
9 7
10 namespace Zend\Diactoros\Response; 8 namespace Zend\Diactoros\Response;
11 9
26 * @param ResponseInterface $response 24 * @param ResponseInterface $response
27 * @param int $maxBufferLength Maximum output buffering size for each iteration 25 * @param int $maxBufferLength Maximum output buffering size for each iteration
28 */ 26 */
29 public function emit(ResponseInterface $response, $maxBufferLength = 8192) 27 public function emit(ResponseInterface $response, $maxBufferLength = 8192)
30 { 28 {
31 if (headers_sent()) { 29 $this->assertNoPreviousOutput();
32 throw new RuntimeException('Unable to emit response; headers already sent'); 30 $this->emitHeaders($response);
33 }
34
35 $response = $this->injectContentLength($response);
36
37 $this->emitStatusLine($response); 31 $this->emitStatusLine($response);
38 $this->emitHeaders($response);
39 $this->flush();
40 32
41 $range = $this->parseContentRange($response->getHeaderLine('Content-Range')); 33 $range = $this->parseContentRange($response->getHeaderLine('Content-Range'));
42 34
43 if (is_array($range) && $range[0] === 'bytes') { 35 if (is_array($range) && $range[0] === 'bytes') {
44 $this->emitBodyRange($range, $response, $maxBufferLength); 36 $this->emitBodyRange($range, $response, $maxBufferLength);