/**
  * Tests setCustomParams().
  */
 public function testSetCustomParams()
 {
     $params = array('foo', 'bar');
     $this->event->setCustomParams($params);
     $this->assertSame($params, $this->event->getCustomParams());
 }
 public function handleMessage(UserEvent $event, Queue $queue)
 {
     // make sure we don't react twice when the nfo command gets triggered
     if (strpos($event->getMessage(), 'nfo ') === false) {
         if (preg_match_all("/[a-z0-9._]{4,}-[a-z0-9]{3,}/i", $event->getMessage(), $matches)) {
             $matches = array_slice($matches[0], 0, $this->limit);
             foreach ($matches as $dirname) {
                 $commandEvent = new CommandEvent();
                 $commandEvent->fromEvent($event);
                 $commandEvent->setCustomParams(array($dirname));
                 $this->handleNfoCommand($commandEvent, $queue, false);
             }
         }
     }
 }
 /**
  * Forwards events for command aliases to handlers for their corresponding
  * commands.
  *
  * @param string $alias
  * @param string $command
  * @param string $eventName
  * @param array  $customParameters
  * @param \Phergie\Irc\Plugin\React\Command\CommandEvent $event
  * @param \Phergie\Irc\Bot\React\EventQueueInterface $queue
  */
 public function forwardEvent($alias, $command, $eventName, $customParameters, Event $event, Queue $queue)
 {
     if (is_array($customParameters)) {
         $eventCustomParams = $event->getCustomParams();
         if (is_array($eventCustomParams)) {
             $event->setCustomParams(array_merge($customParameters, $eventCustomParams));
         } else {
             $event->setCustomParams($customParameters);
         }
     }
     $logger = $this->getLogger();
     $emitter = $this->getEventEmitter();
     $listeners = $emitter->listeners($eventName);
     if (!$listeners) {
         $logger->warning('Alias references unknown command', array('alias' => $alias, 'command' => $command));
         return;
     }
     $logger->debug('Forwarding event', array('event_name' => $eventName, 'alias' => $alias, 'command' => $command));
     // Set the event customCommand to match the command being aliased
     $event->setCustomCommand($command);
     $emitter->emit($eventName, array($event, $queue));
 }