TraceableEventDispatcherInterface
extends
EventDispatcherInterface
in
The EventDispatcherInterface is the central point of Symfony's event listener system.
Tags
Table of Contents
Methods
- addListener() : mixed
- Adds an event listener that listens on the specified events.
- addSubscriber() : mixed
- Adds an event subscriber.
- dispatch() : Event
- Dispatches an event to all registered listeners.
- getCalledListeners() : array<string|int, mixed>
- Gets the called listeners.
- getListeners() : array<string|int, mixed>
- Gets the listeners of a specific event or all listeners sorted by descending priority.
- getNotCalledListeners() : array<string|int, mixed>
- Gets the not called listeners.
- hasListeners() : bool
- Checks whether an event has any registered listeners.
- removeListener() : mixed
- Removes an event listener from the specified events.
- removeSubscriber() : mixed
- Removes an event subscriber.
Methods
addListener()
Adds an event listener that listens on the specified events.
public
addListener(string $eventName, callable $listener[, int $priority = 0 ]) : mixed
Parameters
- $eventName : string
-
The event to listen on
- $listener : callable
-
The listener
- $priority : int = 0
-
The higher this value, the earlier an event listener will be triggered in the chain (defaults to 0)
addSubscriber()
Adds an event subscriber.
public
addSubscriber(EventSubscriberInterface $subscriber) : mixed
The subscriber is asked for all the events he is interested in and added as a listener for these events.
Parameters
- $subscriber : EventSubscriberInterface
-
The subscriber.
dispatch()
Dispatches an event to all registered listeners.
public
dispatch(string $eventName[, Event $event = null ]) : Event
Parameters
- $eventName : string
-
The name of the event to dispatch. The name of the event is the name of the method that is invoked on listeners.
- $event : Event = null
-
The event to pass to the event handlers/listeners. If not supplied, an empty Event instance is created.
Return values
EventgetCalledListeners()
Gets the called listeners.
public
getCalledListeners() : array<string|int, mixed>
Return values
array<string|int, mixed> —An array of called listeners
getListeners()
Gets the listeners of a specific event or all listeners sorted by descending priority.
public
getListeners([string $eventName = null ]) : array<string|int, mixed>
Parameters
- $eventName : string = null
-
The name of the event
Return values
array<string|int, mixed> —The event listeners for the specified event, or all event listeners by event name
getNotCalledListeners()
Gets the not called listeners.
public
getNotCalledListeners() : array<string|int, mixed>
Return values
array<string|int, mixed> —An array of not called listeners
hasListeners()
Checks whether an event has any registered listeners.
public
hasListeners([string $eventName = null ]) : bool
Parameters
- $eventName : string = null
-
The name of the event
Return values
bool —true if the specified event has any listeners, false otherwise
removeListener()
Removes an event listener from the specified events.
public
removeListener(string $eventName, callable $listener) : mixed
Parameters
- $eventName : string
-
The event to remove a listener from
- $listener : callable
-
The listener to remove
removeSubscriber()
Removes an event subscriber.
public
removeSubscriber(EventSubscriberInterface $subscriber) : mixed
Parameters
- $subscriber : EventSubscriberInterface
-
The subscriber