\phpDocumentor\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.

Summary

Methods
Properties
Constants
getInstance()
setInstance()
dispatch()
addListener()
No public properties found
No constants found
__construct()
$instances
N/A
No private methods found
No private properties found
N/A

Properties

$instances

$instances : array<mixed,\phpDocumentor\Event\Dispatcher>

Type

array<mixed,\phpDocumentor\Event\Dispatcher> — Keep track of an array of instances.

Methods

getInstance()

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

Returns a named instance of the Event Dispatcher.

Parameters

string $name

Returns

\phpDocumentor\Event\Dispatcher

setInstance()

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

Sets a names instance of the Event Dispatcher.

Parameters

string $name
\phpDocumentor\Event\Dispatcher $instance

dispatch()

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

Dispatches an event.

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.

Parameters

string $eventName
\Symfony\Component\EventDispatcher\Event $event

Returns

\phpDocumentor\Event\EventAbstract

addListener()

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

Adds a callable that will listen on the named event.

Parameters

string $eventName
callable $listener
integer $priority

__construct()

__construct() 

Override constructor to make this singleton.