public function testOffWithCallable()
 {
     $o = new Observable();
     $c = function () use(&$res) {
         return '1';
     };
     $o->on('foo', $c);
     $o->on('foo', function () use(&$res) {
         return '1';
     });
     $o->on('foo', $c);
     $this->assertEquals(3, $o->hasListeners('foo'));
     $o->off('foo', $c);
     $this->assertEquals(1, $o->hasListeners('foo'));
 }
예제 #2
0
 public function subscribe($channel, $cb, $timeToken = 0, $presence = false)
 {
     $this->observer->on('message', $cb);
 }