Exemple #1
0
 public function provideListeners(ListenerAcceptorInterface $acceptor)
 {
     $reflection = new ReflectionClass($this);
     $acceptor->addListener('message', $reflection->getMethod('handleAvailable')->getClosure($this));
     $acceptor->addListener('message', $reflection->getMethod('handleCheckin')->getClosure($this));
     $acceptor->addListener('message', $reflection->getMethod('handleCheckout')->getClosure($this));
 }
 public function provideListeners(ListenerAcceptorInterface $acceptor)
 {
     $acceptor->addListener('ip', function ($event, $ip) {
         $this->client->get('https://freegeoip.net/json/' . $ip, ['future' => true])->then(function (Response $response) {
             $this->emitter->emit('sse', ['type' => 'geo', 'payload' => $response->json()['region_name']]);
         });
     });
 }
 public function provideListeners(ListenerAcceptorInterface $acceptor)
 {
     $acceptor->addListener('lookup', function ($event, $hostname) {
         $this->resolver->resolve($hostname)->then(function ($ip) {
             $this->emitter->emit('ip', $ip);
             $this->emitter->emit('sse', ['type' => 'dns', 'payload' => $ip]);
         });
     });
 }
 public function provideListeners(ListenerAcceptorInterface $acceptor)
 {
     $acceptor->addListener('lookup', function ($event, $hostname) {
         $this->client->get('http://' . $hostname . '/', ['future' => true])->then(function (Response $response) {
             if (preg_match('/<title>(.+)<\\/title>/', $response->getBody()->getContents(), $matches) && isset($matches[1])) {
                 $title = $matches[1];
                 $this->emitter->emit('sse', ['type' => 'title', 'payload' => $title]);
             }
         });
     });
 }
Exemple #5
0
 public function provideListeners(ListenerAcceptorInterface $acceptor)
 {
     $reflection = new ReflectionClass($this);
     $acceptor->addListener('timer', $reflection->getMethod('sendHolidayInformation')->getClosure($this));
 }
 public function provideListeners(ListenerAcceptorInterface $acceptor)
 {
     $acceptor->addListener(\hass\urlrule\Module::EVENT_URLRULE_PREFIX_ENTITY, [$this, "onAddPrefix"]);
 }
Exemple #7
0
 public function provideListeners(ListenerAcceptorInterface $acceptor)
 {
     $reflection = new ReflectionClass($this);
     $acceptor->addListener('message', $reflection->getMethod('sendLeaderboard')->getClosure($this));
     $acceptor->addListener('timer', $reflection->getMethod('announceNewStars')->getClosure($this));
 }
 public function provideListeners(ListenerAcceptorInterface $acceptor)
 {
     $acceptor->addListener(\hass\menu\Module::EVENT_MENU_LINK_CREATE, [$this, "onCreateLink"]);
 }
Exemple #9
0
 public function provideListeners(ListenerAcceptorInterface $acceptor)
 {
     $reflection = new ReflectionClass($this);
     $handler = $reflection->getMethod('handleMention')->getClosure($this);
     $acceptor->addListener('message', $handler, EmitterInterface::P_LOW);
 }
Exemple #10
0
 public function provideListeners(ListenerAcceptorInterface $acceptor)
 {
     $reflection = new ReflectionClass($this);
     $acceptor->addListener('message', $reflection->getMethod('sendPingReport')->getClosure($this));
     $acceptor->addListener('pong', $reflection->getMethod('updatePing')->getClosure($this));
 }
 public function provideListeners(ListenerAcceptorInterface $acceptor)
 {
     $acceptor->addListener('sse', function ($event, $data) {
         $this->channel->writeMessage(json_encode($data));
     });
 }
Exemple #12
0
 public function provideListeners(ListenerAcceptorInterface $acceptor)
 {
     $reflection = new ReflectionClass($this);
     $acceptor->addListener('message', $reflection->getMethod('sendJiraIssues')->getClosure($this));
 }
 public function provideListeners(ListenerAcceptorInterface $acceptor)
 {
     $acceptor->addListener(\hass\search\Module::EVENT_SEARCH_CONFIG, [$this, "onEvent"]);
 }
Exemple #14
0
 public function provideListeners(ListenerAcceptorInterface $acceptor)
 {
     $acceptor->addListener(\hass\rbac\Module::EVENT_RBAC_PERMISSION, [$this, "onAddPermission"], ListenerAcceptorInterface::P_HIGH);
 }