Joomla CMS  3.10.11 (avec JPlatform 13.1 inclus)
Documentation des API du CMS Joomla en version 3.10.11 et du framework Joomla Platform intégré
Référence de la classe Dispatcher
+ Graphe d'héritage de Dispatcher:

Fonctions membres publiques

 setEvent (EventInterface $event)
 
 setListenerFilter ($regex)
 
 addEvent (EventInterface $event)
 
 hasEvent ($event)
 
 getEvent ($name, $default=null)
 
 removeEvent ($event)
 
 getEvents ()
 
 clearEvents ()
 
 countEvents ()
 
 addListener ($listener, array $events=array())
 
 getListenerPriority ($listener, $event)
 
 getListeners ($event)
 
 hasListener ($listener, $event=null)
 
 removeListener ($listener, $event=null)
 
 clearListeners ($event=null)
 
 countListeners ($event)
 
 triggerEvent ($event)
 

Attributs protégés

 $events = array()
 
 $listenerFilter
 
 $listeners = array()
 

Description détaillée

Implementation of a DispatcherInterface supporting prioritized listeners.

Depuis
1.0

Documentation des fonctions membres

◆ addEvent()

addEvent ( EventInterface  $event)

Add an event to this dispatcher, only if it is not existing.

Paramètres
EventInterface$eventThe event.
Renvoie
Dispatcher This method is chainable.
Depuis
1.0

Références EventInterface\getName().

◆ addListener()

addListener (   $listener,
array  $events = array() 
)

Add a listener to this dispatcher, only if not already registered to these events. If no events are specified, it will be registered to all events matching it's methods name. In the case of a closure, you must specify at least one event name.

Paramètres
object | Closure$listenerThe listener
array$eventsAn associative array of event names as keys and the corresponding listener priority as values.
Renvoie
Dispatcher This method is chainable.
Exceptions
InvalidArgumentException
Depuis
1.0

Références Dispatcher\$events, $name, ListenersPriorityQueue\add(), et Priority\NORMAL.

◆ clearEvents()

clearEvents ( )

Clear all events.

Renvoie
EventInterface[] The old events.
Depuis
1.0

Références Dispatcher\$events.

◆ 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
EventInterface | string$eventThe event object or name.
Renvoie
Dispatcher This method is chainable.
Depuis
1.0

◆ countEvents()

countEvents ( )

Count the number of registered event.

Renvoie
integer The numer of registered events.
Depuis
1.0

◆ countListeners()

countListeners (   $event)

Count the number of registered listeners for the given event.

Paramètres
EventInterface | string$eventThe event object or name.
Renvoie
integer The number of registered listeners for the given event.
Depuis
1.0

◆ getEvent()

getEvent (   $name,
  $default = null 
)

Get the event object identified by the given name.

Paramètres
string$nameThe event name.
mixed$defaultThe default value if the event was not registered.
Renvoie
EventInterface|mixed The event of the default value.
Depuis
1.0

Références $default, et $name.

◆ getEvents()

getEvents ( )

Get the registered events.

Renvoie
EventInterface[] The registered event.
Depuis
1.0

Références Dispatcher\$events.

◆ getListenerPriority()

getListenerPriority (   $listener,
  $event 
)

Get the priority of the given listener for the given event.

Paramètres
object | Closure$listenerThe listener.
EventInterface | string$eventThe event object or name.
Renvoie
mixed The listener priority or null if the listener doesn't exist.
Depuis
1.0

◆ getListeners()

getListeners (   $event)

Get the listeners registered to the given event.

Paramètres
EventInterface | string$eventThe event object or name.
Renvoie
object[] An array of registered listeners sorted according to their priorities.
Depuis
1.0

◆ hasEvent()

hasEvent (   $event)

Tell if the given event has been added to this dispatcher.

Paramètres
EventInterface | string$eventThe event object or name.
Renvoie
boolean True if the listener has the given event, false otherwise.
Depuis
1.0

◆ hasListener()

hasListener (   $listener,
  $event = 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
object | Closure$listenerThe listener.
EventInterface | string$eventThe event object or name.
Renvoie
boolean True if the listener is registered, false otherwise.
Depuis
1.0

◆ removeEvent()

removeEvent (   $event)

Remove an event from this dispatcher. The registered listeners will remain.

Paramètres
EventInterface | string$eventThe event object or name.
Renvoie
Dispatcher This method is chainable.
Depuis
1.0

◆ removeListener()

removeListener (   $listener,
  $event = null 
)

Remove the given listener from this dispatcher. If no event is specified, it will be removed from all events it is listening to.

Paramètres
object | Closure$listenerThe listener to remove.
EventInterface | string$eventThe event object or name.
Renvoie
Dispatcher This method is chainable.
Depuis
1.0

◆ setEvent()

setEvent ( EventInterface  $event)

Set an event to the dispatcher. It will replace any event with the same name.

Paramètres
EventInterface$eventThe event.
Renvoie
Dispatcher This method is chainable.
Depuis
1.0

Références EventInterface\getName().

◆ setListenerFilter()

setListenerFilter (   $regex)

Sets a regular expression to filter the class methods when adding a listener.

Paramètres
string$regexA regular expression (for example '^on' will only register methods starting with "on").
Renvoie
Dispatcher This method is chainable.
Depuis
1.0
Obsolète:
1.1.0 Incorporate a method in your listener object such as getEvents to feed into the setListener method.

◆ triggerEvent()

triggerEvent (   $event)

Trigger an event.

Paramètres
EventInterface | string$eventThe event object or name.
Renvoie
EventInterface The event after being passed through all listeners.
Depuis
1.0

Implémente DispatcherInterface.

Documentation des champs

◆ $events

$events = array()
protected

◆ $listenerFilter

$listenerFilter
protected

◆ $listeners

$listeners = array()
protected

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