Documentation

TraceableEventDispatcher
in package
implements TraceableEventDispatcherInterface

Collects some data about event listeners.

This event dispatcher delegates the dispatching to another one.

Tags
author

Fabien Potencier fabien@symfony.com

Table of Contents

Interfaces

TraceableEventDispatcherInterface
The EventDispatcherInterface is the central point of Symfony's event listener system.

Properties

$logger  : mixed
$stopwatch  : mixed
$called  : mixed
$dispatcher  : mixed
$wrappedListeners  : mixed

Methods

__call()  : mixed
Proxies all method calls to the original event dispatcher.
__construct()  : mixed
Constructor.
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.
getListenerPriority()  : mixed
{@inheritdoc}
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.
postDispatch()  : mixed
Called after dispatching the event.
preDispatch()  : mixed
Called before dispatching the event.
getListenerInfo()  : array<string|int, mixed>
Returns information about the listener.
postProcess()  : mixed
preProcess()  : mixed
sortListenersByPriority()  : mixed

Properties

Methods

__call()

Proxies all method calls to the original event dispatcher.

public __call(string $method, array<string|int, mixed> $arguments) : mixed
Parameters
$method : string

The method name

$arguments : array<string|int, mixed>

The method arguments

addListener()

Adds an event listener that listens on the specified events.

public addListener(mixed $eventName, mixed $listener[, mixed $priority = 0 ]) : mixed
Parameters
$eventName : mixed

The event to listen on

$listener : mixed

The listener

$priority : mixed = 0

The higher this value, the earlier an event listener will be triggered in the chain (defaults to 0)

dispatch()

Dispatches an event to all registered listeners.

public dispatch(mixed $eventName[, Event $event = null ]) : Event
Parameters
$eventName : mixed

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
Event

getCalledListeners()

Gets the called listeners.

public getCalledListeners() : array<string|int, mixed>
Return values
array<string|int, mixed>

An array of called listeners

getListenerPriority()

{@inheritdoc}

public getListenerPriority(mixed $eventName, mixed $listener) : mixed
Parameters
$eventName : mixed
$listener : mixed

getListeners()

Gets the listeners of a specific event or all listeners sorted by descending priority.

public getListeners([mixed $eventName = null ]) : array<string|int, mixed>
Parameters
$eventName : mixed = 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([mixed $eventName = null ]) : bool
Parameters
$eventName : mixed = 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(mixed $eventName, mixed $listener) : mixed
Parameters
$eventName : mixed

The event to remove a listener from

$listener : mixed

The listener to remove

postDispatch()

Called after dispatching the event.

protected postDispatch(string $eventName, Event $event) : mixed
Parameters
$eventName : string

The event name

$event : Event

The event

preDispatch()

Called before dispatching the event.

protected preDispatch(string $eventName, Event $event) : mixed
Parameters
$eventName : string

The event name

$event : Event

The event

getListenerInfo()

Returns information about the listener.

private getListenerInfo(object $listener, string $eventName) : array<string|int, mixed>
Parameters
$listener : object

The listener

$eventName : string

The event name

Return values
array<string|int, mixed>

Information about the listener

sortListenersByPriority()

private sortListenersByPriority(mixed $a, mixed $b) : mixed
Parameters
$a : mixed
$b : mixed

        
On this page

Search results