예제 #1
0
 /**
  * Trigger an event or array of events
  *
  * @param string|array $eventName
  * @param array $data (optional) Array of data to pass along to the event handler
  * @return array
  *
  */
 public function trigger(&$HandlerObject, $eventName, $data = array())
 {
     if (!is_array($eventName)) {
         $eventName = array($eventName);
     }
     $eventNames = Set::filter($eventName);
     foreach ($eventNames as $eventName) {
         $eventData = EventCore::__parseEventName($eventName);
         $return[$eventData['event']] = EventCore::__dispatchEvent($HandlerObject, $eventData['scope'], $eventData['event'], $data);
     }
     return $return;
 }