[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/vendor/joomla/event/src/ -> DispatcherInterface.php (summary)

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: 127 lines (3 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

DispatcherInterface:: (9 methods):
  dispatch()
  addListener()
  clearListeners()
  countListeners()
  getListeners()
  hasListener()
  removeListener()
  addSubscriber()
  removeSubscriber()


Interface: DispatcherInterface  - X-Ref

Interface for event dispatchers.

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

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

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

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|null  $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

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



Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer