Dispatches a notification to a set of watchers.
More...
Dispatches a notification to a set of watchers.
- Todo
- should go into MediaWiki core.
- Copyright
- GPL-2.0-or-later
- Author
- Daniel Kinzler
◆ __construct()
Wikibase\Repo\GenericEventDispatcher::__construct |
( |
| $interface | ) |
|
- Parameters
-
class-string | $interface | the interface watchers must implement |
◆ dispatch()
Wikibase\Repo\GenericEventDispatcher::dispatch |
( |
| $event, |
|
|
| $args ) |
Dispatches a notification to all registered watchers.
- Parameters
-
string | $event | the name of the event, that is, the name of the method to call on the watchers. |
| mixed | ...$args Any extra parameters are passed to the watcher method. |
- Exceptions
-
◆ registerWatcher()
Wikibase\Repo\GenericEventDispatcher::registerWatcher |
( |
| $listener | ) |
|
Registers a watcher.
The watcher will be called whenever the dispatch() method is called, until the watcher is unregistered.
- Parameters
-
EntityStoreWatcher | $listener | |
- Exceptions
-
- Returns
- int The listener key, for removing the listener later.
◆ unregisterWatcher()
Wikibase\Repo\GenericEventDispatcher::unregisterWatcher |
( |
| $key | ) |
|
Unregisters a watcher using its registration key.
The watcher will no longer be called by dispatch().
- Parameters
-
int | $key | A watcher key as returned by registerWatcher(). |
- Exceptions
-
◆ $interface
Wikibase\Repo\GenericEventDispatcher::$interface |
|
private |
◆ $key
Wikibase\Repo\GenericEventDispatcher::$key = 0 |
|
private |
◆ $watchers
Wikibase\Repo\GenericEventDispatcher::$watchers = [] |
|
private |
The documentation for this class was generated from the following file: