示例#1
0
 /**
  * Binds events specified in the events property.
  * 
  * @return void
  * @throws \Zumba\Symbiosis\Exception\NotCollableException
  */
 public function bindPluginEvents()
 {
     foreach ($this->getEvents() as $key => $callbacks) {
         if (is_array($callbacks) && (!isset($callbacks[0]) || !is_array($callbacks[0]))) {
             $callbacks = [$callbacks];
         }
         foreach ((array) $callbacks as $callback) {
             $this->context->register($key, $callback);
         }
     }
 }
示例#2
0
 /**
  * Trigger an event to the bound context of this plugin manager.
  *
  * @param Zumba\Symbiosis\Event\Event $event
  * @param array $data
  * @return boolean
  */
 public function trigger(Event $event, $data = array())
 {
     if (!$this->context instanceof EventRegistry) {
         return EventManager::trigger($event, $data);
     }
     return $this->context->trigger($event, $data);
 }