added new socket manager, errorhandling and testing is not finished yet

This commit is contained in:
kremsy
2015-06-21 20:43:18 +02:00
parent eaf8819a57
commit fc5a3e04b6
32 changed files with 2627 additions and 0 deletions

View File

@ -0,0 +1,33 @@
<?php
namespace React\Stream;
class ThroughStream extends CompositeStream
{
public function __construct()
{
$readable = new ReadableStream();
$writable = new WritableStream();
parent::__construct($readable, $writable);
}
public function filter($data)
{
return $data;
}
public function write($data)
{
$this->readable->emit('data', array($this->filter($data), $this));
}
public function end($data = null)
{
if (null !== $data) {
$this->readable->emit('data', array($this->filter($data), $this));
}
$this->writable->end($data);
}
}