diff options
Diffstat (limited to 'vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcherInterface.php')
-rw-r--r-- | vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcherInterface.php | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcherInterface.php b/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcherInterface.php new file mode 100644 index 00000000..7aead23b --- /dev/null +++ b/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcherInterface.php | |||
@@ -0,0 +1,96 @@ | |||
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 | * @api | ||
22 | */ | ||
23 | interface EventDispatcherInterface | ||
24 | { | ||
25 | /** | ||
26 | * Dispatches an event to all registered listeners. | ||
27 | * | ||
28 | * @param string $eventName The name of the event to dispatch. The name of | ||
29 | * the event is the name of the method that is | ||
30 | * invoked on listeners. | ||
31 | * @param Event $event The event to pass to the event handlers/listeners. | ||
32 | * If not supplied, an empty Event instance is created. | ||
33 | * | ||
34 | * @return Event | ||
35 | * | ||
36 | * @api | ||
37 | */ | ||
38 | public function dispatch($eventName, Event $event = null); | ||
39 | |||
40 | /** | ||
41 | * Adds an event listener that listens on the specified events. | ||
42 | * | ||
43 | * @param string $eventName The event to listen on | ||
44 | * @param callable $listener The listener | ||
45 | * @param integer $priority The higher this value, the earlier an event | ||
46 | * listener will be triggered in the chain (defaults to 0) | ||
47 | * | ||
48 | * @api | ||
49 | */ | ||
50 | public function addListener($eventName, $listener, $priority = 0); | ||
51 | |||
52 | /** | ||
53 | * Adds an event subscriber. | ||
54 | * | ||
55 | * The subscriber is asked for all the events he is | ||
56 | * interested in and added as a listener for these events. | ||
57 | * | ||
58 | * @param EventSubscriberInterface $subscriber The subscriber. | ||
59 | * | ||
60 | * @api | ||
61 | */ | ||
62 | public function addSubscriber(EventSubscriberInterface $subscriber); | ||
63 | |||
64 | /** | ||
65 | * Removes an event listener from the specified events. | ||
66 | * | ||
67 | * @param string|array $eventName The event(s) to remove a listener from | ||
68 | * @param callable $listener The listener to remove | ||
69 | */ | ||
70 | public function removeListener($eventName, $listener); | ||
71 | |||
72 | /** | ||
73 | * Removes an event subscriber. | ||
74 | * | ||
75 | * @param EventSubscriberInterface $subscriber The subscriber | ||
76 | */ | ||
77 | public function removeSubscriber(EventSubscriberInterface $subscriber); | ||
78 | |||
79 | /** | ||
80 | * Gets the listeners of a specific event or all listeners. | ||
81 | * | ||
82 | * @param string $eventName The name of the event | ||
83 | * | ||
84 | * @return array The event listeners for the specified event, or all event listeners by event name | ||
85 | */ | ||
86 | public function getListeners($eventName = null); | ||
87 | |||
88 | /** | ||
89 | * Checks whether an event has any registered listeners. | ||
90 | * | ||
91 | * @param string $eventName The name of the event | ||
92 | * | ||
93 | * @return Boolean true if the specified event has any listeners, false otherwise | ||
94 | */ | ||
95 | public function hasListeners($eventName = null); | ||
96 | } | ||