Phergie\Irc\Bot\React\Bot::processOutgoingEvents PHP Method

processOutgoingEvents() public method

Callback to process any queued outgoing events. Not intended to be called from outside thie class.
public processOutgoingEvents ( Phergie\Irc\ConnectionInterface $connection, Phergie\Irc\Client\React\WriteStream $write )
$connection Phergie\Irc\ConnectionInterface Connection on which the event occurred
$write Phergie\Irc\Client\React\WriteStream Stream used to send commands to the server
    public function processOutgoingEvents(ConnectionInterface $connection, WriteStream $write)
    {
        $client = $this->getClient();
        $queue = $this->getEventQueueFactory()->getEventQueue($connection);
        $client->emit('irc.sending.all', [$queue]);
        while ($extracted = $queue->extract()) {
            $extracted->setConnection($connection);
            $params = [$extracted, $queue];
            $subtype = $this->getEventSubtype($extracted);
            $client->emit('irc.sending.each', $params);
            $client->emit('irc.sending.' . $subtype, $params);
            if ($extracted instanceof CtcpEvent) {
                $method = 'ctcp' . $extracted->getCtcpCommand();
                if ($extracted->getCommand() === 'NOTICE') {
                    $method .= 'Response';
                }
            } else {
                $method = 'irc' . $extracted->getCommand();
            }
            call_user_func_array([$write, $method], $extracted->getParams());
        }
    }