Created
November 15, 2015 20:44
-
-
Save WyriHaximus/966dc78c1d0771ea105b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| class Response implements ReadableStreamInterface | |
| { | |
| public function __construct(DuplexStreamInterface $stream, $protocol, $version, $code, $reasonPhrase, $headers) | |
| { | |
| $this->stream = $stream; | |
| $this->protocol = $protocol; | |
| $this->version = $version; | |
| $this->code = $code; | |
| $this->reasonPhrase = $reasonPhrase; | |
| $this->headers = $headers; | |
| if (isset($this->headers['Content-Encoding']) && $this->headers['Content-Encoding'] == 'gzip') { | |
| $this->stream = $this->stream->pipe(ZlibFilterStream::createGzipDecompressor()); | |
| } | |
| $this->stream->on('data', array($this, 'handleData')); | |
| $this->stream->on('error', array($this, 'handleError')); | |
| $this->stream->on('end', array($this, 'handleEnd')); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment