Added a new method to check if an event has any listeners registered.
parent
a12ed492ef
commit
067a8e764f
|
@ -220,6 +220,19 @@ class EventDispatcher
|
||||||
return call_user_func_array('array_merge', $listeners[$event->getName()]);
|
return call_user_func_array('array_merge', $listeners[$event->getName()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if an event has listeners registered
|
||||||
|
*
|
||||||
|
* @param Event $event
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function hasEventListeners(Event $event)
|
||||||
|
{
|
||||||
|
$listeners = $this->getListeners($event);
|
||||||
|
|
||||||
|
return (sizeof($listeners) > 0);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finds all listeners defined as scripts in the package
|
* Finds all listeners defined as scripts in the package
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue