Notifier
in package
Uses
Singleton
Notification manager
Tags
Table of Contents
- $callbacks : array<string|int, mixed>
- $instance : mixed
- $registered : bool
- $registeredGlobalParams : array<string|int, mixed>
- __clone() : mixed
- __wakeup() : mixed
- bindEvent() : mixed
- bindEvents() : mixed
- fireEvent() : mixed
- forgetInstance() : mixed
- Forget this singleton's instance if it exists
- getContextVars() : mixed
- instance() : mixed
- Create a new instance of this singleton.
- queueEvent() : mixed
- registerCallback() : mixed
- Registers a callback function that defines context variables.
- registerGlobalParams() : mixed
- __construct() : mixed
- Constructor.
- init() : mixed
- Initialize the singleton free from constructor parameters.
- processCallbacks() : void
- Helper to process callbacks once and once only.
Properties
$callbacks
protected
array<string|int, mixed>
$callbacks
= []
Cache of registration callbacks.
$instance
protected
static mixed
$instance
$registered
protected
bool
$registered
= false
Internal marker to see if callbacks are run.
$registeredGlobalParams
protected
array<string|int, mixed>
$registeredGlobalParams
List of registered global params in the system
Methods
__clone()
public
__clone() : mixed
Return values
mixed —__wakeup()
public
__wakeup() : mixed
Return values
mixed —bindEvent()
public
static bindEvent(mixed $systemEventName, mixed $notifyEventClass) : mixed
Parameters
- $systemEventName : mixed
- $notifyEventClass : mixed
Return values
mixed —bindEvents()
public
static bindEvents(array<string|int, mixed> $events) : mixed
Parameters
- $events : array<string|int, mixed>
Return values
mixed —fireEvent()
public
fireEvent(mixed $eventClass, array<string|int, mixed> $params) : mixed
Parameters
- $eventClass : mixed
- $params : array<string|int, mixed>
Return values
mixed —forgetInstance()
Forget this singleton's instance if it exists
public
final static forgetInstance() : mixed
Return values
mixed —getContextVars()
public
getContextVars() : mixed
Return values
mixed —instance()
Create a new instance of this singleton.
public
final static instance() : mixed
Return values
mixed —queueEvent()
public
queueEvent(mixed $eventClass, array<string|int, mixed> $params) : mixed
Parameters
- $eventClass : mixed
- $params : array<string|int, mixed>
Return values
mixed —registerCallback()
Registers a callback function that defines context variables.
public
registerCallback(callable $callback) : mixed
The callback function should register context variables by calling the manager's
registerGlobalParams method. The manager instance is passed to the callback
function as an argument. Usage:
Notifier::registerCallback(function($manager){
$manager->registerGlobalParams([...]);
});
Parameters
- $callback : callable
-
A callable function.
Return values
mixed —registerGlobalParams()
public
registerGlobalParams(array<string|int, mixed> $params) : mixed
Parameters
- $params : array<string|int, mixed>
Return values
mixed —__construct()
Constructor.
protected
final __construct() : mixed
Return values
mixed —init()
Initialize the singleton free from constructor parameters.
protected
init() : mixed
Return values
mixed —processCallbacks()
Helper to process callbacks once and once only.
protected
processCallbacks() : void