[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Source view] [Print] [Project Stats]
Part of the Joomla Framework Event Package
Copyright: | Copyright (C) 2005 - 2021 Open Source Matters, Inc. All rights reserved. |
License: | GNU General Public License version 2 or later; see LICENSE |
File Size: | 540 lines (12 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
Dispatcher:: (20 methods):
setEvent()
addEvent()
hasEvent()
getEvent()
removeEvent()
getEvents()
clearEvents()
countEvents()
addListener()
getListenerPriority()
getListeners()
hasListener()
removeListener()
clearListeners()
countListeners()
addSubscriber()
removeSubscriber()
dispatch()
triggerEvent()
getDefaultEvent()
Class: Dispatcher - X-Ref
Implementation of a DispatcherInterface supporting prioritized listeners.setEvent(EventInterface $event) X-Ref |
Set an event to the dispatcher. It will replace any event with the same name. param: EventInterface $event The event. return: $this |
addEvent(EventInterface $event) X-Ref |
Add an event to this dispatcher, only if it is not existing. param: EventInterface $event The event. return: $this |
hasEvent($event) X-Ref |
Tell if the given event has been added to this dispatcher. param: EventInterface|string $event The event object or name. return: boolean True if the listener has the given event, false otherwise. |
getEvent($name, $default = null) X-Ref |
Get the event object identified by the given name. param: string $name The event name. param: mixed $default The default value if the event was not registered. return: EventInterface|mixed The event of the default value. |
removeEvent($event) X-Ref |
Remove an event from this dispatcher. The registered listeners will remain. param: EventInterface|string $event The event object or name. return: $this |
getEvents() X-Ref |
Get the registered events. return: EventInterface[] The registered event. |
clearEvents() X-Ref |
Clear all events. return: EventInterface[] The old events. |
countEvents() X-Ref |
Count the number of registered event. return: integer The numer of registered events. |
addListener(string $eventName, callable $callback, int $priority = 0) X-Ref |
Attaches a listener to an event param: string $eventName The event to listen to. param: callable $callback A callable function param: integer $priority The priority at which the $callback executed return: boolean |
getListenerPriority($eventName, callable $callback) X-Ref |
Get the priority of the given listener for the given event. param: string $eventName The event to listen to. param: callable $callback A callable function return: mixed The listener priority or null if the listener doesn't exist. |
getListeners(?string $event = null) X-Ref |
Get the listeners registered to the given event. param: string|null $event The event to fetch listeners for or null to fetch all listeners return: callable[] An array of registered listeners sorted according to their priorities. |
hasListener(callable $callback, ?string $eventName = null) X-Ref |
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: callable $callback The callable to check is listening to the event. param: string $eventName An optional event name to check a listener is subscribed to. return: boolean True if the listener is registered, false otherwise. |
removeListener(string $eventName, callable $listener) X-Ref |
Removes an event listener from the specified event. param: string $eventName The event to remove a listener from. param: callable $listener The listener to remove. return: void |
clearListeners($event = null) X-Ref |
Clear the listeners in this dispatcher. If an event is specified, the listeners will be cleared only for that event. param: string $event The event name. return: $this |
countListeners($event) X-Ref |
Count the number of registered listeners for the given event. param: string $event The event name. return: integer |
addSubscriber(SubscriberInterface $subscriber) X-Ref |
Adds an event subscriber. param: SubscriberInterface $subscriber The subscriber. return: void |
removeSubscriber(SubscriberInterface $subscriber) X-Ref |
Removes an event subscriber. param: SubscriberInterface $subscriber The subscriber. return: void |
dispatch(string $name, ?EventInterface $event = null) X-Ref |
Dispatches an event to all registered listeners. param: string $name The name of the event to dispatch. param: EventInterface $event The event to pass to the event handlers/listeners. return: EventInterface |
triggerEvent($event) X-Ref |
Trigger an event. param: EventInterface|string $event The event object or name. return: EventInterface The event after being passed through all listeners. |
getDefaultEvent(string $name) X-Ref |
Get an event object for the specified event name param: string $name The event name to get an EventInterface object for return: EventInterface |
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |