Dispatcher
class Dispatcher implements DispatcherInterface (View source)
The Dispatcher class.
Methods
Get the event object identified by the given name.
Get the registered events.
Clear all events.
Count the number of registered event.
Add a listener to this dispatcher, only if not already registered to these events.
on
Get the priority of the given listener for the given event.
Tell if the given listener has been added.
Remove the given listener from this dispatcher.
Count the number of registered listeners for the given event.
Details
at line line 48
Dispatcher
setEvent(EventInterface $event)
Set an event to the dispatcher.
It will replace any event with the same name.
at line line 64
Dispatcher
addEvent(EventInterface $event)
Add an event to this dispatcher, only if it is not existing.
at line line 83
boolean
hasEvent(EventInterface|string $event)
Tell if the given event has been added to this dispatcher.
at line line 103
EventInterface|mixed
getEvent(string $name, mixed $default = null)
Get the event object identified by the given name.
at line line 123
Dispatcher
removeEvent(EventInterface|string $event)
Remove an event from this dispatcher.
The registered listeners will remain.
at line line 145
EventInterface[]
getEvents()
Get the registered events.
at line line 157
EventInterface[]
clearEvents()
Clear all events.
at line line 172
integer
countEvents()
Count the number of registered event.
at line line 192
DispatcherInterface
addListener(object|Closure $listener, array|integer $priorities = array())
Add a listener to this dispatcher, only if not already registered to these events.
If no events are specified, it will be registered to all events matching it's methods name. In the case of a closure, you must specify at least one event name.
at line line 262
DispatcherInterface
listen(string $event, callable $callable, int $priority = ListenerPriority::NORMAL)
on
at line line 277
mixed
getListenerPriority(object|callable $listener, EventInterface|string $event)
Get the priority of the given listener for the given event.
at line line 301
object[]
getListeners(EventInterface|string $event = null)
Get the listeners registered to the given event.
at line line 332
boolean
hasListener(object|callable $listener, EventInterface|string $event = null)
Tell if the given listener has been added.
If an event is specified, it will tell if the listener is registered for that event.
at line line 371
Dispatcher
removeListener(object|Closure $listener, EventInterface|string $event = null)
Remove the given listener from this dispatcher.
If no event is specified, it will be removed from all events it is listening to.
at line line 407
Dispatcher
clearListeners(EventInterface|string $event = null)
Clear the listeners in this dispatcher.
If an event is specified, the listeners will be cleared only for that event.
at line line 439
integer
countListeners(EventInterface|string $event)
Count the number of registered listeners for the given event.
at line line 459
EventInterface
triggerEvent(EventInterface|string $event, array $args = array())
Trigger an event.