1
0
Fork 0

Added a new method to check if an event has any listeners registered.

pull/2516/head
Max Gfeller 2013-12-19 08:48:41 +01:00
parent a12ed492ef
commit 067a8e764f
1 changed files with 13 additions and 0 deletions

View File

@ -220,6 +220,19 @@ class EventDispatcher
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
*