Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / vendor / zendframework / zend-diactoros / src / Response / SapiStreamEmitter.php
index 02095e50b41162806cd57fe06b3746eae9d2aeda..9da36ff8439da7bc1c999c3e329cc02ef66652e0 100644 (file)
@@ -1,18 +1,23 @@
 <?php
 /**
- * Zend Framework (http://framework.zend.com/)
- *
- * @see       http://github.com/zendframework/zend-diactoros for the canonical source repository
- * @copyright Copyright (c) 2015-2016 Zend Technologies USA Inc. (http://www.zend.com)
+ * @see       https://github.com/zendframework/zend-diactoros for the canonical source repository
+ * @copyright Copyright (c) 2015-2018 Zend Technologies USA Inc. (http://www.zend.com)
  * @license   https://github.com/zendframework/zend-diactoros/blob/master/LICENSE.md New BSD License
  */
 
 namespace Zend\Diactoros\Response;
 
 use Psr\Http\Message\ResponseInterface;
-use RuntimeException;
-use Zend\Diactoros\RelativeStream;
 
+use function is_array;
+use function preg_match;
+use function strlen;
+use function substr;
+
+/**
+ * @deprecated since 1.8.0. The package zendframework/zend-httphandlerrunner
+ *     now provides this functionality.
+ */
 class SapiStreamEmitter implements EmitterInterface
 {
     use SapiEmitterTrait;
@@ -28,15 +33,9 @@ class SapiStreamEmitter implements EmitterInterface
      */
     public function emit(ResponseInterface $response, $maxBufferLength = 8192)
     {
-        if (headers_sent()) {
-            throw new RuntimeException('Unable to emit response; headers already sent');
-        }
-
-        $response = $this->injectContentLength($response);
-
-        $this->emitStatusLine($response);
+        $this->assertNoPreviousOutput();
         $this->emitHeaders($response);
-        $this->flush();
+        $this->emitStatusLine($response);
 
         $range = $this->parseContentRange($response->getHeaderLine('Content-Range'));