Example #1
0
 /**
  * @param string $key
  * @param callable $action
  * @return Handler
  */
 protected static function genHandler($key, $action)
 {
     list($key, $function) = explode('.', $key, 2);
     $handler = new Handler();
     $handler->setKey($key);
     $handler->setFunction($function);
     $handler->setClass(get_called_class());
     $handler->setAction($action);
     return $handler;
 }
Example #2
0
 public function testHandlerRecognicesImplementedExtendedInterfaces()
 {
     $handler = new Handler();
     $handler->setKey(Event::PRE);
     $handler->setFunction(__FUNCTION__);
     $handler->setClass('Efficio\\Tests\\Mocks\\Event\\InterfaceTest');
     $this->assertTrue($handler->handles(Event::PRE, 'Efficio\\Tests\\Mocks\\Event\\ClassClassInterfaceTest', __FUNCTION__));
 }