Esempio n. 1
0
File: IRC.php Progetto: nkreer/Fish
 public function handle(Command $run, Connection $connection)
 {
     $ev = new ConnectionActivityEvent($connection, $run);
     $connection->getEventHandler()->callEvent($ev);
     if (!$ev->isCancelled()) {
         $command = $run->getCommand();
         if (is_numeric($command)) {
             $command = "_" . $command;
         }
         $function = '\\IRC\\Protocol\\' . strtoupper($command);
         if (method_exists($function, "run")) {
             // Most stupid hack ever, but it gets the job done
             call_user_func($function . "::run", $run, $connection, $this->getConfig());
         } else {
             // Handle unknown commands
             $unknownEvent = new ConnectionUnknownCommandEvent($connection, $run);
             $connection->getEventHandler()->callEvent($unknownEvent);
         }
     }
 }