Example #1
0
 /**
  * Unsubscribe a slot from a signal 
  * 
  * @param  SignalHandler $slot 
  * @return bool Returns true if signal and handle found, and unsubscribed; returns false if either signal or handle not found
  */
 public function detach(SignalHandler $slot)
 {
     $signal = $slot->getSignal();
     if (empty($this->_signals[$signal])) {
         return false;
     }
     if (false === ($index = array_search($slot, $this->_signals[$signal]))) {
         return false;
     }
     unset($this->_signals[$signal][$index]);
     return true;
 }
Example #2
0
 public function testGetSignalShouldReturnSignal()
 {
     $handler = new SignalHandler('foo', 'rand');
     $this->assertEquals('foo', $handler->getSignal());
 }