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'));
 }
Ejemplo n.º 2
0
 public function receiveMessage($message)
 {
     $this->observer->emit('message', array('message' => $message, 'channel' => null, 'timeToken' => time()));
 }