public function __construct(ReadableStreamInterface $input)
{
$this->input = $input;
$that = $this;
$input->on('data', function ($data) use($that) {
$that->emit('data', array($data, $that));
});
$input->on('error', function ($error) use($that) {
$that->emit('error', array($error, $that));
});
$input->on('end', function () use($that) {
$that->emit('end', array($that));
$that->emit('close', array($that));
});
$input->on('close', function () use($that) {
$that->emit('close', array($that));
});
}