API Documentation (v0.9.0-alpha)

Avolutions\Event\ListenerCollection

implements CollectionInterface Uses CollectionTrait

The ListenerCollection contains all registered event listener.

Properties

Property Visibility Type Description
$items public array The items of the Collection.

Methods

Method Visibility Description
addListener() public Adds a listener for an event the ListenerCollection.
count() public Returns the number of items in the Collection.
getAll() public Returns all items of the Collection.
getListener() public Returns a callable listener for the given event from the ListenerCollection.

Property Details

$items

The items of the Collection.

public array<string|int, mixed> $items = []

Method Details

addListener()

Adds a listener for an event the ListenerCollection.

public addListener(string $eventName, array<string|int, mixed> $listener) : mixed
Parameters

string $eventName
The name of the event.

array<string|int, mixed> $listener
An array containing the Listener class and method.

Return values
mixed Adds a listener for an event the ListenerCollection.
count()

Returns the number of items in the Collection.

public count() : int
Return values
int Returns the number of items in the Collection.
getAll()

Returns all items of the Collection.

public getAll() : array<string|int, mixed>
Return values
array<string|int, mixed> Returns all items of the Collection.
getListener()

Returns a callable listener for the given event from the ListenerCollection.

public getListener(string $eventName) : callable|array<string|int, mixed>
Parameters

string $eventName
The name of the event.

Return values
callable|array<string|int, mixed> Returns a callable listener for the given event from the ListenerCollection.