本文整理匯總了PHP中OW_Event::getName方法的典型用法代碼示例。如果您正苦於以下問題:PHP OW_Event::getName方法的具體用法?PHP OW_Event::getName怎麽用?PHP OW_Event::getName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類OW_Event
的用法示例。
在下文中一共展示了OW_Event::getName方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: triggerEvent
private function triggerEvent(OW_Event $event)
{
if (in_array($event->getName(), $this->disabledEvents)) {
return $event;
}
return OW::getEventManager()->trigger($event);
}
示例2: call
/**
* Calls last event listener and returns it's result value.
*
* @param string $eventName
* @param array $eventParams
* @return mixed
*/
public function call($eventName, $eventParams = array())
{
$event = new OW_Event($eventName, $eventParams);
if (!empty($this->listeners[$eventName])) {
ksort($this->listeners[$event->getName()]);
// log triggered events for developer mode
if ($this->devMode) {
$startTime = UTIL_Profiler::getInstance()->getTotalTime();
$this->profiler->reset();
$handlers = reset($this->listeners[$eventName]);
$result = call_user_func(end($handlers), $event);
if (!in_array($event->getName(), $this->eventsToSkip) && count($this->eventsLog) < $this->maxItemsInLog) {
$this->eventsLog[] = array('type' => 'call', 'start' => $startTime, 'exec' => $this->profiler->getTotalTime(), 'event' => $event, 'listeners' => $this->listeners[$event->getName()]);
}
} else {
$handlers = reset($this->listeners[$eventName]);
$result = call_user_func(end($handlers), $event);
}
return $result;
} else {
// log events with no listeners
$startTime = UTIL_Profiler::getInstance()->getTotalTime();
if ($this->devMode && !in_array($event->getName(), $this->eventsToSkip) && count($this->eventsLog) < $this->maxItemsInLog) {
$this->eventsLog[] = array('type' => 'call', 'start' => $startTime, 'event' => $event, 'listeners' => array(), 'exec' => 0);
}
}
}