diff --git a/src/Composer/EventDispatcher/EventDispatcher.php b/src/Composer/EventDispatcher/EventDispatcher.php index 9c2aee91f..6abb9162a 100644 --- a/src/Composer/EventDispatcher/EventDispatcher.php +++ b/src/Composer/EventDispatcher/EventDispatcher.php @@ -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 *