Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 97 lines (87 sloc) 2.999 kb
1322f90 @fabpot added two interfaces: EventInterface and EventDispatcherInterface
fabpot authored
1 <?php
2
3 /*
4 * This file is part of the Symfony package.
5 *
cd15b8a @fabpot replaced symfony-project.org by symfony.com
fabpot authored
6 * (c) Fabien Potencier <fabien@symfony.com>
1322f90 @fabpot added two interfaces: EventInterface and EventDispatcherInterface
fabpot authored
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 /**
d014b34 @fabpot renamed some methods in the event dispatcher
fabpot authored
15 * The EventDispatcherInterface is the central point of Symfony's event listener system.
6438e8f @webmozart [EventDispatcher] Replaced EventDispatcher by Doctrine's implementation
webmozart authored
16 * Listeners are registered on the manager and events are dispatched through the
17 * manager.
1322f90 @fabpot added two interfaces: EventInterface and EventDispatcherInterface
fabpot authored
18 *
6438e8f @webmozart [EventDispatcher] Replaced EventDispatcher by Doctrine's implementation
webmozart authored
19 * @author Bernhard Schussek <bschussek@gmail.com>
4937344 @fabpot [EventDispatcher] tagged the guaranteed BC API
fabpot authored
20 *
21 * @api
1322f90 @fabpot added two interfaces: EventInterface and EventDispatcherInterface
fabpot authored
22 */
23 interface EventDispatcherInterface
24 {
25 /**
d014b34 @fabpot renamed some methods in the event dispatcher
fabpot authored
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.
36a4069 @GrahamCampbell Docblock fixes
GrahamCampbell authored
31 * @param Event $event The event to pass to the event handlers/listeners.
f8e90fe @fabpot [EventDispatcher] fixed CS
fabpot authored
32 * If not supplied, an empty Event instance is created.
4937344 @fabpot [EventDispatcher] tagged the guaranteed BC API
fabpot authored
33 *
1cdd086 @drak [EventDispatcher] Add fluid interface on dispatch()
drak authored
34 * @return Event
502614d @fabpot fixed CS
fabpot authored
35 *
4937344 @fabpot [EventDispatcher] tagged the guaranteed BC API
fabpot authored
36 * @api
d014b34 @fabpot renamed some methods in the event dispatcher
fabpot authored
37 */
0dc437f @fabpot fixed CS
fabpot authored
38 public function dispatch($eventName, Event $event = null);
d014b34 @fabpot renamed some methods in the event dispatcher
fabpot authored
39
40 /**
6438e8f @webmozart [EventDispatcher] Replaced EventDispatcher by Doctrine's implementation
webmozart authored
41 * Adds an event listener that listens on the specified events.
1322f90 @fabpot added two interfaces: EventInterface and EventDispatcherInterface
fabpot authored
42 *
1ad5962 @fabpot [EventDispatcher] fixed notices
fabpot authored
43 * @param string $eventName The event to listen on
44 * @param callable $listener The listener
ee3aeed @fabpot made phpdoc types consistent with those defined in Hack
fabpot authored
45 * @param int $priority The higher this value, the earlier an event
1ad5962 @fabpot [EventDispatcher] fixed notices
fabpot authored
46 * listener will be triggered in the chain (defaults to 0)
4937344 @fabpot [EventDispatcher] tagged the guaranteed BC API
fabpot authored
47 *
48 * @api
1322f90 @fabpot added two interfaces: EventInterface and EventDispatcherInterface
fabpot authored
49 */
0dc437f @fabpot fixed CS
fabpot authored
50 public function addListener($eventName, $listener, $priority = 0);
1322f90 @fabpot added two interfaces: EventInterface and EventDispatcherInterface
fabpot authored
51
52 /**
f8e90fe @fabpot [EventDispatcher] fixed CS
fabpot authored
53 * Adds an event subscriber.
54 *
55 * The subscriber is asked for all the events he is
6438e8f @webmozart [EventDispatcher] Replaced EventDispatcher by Doctrine's implementation
webmozart authored
56 * interested in and added as a listener for these events.
1322f90 @fabpot added two interfaces: EventInterface and EventDispatcherInterface
fabpot authored
57 *
6438e8f @webmozart [EventDispatcher] Replaced EventDispatcher by Doctrine's implementation
webmozart authored
58 * @param EventSubscriberInterface $subscriber The subscriber.
e26d812 @fabpot [EventDispatcher] added a way to set the priority for event subscribers
fabpot authored
59 *
60 * @api
1322f90 @fabpot added two interfaces: EventInterface and EventDispatcherInterface
fabpot authored
61 */
0dc437f @fabpot fixed CS
fabpot authored
62 public function addSubscriber(EventSubscriberInterface $subscriber);
1322f90 @fabpot added two interfaces: EventInterface and EventDispatcherInterface
fabpot authored
63
64 /**
6438e8f @webmozart [EventDispatcher] Replaced EventDispatcher by Doctrine's implementation
webmozart authored
65 * Removes an event listener from the specified events.
1322f90 @fabpot added two interfaces: EventInterface and EventDispatcherInterface
fabpot authored
66 *
80ac0f9 @nicolas-grekas [EventDispatcher] fix doc bloc on EventDispatcherInterface
nicolas-grekas authored
67 * @param string $eventName The event to remove a listener from
68 * @param callable $listener The listener to remove
1322f90 @fabpot added two interfaces: EventInterface and EventDispatcherInterface
fabpot authored
69 */
0dc437f @fabpot fixed CS
fabpot authored
70 public function removeListener($eventName, $listener);
1322f90 @fabpot added two interfaces: EventInterface and EventDispatcherInterface
fabpot authored
71
72 /**
8bd5feb @fabpot [EventDispatcher] added EventDispatcher::removeSubscriber()
fabpot authored
73 * Removes an event subscriber.
74 *
f8e90fe @fabpot [EventDispatcher] fixed CS
fabpot authored
75 * @param EventSubscriberInterface $subscriber The subscriber
8bd5feb @fabpot [EventDispatcher] added EventDispatcher::removeSubscriber()
fabpot authored
76 */
0dc437f @fabpot fixed CS
fabpot authored
77 public function removeSubscriber(EventSubscriberInterface $subscriber);
8bd5feb @fabpot [EventDispatcher] added EventDispatcher::removeSubscriber()
fabpot authored
78
79 /**
6438e8f @webmozart [EventDispatcher] Replaced EventDispatcher by Doctrine's implementation
webmozart authored
80 * Gets the listeners of a specific event or all listeners.
1322f90 @fabpot added two interfaces: EventInterface and EventDispatcherInterface
fabpot authored
81 *
f8e90fe @fabpot [EventDispatcher] fixed CS
fabpot authored
82 * @param string $eventName The name of the event
1322f90 @fabpot added two interfaces: EventInterface and EventDispatcherInterface
fabpot authored
83 *
f8e90fe @fabpot [EventDispatcher] fixed CS
fabpot authored
84 * @return array The event listeners for the specified event, or all event listeners by event name
1322f90 @fabpot added two interfaces: EventInterface and EventDispatcherInterface
fabpot authored
85 */
0dc437f @fabpot fixed CS
fabpot authored
86 public function getListeners($eventName = null);
1322f90 @fabpot added two interfaces: EventInterface and EventDispatcherInterface
fabpot authored
87
88 /**
6438e8f @webmozart [EventDispatcher] Replaced EventDispatcher by Doctrine's implementation
webmozart authored
89 * Checks whether an event has any registered listeners.
1322f90 @fabpot added two interfaces: EventInterface and EventDispatcherInterface
fabpot authored
90 *
f8e90fe @fabpot [EventDispatcher] fixed CS
fabpot authored
91 * @param string $eventName The name of the event
1322f90 @fabpot added two interfaces: EventInterface and EventDispatcherInterface
fabpot authored
92 *
36a4069 @GrahamCampbell Docblock fixes
GrahamCampbell authored
93 * @return bool true if the specified event has any listeners, false otherwise
1322f90 @fabpot added two interfaces: EventInterface and EventDispatcherInterface
fabpot authored
94 */
0dc437f @fabpot fixed CS
fabpot authored
95 public function hasListeners($eventName = null);
d014b34 @fabpot renamed some methods in the event dispatcher
fabpot authored
96 }
Something went wrong with that request. Please try again.