Dispatcher

Extends \Symfony\Component\EventDispatcher\EventDispatcher

Event Dispatching class.

This class provides a bridge to the Symfony2 EventDispatcher. At current this is provided by inheritance but future iterations should solve this by making it an adapter pattern.

The class is implemented as (mockable) Singleton as this was the best solution to make the functionality available in every class of the project.

package

Default

Methods

Override constructor to make this singleton.

__construct() 
codeCoverageIgnore

For some reason

Adds a callable that will listen on the named event.

addListener(string $eventName, callable $listener, integer $priority) : void
codeCoverageIgnore

Untestable and not really necessary

Arguments

$eventName

string

$listener

callable

$priority

integer

Dispatches an event.

dispatch(string $eventName, \Symfony\Component\EventDispatcher\Event $event = null) : \phpDocumentor\Event\EventAbstract

Please note that the typehint of this method indicates a Symfony Event and this DocBlock a phpDocumentor event. This is because of inheritance and that the dispatch signature must remain intact.

codeCoverageIgnore

Untestable and not really necessary

Arguments

$eventName

string

$event

\Symfony\Component\EventDispatcher\Event

Response

\phpDocumentor\Event\EventAbstract

Returns a named instance of the Event Dispatcher.

getInstance(string $name = 'default') : \phpDocumentor\Event\Dispatcher
static

Arguments

$name

string

Response

\phpDocumentor\Event\Dispatcher

Sets a names instance of the Event Dispatcher.

setInstance(string $name, \phpDocumentor\Event\Dispatcher $instance) : void
static

Arguments

$name

string

Properties

Keep track of an array of instances.

instances : array<mixed,\phpDocumentor\Event\Dispatcher>
static
var

Keep track of an array of instances.

Type(s)

array<mixed,\phpDocumentor\Event\Dispatcher>