상속: extends Evenement\EventEmitter, implements Phergie\Irc\Client\React\ClientInterface, implements Phergie\Irc\Client\React\LoopAwareInterface, implements Phergie\Irc\Client\React\LoopAccessorInterface
예제 #1
0
파일: EventBinder.php 프로젝트: stil/phoebe
 /**
  * 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);
         });
     }
 }
 /**
  * @param ConstructEvent $event
  */
 public function construct(ConstructEvent $event)
 {
     $client = new Client();
     $client->setLoop($event->getLoop());
     $bot = new Bot();
     $bot->setConfig(Configure::read('WyriHaximus.Phergie.config'));
     $bot->setClient($client);
     $bot->run(false);
     EventManager::instance()->dispatch(StartEvent::create($event->getLoop(), $bot));
 }
 /**
  * Tests isTimerActive().
  */
 public function testIsTimerActive()
 {
     $timer = $this->getMockTimer();
     $loop = $this->getMockLoop();
     Phake::when($this->client)->getLoop()->thenReturn($loop);
     $this->client->isTimerActive($timer);
     Phake::verify($loop)->isTimerActive($timer);
 }
예제 #4
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);
     });
 }
예제 #5
0
 /**
  * @param ConnectionInterface[] $connections
  * @return void
  */
 public function run(array $connections = [])
 {
     $this->client->run($connections);
 }