Documentation

Horde_Notification_Handler
in package

The Horde_Notification package provides a subject-observer pattern for raising and showing messages of different types and to different listeners.

Tags
author

Jan Schneider jan@horde.org

category

Horde

license

http://www.horde.org/licenses/lgpl21 LGPL 2.1

Table of Contents

$_decorators  : array<string|int, mixed>
Decorators.
$_forceAttach  : bool
Forces immediate attachment of a notification to a listener.
$_handles  : array<string|int, mixed>
Additional handle definitions.
$_listeners  : array<string|int, mixed>
Hash containing all attached listener objects.
$_storage  : Horde_Notification_Storage
The storage location where we store the messages.
__construct()  : mixed
Initialize the notification system.
addDecorator()  : mixed
Add a decorator.
addType()  : mixed
Adds a type handler to a given Listener.
attach()  : Horde_Notification_Listener
Registers a listener with the notification object and includes the necessary library file dynamically.
clear()  : mixed
Clear any notification events that may exist in a listener.
count()  : int
Return the number of notification messages in the stack.
detach()  : mixed
Remove a listener from the notification list.
get()  : mixed
Returns the current Listener object for a given listener type.
getListener()  : mixed
Returns a listener object given a listener name.
notify()  : mixed
Passes the message stack to all listeners and asks them to handle their messages.
push()  : mixed
Add an event to the Horde message stack.
_addTypes()  : mixed
Adds any additional listener types to a given Listener.

Properties

$_decorators

Decorators.

protected array<string|int, mixed> $_decorators = array()

$_forceAttach

Forces immediate attachment of a notification to a listener.

protected bool $_forceAttach = \false

$_handles

Additional handle definitions.

protected array<string|int, mixed> $_handles = array('default' => array('*' => 'Horde_Notification_Event'))

$_listeners

Hash containing all attached listener objects.

protected array<string|int, mixed> $_listeners = array()

$_storage

The storage location where we store the messages.

protected Horde_Notification_Storage $_storage

Methods

__construct()

Initialize the notification system.

public __construct(Horde_Notification_Storage $storage) : mixed
Parameters
$storage : Horde_Notification_Storage

The storage object to use.

Return values
mixed

addType()

Adds a type handler to a given Listener.

public addType(string $listener, string $type, string $class) : mixed

To change the default listener, use the following:

  $ob->addType('default', '*', $classname);
Parameters
$listener : string

The listener name.

$type : string

The listener type.

$class : string

The Event class to use.

Return values
mixed

attach()

Registers a listener with the notification object and includes the necessary library file dynamically.

public attach(string $listener[, array<string|int, mixed> $params = null ][, string $class = null ]) : Horde_Notification_Listener
Parameters
$listener : string

The name of the listener to attach. These names must be unique; further listeners with the same name will be ignored.

$params : array<string|int, mixed> = null

A hash containing any additional configuration or connection parameters a listener driver might need.

$class : string = null

The class name from which the driver was instantiated if not the default one. If given you have to include the library file containing this class yourself. This is useful if you want the listener driver to be overriden by an application's implementation

Tags
throws
Horde_Exception
Return values
Horde_Notification_Listener

The listener object.

clear()

Clear any notification events that may exist in a listener.

public clear([string $listener = null ]) : mixed
Parameters
$listener : string = null

The name of the listener to flush. If null, clears all unattached events.

Return values
mixed

count()

Return the number of notification messages in the stack.

public count([string $my_listener = null ]) : int
Parameters
$my_listener : string = null

The name of the listener.

Tags
author

David Ulevitch davidu@everydns.net

Return values
int

The number of messages in the stack.

detach()

Remove a listener from the notification list.

public detach(mixed $listener) : mixed
Parameters
$listener : mixed
Tags
throws
Horde_Exception
Return values
mixed

get()

Returns the current Listener object for a given listener type.

public get(string $type) : mixed
Parameters
$type : string

The listener type.

Return values
mixed

A Horde_Notification_Listener object, or null if $type listener is not attached.

getListener()

Returns a listener object given a listener name.

public getListener(string $listener) : mixed
Parameters
$listener : string

The listener name.

Return values
mixed

Either a Horde_Notification_Listener or null.

notify()

Passes the message stack to all listeners and asks them to handle their messages.

public notify([array<string|int, mixed> $options = array() ]) : mixed
Parameters
$options : array<string|int, mixed> = array()

An array containing display options for the listeners. Any options not contained in this list will be passed to the listeners.

listeners - (array) The list of listeners to notify.
raw - (boolean) If true, does not call the listener's notify()
      function.
Return values
mixed

push()

Add an event to the Horde message stack.

public push(mixed $event[, string $type = null ][, array<string|int, mixed> $flags = array() ][, array<string|int, mixed> $options = array() ]) : mixed
Parameters
$event : mixed

Horde_Notification_Event object or message string.

$type : string = null

The type of message.

$flags : array<string|int, mixed> = array()

Array of optional flags that will be passed to the registered listeners.

$options : array<string|int, mixed> = array()

Additional options:

'immediate' - (boolean) If true, immediately tries to attach to a
              listener. If no listener exists for this type, the
              message will be dropped.
              DEFAULT: false (message will be attached to available
              handler at the time notify() is called).
Return values
mixed

_addTypes()

Adds any additional listener types to a given Listener.

protected _addTypes(string $listener) : mixed
Parameters
$listener : string

The listener name.

Return values
mixed

Search results