ImmutableEventDispatcher
in package
implements
EventDispatcherInterface
A read-only proxy for an event dispatcher.
Tags
Table of Contents
Interfaces
- EventDispatcherInterface
- The EventDispatcherInterface is the central point of Symfony's event listener system.
Properties
- $dispatcher : mixed
Methods
- __construct() : mixed
- addListener() : mixed
- Adds an event listener that listens on the specified events.
- addSubscriber() : mixed
- Adds an event subscriber.
- dispatch() : object
- Dispatches an event to all registered listeners.
- getListenerPriority() : int|null
- Gets the listener priority for a specific event.
- getListeners() : array<string|int, array<string|int, callable>|callable>
- Gets the listeners of a specific event or all listeners sorted by descending priority.
- hasListeners() : bool
- Checks whether an event has any registered listeners.
- removeListener() : mixed
- Removes an event listener from the specified events.
- removeSubscriber() : mixed
Properties
$dispatcher
private
mixed
$dispatcher
Methods
__construct()
public
__construct(EventDispatcherInterface $dispatcher) : mixed
Parameters
- $dispatcher : EventDispatcherInterface
addListener()
Adds an event listener that listens on the specified events.
public
addListener(string $eventName, mixed $listener[, int $priority = 0 ]) : mixed
Parameters
- $eventName : string
- $listener : mixed
- $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
Parameters
- $subscriber : EventSubscriberInterface
dispatch()
Dispatches an event to all registered listeners.
public
dispatch(object $event[, string|null $eventName = null ]) : object
Parameters
- $event : object
-
The event to pass to the event handlers/listeners
- $eventName : string|null = null
-
The name of the event to dispatch. If not supplied, the class of $event should be used instead.
Return values
object —The passed $event MUST be returned
getListenerPriority()
Gets the listener priority for a specific event.
public
getListenerPriority(string $eventName, mixed $listener) : int|null
Parameters
- $eventName : string
- $listener : mixed
Return values
int|nullgetListeners()
Gets the listeners of a specific event or all listeners sorted by descending priority.
public
getListeners([string|null $eventName = null ]) : array<string|int, array<string|int, callable>|callable>
Parameters
- $eventName : string|null = null
Return values
array<string|int, array<string|int, callable>|callable>hasListeners()
Checks whether an event has any registered listeners.
public
hasListeners([string|null $eventName = null ]) : bool
Parameters
- $eventName : string|null = null
Return values
boolremoveListener()
Removes an event listener from the specified events.
public
removeListener(string $eventName, mixed $listener) : mixed
Parameters
- $eventName : string
- $listener : mixed
removeSubscriber()
public
removeSubscriber(EventSubscriberInterface $subscriber) : mixed
Parameters
- $subscriber : EventSubscriberInterface