Example #1
0
 /**
  * Binds Phergie events to the dispatcher
  * @param  array  $binds Array of the binded events
  * @return void
  */
 protected function bindMethods(array $binds)
 {
     $self = $this;
     foreach ($binds as $eventName => $methodName) {
         $this->client->on($eventName, function () use($self, $methodName, $eventName) {
             $self->{$methodName}(func_get_args(), $eventName);
         });
     }
 }
Example #2
0
 /**
  * Watches for a DC and reconnects to IRC
  */
 private function attachDisconnectListener()
 {
     $this->client->on('connect.end', function (Connection $connection, LoggerInterface $logger) {
         /**
          * @var Connection $connection
          * @var Client     $client
          */
         $logger->debug('Connection to ' . $connection->getServerHostname() . ' lost, attempting to reconnect');
         $this->client->addConnection($connection);
     });
 }