interface DispatcherInterface implements EventTriggerableInterface (View source)

Interface DispatcherInterface

Methods

triggerEvent(EventInterface|string $event, array $args = array())

Trigger an event.

addListener(object|Closure $listener, array|integer $priorities = array())

Add a listener to this dispatcher, only if not already registered to these events.

listen(string $event, callable $callable, int $priority = ListenerPriority::NORMAL)

Add single listener.

Details

EventInterface triggerEvent(EventInterface|string $event, array $args = array())

Trigger an event.

Parameters

EventInterface|string $event The event object or name.
array $args The arguments to set in event.

Return Value

EventInterface The event after being passed through all listeners.

at line line 31
DispatcherInterface addListener(object|Closure $listener, array|integer $priorities = array())

Add a listener to this dispatcher, only if not already registered to these events.

If no events are specified, it will be registered to all events matching it's methods name. In the case of a closure, you must specify at least one event name.

Parameters

object|Closure $listener The listener
array|integer $priorities An associative array of event names as keys and the corresponding listener priority as values.

Return Value

DispatcherInterface This method is chainable.

Exceptions

InvalidArgumentException

at line line 44
DispatcherInterface listen(string $event, callable $callable, int $priority = ListenerPriority::NORMAL)

Add single listener.

Parameters

string $event
callable $callable
int $priority

Return Value

DispatcherInterface