Documentation

ContainerAwareEventManager extends EventManager
in package

Allows lazy loading of listener and subscriber services.

Tags
author

Johannes M. Schmitt schmittjoh@gmail.com

Table of Contents

Properties

$container  : mixed
$initialized  : array<string|int, mixed>
$initializedSubscribers  : bool
$listeners  : array<string|int, mixed>
Map of registered listeners.
$methods  : array<string|int, mixed>
$subscribers  : array<string|int, mixed>

Methods

__construct()  : mixed
addEventListener()  : void
Adds an event listener that listens on the specified events.
addEventSubscriber()  : void
Adds an EventSubscriber. The subscriber is asked for all the events it is interested in and added as a listener for these events.
dispatchEvent()  : void
Dispatches an event to all registered listeners.
getAllListeners()  : array<string, array<string|int, object>>
Gets all listeners keyed by event name.
getListeners()  : array<string|int, array<string|int, object>>
Gets the listeners of a specific event.
hasListeners()  : bool
Checks whether an event has any registered listeners.
removeEventListener()  : void
Removes an event listener from the specified events.
removeEventSubscriber()  : void
Removes an EventSubscriber. The subscriber is asked for all the events it is interested in and removed as a listener for these events.
getHash()  : string
getMethod()  : string
initializeListeners()  : mixed
initializeSubscribers()  : mixed

Properties

Methods

addEventListener()

Adds an event listener that listens on the specified events.

public addEventListener(mixed $events, mixed $listener) : void
Parameters
$events : mixed

The event(s) to listen on.

$listener : mixed

The listener object.

addEventSubscriber()

Adds an EventSubscriber. The subscriber is asked for all the events it is interested in and added as a listener for these events.

public addEventSubscriber(EventSubscriber $subscriber) : void
Parameters
$subscriber : EventSubscriber

The subscriber.

dispatchEvent()

Dispatches an event to all registered listeners.

public dispatchEvent(mixed $eventName[, EventArgs $eventArgs = null ]) : void
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.

$eventArgs : EventArgs = null

The event arguments to pass to the event handlers/listeners. If not supplied, the single empty EventArgs instance is used.

getAllListeners()

Gets all listeners keyed by event name.

public getAllListeners() : array<string, array<string|int, object>>
Return values
array<string, array<string|int, object>>

The event listeners for the specified event, or all event listeners.

getListeners()

Gets the listeners of a specific event.

public getListeners([mixed $event = null ]) : array<string|int, array<string|int, object>>
Parameters
$event : mixed = null

The name of the event.

Return values
array<string|int, array<string|int, object>>

hasListeners()

Checks whether an event has any registered listeners.

public hasListeners(mixed $event) : bool
Parameters
$event : mixed
Return values
bool

TRUE if the specified event has any listeners, FALSE otherwise.

removeEventListener()

Removes an event listener from the specified events.

public removeEventListener(mixed $events, mixed $listener) : void
Parameters
$events : mixed
$listener : mixed

removeEventSubscriber()

Removes an EventSubscriber. The subscriber is asked for all the events it is interested in and removed as a listener for these events.

public removeEventSubscriber(EventSubscriber $subscriber) : void
Parameters
$subscriber : EventSubscriber

The subscriber.

getHash()

private getHash(string|object $listener) : string
Parameters
$listener : string|object
Return values
string

getMethod()

private getMethod(object $listener, string $event) : string
Parameters
$listener : object
$event : string
Return values
string

        
On this page

Search results