comparison vendor/symfony/event-dispatcher/EventDispatcherInterface.php @ 4:a9cd425dd02b

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:11:55 +0000
parents c75dbcec494b
children
comparison
equal deleted inserted replaced
3:307d7a7fd348 4:a9cd425dd02b
21 interface EventDispatcherInterface 21 interface EventDispatcherInterface
22 { 22 {
23 /** 23 /**
24 * Dispatches an event to all registered listeners. 24 * Dispatches an event to all registered listeners.
25 * 25 *
26 * @param string $eventName The name of the event to dispatch. The name of 26 * @param string $eventName The name of the event to dispatch. The name of
27 * the event is the name of the method that is 27 * the event is the name of the method that is
28 * invoked on listeners. 28 * invoked on listeners.
29 * @param Event $event The event to pass to the event handlers/listeners 29 * @param Event|null $event The event to pass to the event handlers/listeners
30 * If not supplied, an empty Event instance is created 30 * If not supplied, an empty Event instance is created
31 * 31 *
32 * @return Event 32 * @return Event
33 */ 33 */
34 public function dispatch($eventName, Event $event = null); 34 public function dispatch($eventName, Event $event = null);
35 35
44 public function addListener($eventName, $listener, $priority = 0); 44 public function addListener($eventName, $listener, $priority = 0);
45 45
46 /** 46 /**
47 * Adds an event subscriber. 47 * Adds an event subscriber.
48 * 48 *
49 * The subscriber is asked for all the events he is 49 * The subscriber is asked for all the events it is
50 * interested in and added as a listener for these events. 50 * interested in and added as a listener for these events.
51 */ 51 */
52 public function addSubscriber(EventSubscriberInterface $subscriber); 52 public function addSubscriber(EventSubscriberInterface $subscriber);
53 53
54 /** 54 /**
62 public function removeSubscriber(EventSubscriberInterface $subscriber); 62 public function removeSubscriber(EventSubscriberInterface $subscriber);
63 63
64 /** 64 /**
65 * Gets the listeners of a specific event or all listeners sorted by descending priority. 65 * Gets the listeners of a specific event or all listeners sorted by descending priority.
66 * 66 *
67 * @param string $eventName The name of the event 67 * @param string|null $eventName The name of the event
68 * 68 *
69 * @return array The event listeners for the specified event, or all event listeners by event name 69 * @return array The event listeners for the specified event, or all event listeners by event name
70 */ 70 */
71 public function getListeners($eventName = null); 71 public function getListeners($eventName = null);
72 72
83 public function getListenerPriority($eventName, $listener); 83 public function getListenerPriority($eventName, $listener);
84 84
85 /** 85 /**
86 * Checks whether an event has any registered listeners. 86 * Checks whether an event has any registered listeners.
87 * 87 *
88 * @param string $eventName The name of the event 88 * @param string|null $eventName The name of the event
89 * 89 *
90 * @return bool true if the specified event has any listeners, false otherwise 90 * @return bool true if the specified event has any listeners, false otherwise
91 */ 91 */
92 public function hasListeners($eventName = null); 92 public function hasListeners($eventName = null);
93 } 93 }