Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / vendor / symfony / event-dispatcher / EventDispatcherInterface.php
1 <?php
2
3 /*
4  * This file is part of the Symfony package.
5  *
6  * (c) Fabien Potencier <fabien@symfony.com>
7  *
8  * For the full copyright and license information, please view the LICENSE
9  * file that was distributed with this source code.
10  */
11
12 namespace Symfony\Component\EventDispatcher;
13
14 /**
15  * The EventDispatcherInterface is the central point of Symfony's event listener system.
16  * Listeners are registered on the manager and events are dispatched through the
17  * manager.
18  *
19  * @author Bernhard Schussek <bschussek@gmail.com>
20  */
21 interface EventDispatcherInterface
22 {
23     /**
24      * Dispatches an event to all registered listeners.
25      *
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
28      *                          invoked on listeners.
29      * @param Event  $event     The event to pass to the event handlers/listeners
30      *                          If not supplied, an empty Event instance is created
31      *
32      * @return Event
33      */
34     public function dispatch($eventName, Event $event = null);
35
36     /**
37      * Adds an event listener that listens on the specified events.
38      *
39      * @param string   $eventName The event to listen on
40      * @param callable $listener  The listener
41      * @param int      $priority  The higher this value, the earlier an event
42      *                            listener will be triggered in the chain (defaults to 0)
43      */
44     public function addListener($eventName, $listener, $priority = 0);
45
46     /**
47      * Adds an event subscriber.
48      *
49      * The subscriber is asked for all the events he is
50      * interested in and added as a listener for these events.
51      */
52     public function addSubscriber(EventSubscriberInterface $subscriber);
53
54     /**
55      * Removes an event listener from the specified events.
56      *
57      * @param string   $eventName The event to remove a listener from
58      * @param callable $listener  The listener to remove
59      */
60     public function removeListener($eventName, $listener);
61
62     public function removeSubscriber(EventSubscriberInterface $subscriber);
63
64     /**
65      * Gets the listeners of a specific event or all listeners sorted by descending priority.
66      *
67      * @param string $eventName The name of the event
68      *
69      * @return array The event listeners for the specified event, or all event listeners by event name
70      */
71     public function getListeners($eventName = null);
72
73     /**
74      * Gets the listener priority for a specific event.
75      *
76      * Returns null if the event or the listener does not exist.
77      *
78      * @param string   $eventName The name of the event
79      * @param callable $listener  The listener
80      *
81      * @return int|null The event listener priority
82      */
83     public function getListenerPriority($eventName, $listener);
84
85     /**
86      * Checks whether an event has any registered listeners.
87      *
88      * @param string $eventName The name of the event
89      *
90      * @return bool true if the specified event has any listeners, false otherwise
91      */
92     public function hasListeners($eventName = null);
93 }