| 1 |
<?php |
| 2 |
/* |
| 3 |
* This file is part of the ManageWP Worker plugin. |
| 4 |
* |
| 5 |
* (c) ManageWP LLC <contact@managewp.com> |
| 6 |
* |
| 7 |
* For the full copyright and license information, please view the LICENSE |
| 8 |
* file that was distributed with this source code. |
| 9 |
*/ |
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
class MWP_Http_StreamingResponse extends MWP_Http_Response implements MWP_Http_StreamingResponseInterface |
| 14 |
{ |
| 15 |
|
| 16 |
|
| 17 |
public function __construct($stream, $statusCode = 200, array $headers = array()) |
| 18 |
{ |
| 19 |
parent::__construct(new MWP_Stream_Base64EncodedStream($stream), $statusCode, $headers); |
| 20 |
} |
| 21 |
|
| 22 |
/** |
| 23 |
* {@inheritdoc} |
| 24 |
*/ |
| 25 |
public function getContentAsString() |
| 26 |
{ |
| 27 |
return base64_decode($this->content); |
| 28 |
} |
| 29 |
|
| 30 |
/** |
| 31 |
* @return MWP_Stream_Interface |
| 32 |
*/ |
| 33 |
public function createResponseStream() |
| 34 |
{ |
| 35 |
return $this->content; |
| 36 |
} |
| 37 |
} |
| 38 |
|