| Methods |
public
|
dispatchEvent(string $eventName, EventArgs|null $eventArgs = null): void
Dispatches an event to all registered listeners.
Dispatches an event to all registered listeners.
Parameters
| $eventName |
The name of the event to dispatch. The name of the event is
the name of the method that is invoked on listeners.
|
| $eventArgs |
The event arguments to pass to the event handlers/listeners.
If not supplied, the single empty EventArgs instance is used.
|
|
#
|
public
|
getListeners(string $event): object[]
Gets the listeners of a specific event.
Gets the listeners of a specific event.
Parameters
| $event |
The name of the event.
|
|
#
|
public
|
getAllListeners(): array<string, object[]>
Gets all listeners keyed by event name.
Gets all listeners keyed by event name.
Returns
The event listeners for the specified event, or all event listeners.
|
#
|
public
|
hasListeners(string $event): bool
Checks whether an event has any registered listeners.
Checks whether an event has any registered listeners.
|
#
|
public
|
addEventListener(string|string[] $events, object $listener): void
Adds an event listener that listens on the specified events.
Adds an event listener that listens on the specified events.
Parameters
| $events |
The event(s) to listen on.
|
| $listener |
The listener object.
|
|
#
|
public
|
removeEventListener(string|string[] $events, object $listener): void
Removes an event listener from the specified events.
Removes an event listener from the specified events.
|
#
|
public
|
addEventSubscriber(EventSubscriber $subscriber): void
Adds an EventSubscriber.
Adds an EventSubscriber.
The subscriber is asked for all the events it is interested in and added
as a listener for these events.
|
#
|
public
|
removeEventSubscriber(EventSubscriber $subscriber): void
Removes an EventSubscriber.
Removes an EventSubscriber.
The subscriber is asked for all the events it is interested in and removed
as a listener for these events.
|
#
|