Icicle\Concurrent\Sync\ChannelledStream::__construct PHP Метод

__construct() публичный Метод

Creates a new channel instance.
public __construct ( ReadableStream $read, WritableStream $write = null )
$read ReadableStream
$write WritableStream
    public function __construct(ReadableStream $read, WritableStream $write = null)
    {
        if (null === $write) {
            if (!$read instanceof DuplexStream) {
                throw new InvalidArgumentError('Must provide a duplex stream if not providing a write stream.');
            }
            $this->write = $read;
        } else {
            $this->write = $write;
        }
        $this->read = $read;
        $this->errorHandler = function ($errno, $errstr) {
            throw new ChannelException(sprintf('Received corrupted data. Errno: %d; %s', $errno, $errstr));
        };
    }