Joomla CMS  4.2.2
Documentation des API du CMS Joomla en version 4.2.2
Référence de l'interface DispatcherInterface
+ Graphe d'héritage de DispatcherInterface:

Fonctions membres publiques

 dispatch (string $name, ?EventInterface $event=null)
 
 addListener (string $eventName, callable $callback, int $priority=0)
 
 clearListeners ($event=null)
 
 countListeners ($event)
 
 getListeners (?string $event=null)
 
 hasListener (callable $callback, ?string $eventName=null)
 
 removeListener (string $eventName, callable $listener)
 
 addSubscriber (SubscriberInterface $subscriber)
 
 removeSubscriber (SubscriberInterface $subscriber)
 

Description détaillée

Interface for event dispatchers.

Depuis
1.0

Documentation des fonctions membres

◆ addListener()

addListener ( string  $eventName,
callable  $callback,
int  $priority = 0 
)

Attaches a listener to an event

Paramètres
string$eventNameThe event to listen to.
callable$callbackA callable function.
integer$priorityThe priority at which the $callback executed.
Renvoie
boolean
Depuis
2.0.0

Implémenté dans Dispatcher.

Référencé par Session\buildSession().

◆ addSubscriber()

addSubscriber ( SubscriberInterface  $subscriber)

Adds an event subscriber.

Paramètres
SubscriberInterface$subscriberThe subscriber.
Renvoie
void
Depuis
2.0.0

Implémenté dans Dispatcher.

◆ clearListeners()

clearListeners (   $event = null)

Clear the listeners in this dispatcher.

If an event is specified, the listeners will be cleared only for that event.

Paramètres
string$eventThe event name.
Renvoie
$this
Depuis
2.0.0

Implémenté dans Dispatcher.

◆ countListeners()

countListeners (   $event)

Count the number of registered listeners for the given event.

Paramètres
string$eventThe event name.
Renvoie
integer
Depuis
2.0.0

Implémenté dans Dispatcher.

◆ dispatch()

dispatch ( string  $name,
?EventInterface  $event = null 
)

Dispatches an event to all registered listeners.

Paramètres
string$nameThe name of the event to dispatch.
EventInterface$eventThe 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.
Renvoie
EventInterface
Depuis
2.0.0

Implémenté dans Dispatcher.

◆ getListeners()

getListeners ( ?string  $event = null)

Get the listeners registered to the given event.

Paramètres
string | null$eventThe event to fetch listeners for or null to fetch all listeners
Renvoie
callable[] An array of registered listeners sorted according to their priorities.
Depuis
2.0.0

Implémenté dans Dispatcher.

◆ hasListener()

hasListener ( callable  $callback,
?string  $eventName = null 
)

Tell if the given listener has been added.

If an event is specified, it will tell if the listener is registered for that event.

Paramètres
callable$callbackThe callable to check is listening to the event.
string | null$eventNameAn optional event name to check a listener is subscribed to.
Renvoie
boolean True if the listener is registered, false otherwise.
Depuis
2.0.0

Implémenté dans Dispatcher.

◆ removeListener()

removeListener ( string  $eventName,
callable  $listener 
)

Removes an event listener from the specified event.

Paramètres
string$eventNameThe event to remove a listener from.
callable$listenerThe listener to remove.
Renvoie
void
Depuis
2.0.0

Implémenté dans Dispatcher.

◆ removeSubscriber()

removeSubscriber ( SubscriberInterface  $subscriber)

Removes an event subscriber.

Paramètres
SubscriberInterface$subscriberThe subscriber.
Renvoie
void
Depuis
2.0.0

Implémenté dans Dispatcher.


La documentation de cette interface a été générée à partir du fichier suivant :