Phergie\Irc\Client\React\Client::getReadCallback PHP Method

getReadCallback() protected method

Returns a callback for proxying IRC events from the read stream to IRC listeners of the client.
protected getReadCallback ( Phergie\Irc\Client\React\WriteStream $write, Phergie\Irc\ConnectionInterface $connection ) : callable
$write Phergie\Irc\Client\React\WriteStream Write stream corresponding to the read stream on which the event occurred
$connection Phergie\Irc\ConnectionInterface Connection on which the event occurred
return callable
    protected function getReadCallback(WriteStream $write, ConnectionInterface $connection)
    {
        $logger = $this->getLogger();
        return function ($message) use($write, $connection, $logger) {
            $this->processInput($message, $write, $connection);
            $this->emit('irc.received', array($message, $write, $connection, $logger));
        };
    }