React\HttpClient\Response::__construct PHP Method

__construct() public method

public __construct ( React\Stream\ReadableStreamInterface $stream, $protocol, $version, $code, $reasonPhrase, $headers )
$stream React\Stream\ReadableStreamInterface
    public function __construct(ReadableStreamInterface $stream, $protocol, $version, $code, $reasonPhrase, $headers)
    {
        $this->stream = $stream;
        $this->protocol = $protocol;
        $this->version = $version;
        $this->code = $code;
        $this->reasonPhrase = $reasonPhrase;
        $this->headers = $headers;
        $normalizedHeaders = array_change_key_case($headers, CASE_LOWER);
        if (isset($normalizedHeaders['transfer-encoding']) && strtolower($normalizedHeaders['transfer-encoding']) === 'chunked') {
            $this->stream = new ChunkedStreamDecoder($stream);
            foreach ($this->headers as $key => $value) {
                if (strcasecmp('transfer-encoding', $key) === 0) {
                    unset($this->headers[$key]);
                    break;
                }
            }
        }
        $this->stream->on('data', array($this, 'handleData'));
        $this->stream->on('error', array($this, 'handleError'));
        $this->stream->on('end', array($this, 'handleEnd'));
    }