Interface for shared event listener collections

package Default

 Methods

Attach a listener to an event

attach(string|array $id, string $event, callable $callback, integer $priority = 1) : \Zend\Stdlib\CallbackHandler | array

Parameters

$id

stringarray

Identifier(s) for event emitting component(s)

$event

string

$callback

callable

PHP Callback

$priority

integer

Priority at which listener should execute

Returns

\Zend\Stdlib\CallbackHandlerarrayEither CallbackHandler or array of CallbackHandlers

Clear all listeners for a given identifier, optionally for a specific event

clearListeners(string|integer $id, null|string $event = null) : boolean

Parameters

$id

stringinteger

$event

nullstring

Returns

boolean

Detach a listener from an event offered by a given resource

detach(string|integer $id, \Zend\Stdlib\CallbackHandler $listener) : boolean

Parameters

$id

stringinteger

$listener

\Zend\Stdlib\CallbackHandler

Returns

booleanReturns true if event and listener found, and unsubscribed; returns false if either event or listener not found

Retrieve all registered events for a given resource

getEvents(string|integer $id) : array

Parameters

$id

stringinteger

Returns

array

Retrieve all listeners for a given identifier and event

getListeners(string|integer $id, string|integer $event) : false | \Zend\Stdlib\PriorityQueue

Parameters

$id

stringinteger

$event

stringinteger

Returns

false\Zend\Stdlib\PriorityQueue