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

getWriteCallback() protected method

Returns a callback for proxying events from the write stream to IRC listeners of the client.
protected getWriteCallback ( 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 getWriteCallback(WriteStream $write, ConnectionInterface $connection)
    {
        $logger = $this->getLogger();
        return function ($message) use($write, $connection, $logger) {
            $this->emit('irc.sent', array($message, $write, $connection, $logger));
        };
    }