for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace mpyw\HyperBuiltinServer\Internal;
use React\Socket\ConnectionInterface;
use React\Stream\WritableStreamInterface;
class Sink
{
protected $src;
protected $dst;
protected $buffer = '';
protected $end = false;
public function __construct(ConnectionInterface $src)
$this->src = $src;
$src->on('data', function ($data) {
$this->buffer .= $data;
if ($this->dst) {
$this->dst->write($this->buffer);
$this->buffer = '';
}
});
$src->on('end', function () {
$this->end = true;
$this->dst->end();
$src->on('error', function () {
public function pipe(WritableStreamInterface $dst)
$this->dst = $dst;
if ($this->buffer !== '') {
if ($this->end) {