Responds with a magic eight ball phrase when asked questions

@param \Phergie\Irc\Event\EventInterface $event
@param \Phergie\Irc\Bot\React\EventQueueInterface $queue
497879
public function handleEvent(Event $event, Queue $queue)
    {
        if ($event instanceof UserEvent) {
            $nick = $event->getNick();
            $channel = $event->getSource();
            $params = $event->getParams();
            $text = $params['text'];
            $matched = stripos($text, '8 ball') !== false;
            if ($matched) {
                $msg = $nick . ', the magic 8 ball says "' . $this->getMagicEightBallAnswer() . '"';
                $queue->ircPrivmsg($channel, $msg);
            }
        }
    }
1025269
protected function matchEventQueues(
        /*# string */ $eventName
    )/*: EventQueueInterface */ {
        $nqueue = $this->newEventQueue();
        $names  = $this->globbingNames($eventName, $this->getEventNames());
        foreach ($names as $evtName) {
            if ($this->hasEvent($evtName)) {
                $nqueue = $nqueue->combine($this->events[$evtName]);
            }
        }
        return $nqueue;
    }
496240
public function setEventQueue(Event $event, Queue $queue)
    {
        $mask = $this->getConnectionMask($event->getConnection());
        $this->getEventQueueDeferred($mask)->resolve($queue);
    }
1143383
public function handle(EventInterface $event)
    {
        if ($event instanceof StatsEvent) {
            $this->writeProgressionLine('');
            $this->style->success('Phar creation successful');
            $this->style->table([], [
                ['Path', '<info>' . $event->getStats()->getFinalPath() . '</info>'],
                ['File size', '<info>' . $event->getSize() . '</info>'],
                ['Process duration', '<info>' . $event->getDuration() . '</info>']
            ]);
        }

        if ($event instanceof BuilderAddEvent) {
            $this->writeProgressionLine('Adding <comment>' . $event->getPath() . '</comment>');
        }

        if ($event instanceof CompressorEvent) {
            $this->writeProgressionLine('<info>Compressing...</info>');
        }

        if (0 === strpos($event->getName(), 'options.')) {
            $this->writeProgressionLine(
                '<comment>Read options...</comment> (' . ucfirst(substr($event->getName(), \strlen('options.'))) . ')',
                true
            );
        }
    }
492151
public function onRequestBeforeSend(Event $event)
    {
        if (!$this->queue) {
            throw new \OutOfBoundsException('Mock queue is empty');
        }

        $request = $event['request'];
        $this->received[] = $request;
        // Detach the filter from the client so it's a one-time use
        if ($this->temporary && count($this->queue) == 1 && $request->getClient()) {
            $request->getClient()->getEventDispatcher()->removeSubscriber($this);
        }
        $this->dequeue($request);
    }
915611
private function getIronMqQueueName(GetResponseEvent $event, array&$message) {
		if (array_key_exists('_qpush_queue', $message)) {
			return $message['_qpush_queue'];
		} else if (null !== ($subscriberUrl = $event->getRequest()->headers->get('iron-subscriber-message-url'))) {
			if (preg_match('#/queues/([a-z0-9_-]+)/messages/#i', $subscriberUrl, $matches)) {
				$queue = $matches[1];
				if (substr($queue, 0, 6) == 'qpush_') {
					$queue = substr($queue, 6);
				}

				return $queue;
			}
		}

		throw new \RuntimeException('Unable to get queue name');
	}
783095
public function deliverMessage(UserEventInterface $event, EventQueueInterface $queue)
    {
        if ($event->getNick() != $event->getConnection()->getNickname()) {
            $messages = $this->database->retrieveMessages($event->getNick());
            foreach ($messages as $row) {
                $message = sprintf('(%s) %s: %s',
                    (new \DateTime($row['timestamp']))->format('m/d h:ia'),
                    $row['sender'],
                    $row['message']);
                $queue->ircNotice($event->getNick(), $message);
            }
        }
    }
