DispatcherInterface
Interface for event dispatchers.
| since |
1.0 |
|---|---|
| package |
Joomla Framework |
Methods
addListener
Attaches a listener to an event
addListener( eventName, Warning: Array to string conversion in /opt/phpdoc/vendor/twig/twig/src/Extension/CoreExtension.php on line 841 |Array callback, priority) :
| since |
2.0.0 |
|---|
Arguments
- eventName
stringThe event to listen to.- callback
callableA callable function.- priority
intThe priority at which the $callback executed.
Response
bool
addSubscriber
Adds an event subscriber.
addSubscriber(\Joomla\Event\SubscriberInterface subscriber) :
clearListeners
Clear the listeners in this dispatcher.
clearListeners( event = null) :
If an event is specified, the listeners will be cleared only for that event.
| since |
2.0.0 |
|---|
Arguments
- event
stringThe event name.
Response
$this
countListeners
Count the number of registered listeners for the given event.
countListeners( event) :
| since |
2.0.0 |
|---|
Arguments
- event
stringThe event name.
Response
int
dispatch
Dispatches an event to all registered listeners.
dispatch( name, \Joomla\Event\EventInterface event = null) : \Joomla\Event\EventInterface
| since |
2.0.0 |
|---|
Arguments
- name
stringThe name of the event to dispatch.- event
EventInterface|nullThe event to pass to the event handlers/listeners. If not supplied, an empty EventInterface instance is created. Note, not passing an event is deprecated and will be required as of 3.0.
Response
getListeners
Get the listeners registered to the given event.
getListeners(string|null event = null) : callable||string|int
| since |
2.0.0 |
|---|
Arguments
- event
string|nullThe event to fetch listeners for or null to fetch all listeners
Response
array<string|int, callable>An array of registered listeners sorted according to their priorities.
hasListener
Tell if the given listener has been added.
hasListener( Warning: Array to string conversion in /opt/phpdoc/vendor/twig/twig/src/Extension/CoreExtension.php on line 841 |Array callback, string|null eventName = null) :
If an event is specified, it will tell if the listener is registered for that event.
| since |
2.0.0 |
|---|
Arguments
- callback
callableThe callable to check is listening to the event.- eventName
string|nullAn optional event name to check a listener is subscribed to.
Response
boolTrue if the listener is registered, false otherwise.
removeListener
Removes an event listener from the specified event.
removeListener( eventName, Warning: Array to string conversion in /opt/phpdoc/vendor/twig/twig/src/Extension/CoreExtension.php on line 841 |Array listener) :
| since |
2.0.0 |
|---|
Arguments
- eventName
stringThe event to remove a listener from.- listener
callableThe listener to remove.
Response
void
removeSubscriber
Removes an event subscriber.
removeSubscriber(\Joomla\Event\SubscriberInterface subscriber) :