Documentation

EventDispatcher
in package
implements EventDispatcherInterface

The EventDispatcher class implements PSR-14 EventDispatcherInterface

Not "final" on purpose. Formally extending is a viable and cheap strategy for DI Autowiring, even though wrapping would be cleaner.

Tags
author

Ralf Lang lang@b1-systems.de

category

Horde

copyright

2021 Horde LLC

license

http://www.horde.org/licenses/bsd BSD-3-Clause

Interfaces, Classes and Traits

EventDispatcherInterface

Table of Contents

$logger  : LoggerInterface
The logger instance. We prefer the Null logger over null.
$listenerProvider  : ListenerProviderInterface
__construct()  : mixed
Constructor
dispatch()  : object
Dispatch an event to all relevant listeners.

Properties

$logger

The logger instance. We prefer the Null logger over null.

protected LoggerInterface $logger

$listenerProvider

private ListenerProviderInterface $listenerProvider

Methods

__construct()

Constructor

public __construct(ListenerProviderInterface $listenerProvider[, LoggerInterface $logger = null ]) : mixed

Set up the dispatcher with a listener provider Some implementations use an array of listener providers. This is not necessary as ListenerProviders may be containers of other ListenerProviders

Parameters
$listenerProvider : ListenerProviderInterface
$logger : LoggerInterface = null

An optional PSR-3 logger

Return values
mixed

dispatch()

Dispatch an event to all relevant listeners.

public dispatch(object|StoppableEventInterface $event) : object

An event may be any object, no specific markers or base classes needed. Events may form a hierarchy by common interfaces or inheritance.

Parameters
$event : object|StoppableEventInterface

The object to process.

Return values
object

The Event that was passed, now modified by listeners.

Search results