623105
protected function dispatch($queueEvent)
    {
        $event = urldecode($queueEvent->data);
        $event = unserialize($event);

        if ($event) {
            $this->dispatcher->dispatch($event::NAME, $event);

            if ($event->getHasError()) {
                $this->setError($queueEvent->id);
                $this->response($event::NAME, $event->getError(), 'ERROR', $event->getParam());
            } else {
                $this->response($event::NAME, $event->getReturnMessages(), 'NOTICE', $event->getParam());
            }

            return $event;
        }
    }
625799
public function onPartChannels(UserEventInterface $event, EventQueueInterface $queue)
    {
        $this->joinOnMatch($event->getNick(), $event, $queue);
    }
363355
public function handleActCommand(Event $event, Queue $queue)
    {
        $params = $event->getCustomParams();
        if (count($params) < 2) {
            $this->handleActHelp($event, $queue);
        } else {
            $channels = array_shift($params);
            $queue->ctcpAction($channels, implode(' ', $params));
        }
    }
380365
public void enqueue(SnackbarEvent event) {
        synchronized (this) {
            if (!eventsSet.contains(event)) {
                eventsSet.add(event);
                eventQueue.offer(event);
            } else if (currentEvent == event && pauseTransition != null) {
                pauseTransition.playFromStart();
            }
        }
        if (processingQueue.compareAndSet(false, true)) {
            Platform.runLater(() -> {
                currentEvent = eventQueue.poll();
                if (currentEvent != null) {
                    show(currentEvent);
                }
            });
        }
    }
580083
public function addMessageToQueue($message, $queue)
    {
        $this->queue->sendMessage([
            'QueueUrl' => $this->getQueueURL($queue),
            'MessageBody' => $message,
        ]);
    }
1163825
protected function matchEventQueue(
        /*# string */ $eventName,
        EventManagerInterface $manager
    )/*# : EventQueueInterface */ {
        $names = $this->globNames($eventName, $manager->getEventNames());

        // combine all globbing queue
        $queue = new EventQueue();
        foreach ($names as $n) {
            if ($manager->hasEventQueue($n)) {
                $queue = $queue->combine($manager->getEventQueue($n));
            }
        }

        return $queue;
    }
1332637
protected static function _buffer($queue){
        $should_flush_buffer = false;

        $event_buffer_counted       = self::$_busy_event_buffer_counter + self::$_idle_event_buffer_counter;
        $event_buffer_time_consumed = time() - self::$_buffer_last_flush_ts;

        if ( $event_buffer_counted >= self::$_event_buffer_count_limit) {
            self::log('[ Info ] event buffer counter limit reached . time cost : ' .$event_buffer_time_consumed);
            $should_flush_buffer = true;
        }

        if ( $event_buffer_time_consumed >= self::$_event_buffer_time_limit ) {
            self::log('[ Info ] event buffer time limit reached .');
            $should_flush_buffer = true;
        }

        if ($should_flush_buffer) {
            self::log('[ Info ] start flushing to redis...');
            self::_flush($queue);
        }
    }
1268146
public function helpCommand(CommandEventInterface $event, EventQueueInterface $queue)
    {
        $command = strpos($event->getCustomCommand(), '.help') !== false
            ? substr($event->getCustomCommand(), 0, -5)
            : $event->getCustomParams()[0];
        $this->helpMessages([ $queue, 'irc'.$event->getCommand() ], $event->getSource(), $command);
    }
1248274
protected function broadcastEvent($event)
    {
        $connection = ($event instanceof ShouldBroadcastNowInterface) ? 'sync' : null;

        $queue = method_exists($event, 'onQueue') ? $event->onQueue() : null;

        $this->resolveQueue()->connection($connection)->pushOn($queue, 'Nova\Broadcasting\BroadcastEvent', array(
            'event' => serialize(clone $event),
        ));
    }
517080
private function getHandlerQueue($event)
    {
        if (!isset($this->handlers[$event])) {
            $this->handlers[$event] = new Priority;
        }

        return $this->handlers[$event];
    }