PHP Class Horde_Notification_Handler, horde

Author: Jan Schneider ([email protected])
Exibir arquivo Open project: horde/horde Class Usage Examples

Protected Properties

Property Type Description
$_decorators array Decorators.
$_forceAttach boolean Forces immediate attachment of a notification to a listener.
$_handles array Additional handle definitions.
$_listeners array Hash containing all attached listener objects.
$_storage Horde_Notification_Storage The storage location where we store the messages.

Public Methods

Method Description
__construct ( Horde_Notification_Storage_Interface $storage ) Initialize the notification system.
addDecorator ( Horde_Notification_Handler_Decorator_Base $decorator ) Add a decorator.
addType ( string $listener, string $type, string $class ) Adds a type handler to a given Listener.
attach ( string $listener, array $params = null, string $class = null ) : Horde_Notification_Listener Registers a listener with the notification object and includes the necessary library file dynamically.
clear ( string $listener = null ) Clear any notification events that may exist in a listener.
count ( string $my_listener = null ) : integer Return the number of notification messages in the stack.
detach ( $listener ) Remove a listener from the notification list.
get ( string $type ) : mixed Returns the current Listener object for a given listener type.
getListener ( string $listener ) : mixed Returns a listener object given a listener name.
notify ( array $options = [] ) Passes the message stack to all listeners and asks them to handle their messages.
push ( mixed $event, string $type = null, array $flags = [], array $options = [] ) Add an event to the Horde message stack.

Protected Methods

Method Description
_addTypes ( string $listener ) Adds any additional listener types to a given Listener.

Method Details

__construct() public method

Initialize the notification system.
public __construct ( Horde_Notification_Storage_Interface $storage )
$storage Horde_Notification_Storage_Interface The storage object to use.

_addTypes() protected method

Adds any additional listener types to a given Listener.
protected _addTypes ( string $listener )
$listener string The listener name.

addDecorator() public method

Add a decorator.
public addDecorator ( Horde_Notification_Handler_Decorator_Base $decorator )
$decorator Horde_Notification_Handler_Decorator_Base The Decorator object.

addType() public method

To change the default listener, use the following:
  $ob->addType('default', '*', $classname);
public addType ( string $listener, string $type, string $class )
$listener string The listener name.
$type string The listener type.
$class string The Event class to use.

attach() public method

Registers a listener with the notification object and includes the necessary library file dynamically.
public attach ( string $listener, array $params = null, string $class = null ) : Horde_Notification_Listener
$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 A hash containing any additional configuration or connection parameters a listener driver might need.
$class string 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
return Horde_Notification_Listener The listener object.

clear() public method

Clear any notification events that may exist in a listener.
public clear ( string $listener = null )
$listener string The name of the listener to flush. If null, clears all unattached events.

count() public method

Return the number of notification messages in the stack.
Author: David Ulevitch ([email protected])
public count ( string $my_listener = null ) : integer
$my_listener string The name of the listener.
return integer The number of messages in the stack.

detach() public method

Remove a listener from the notification list.
public detach ( $listener )

get() public method

Returns the current Listener object for a given listener type.
public get ( string $type ) : mixed
$type string The listener type.
return mixed A Horde_Notification_Listener object, or null if $type listener is not attached.

getListener() public method

Returns a listener object given a listener name.
public getListener ( string $listener ) : mixed
$listener string The listener name.
return mixed Either a Horde_Notification_Listener or null.

notify() public method

Passes the message stack to all listeners and asks them to handle their messages.
public notify ( array $options = [] )
$options 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.

push() public method

Add an event to the Horde message stack.
public push ( mixed $event, string $type = null, array $flags = [], array $options = [] )
$event mixed Horde_Notification_Event object or message string.
$type string The type of message.
$flags array Array of optional flags that will be passed to the registered listeners.
$options 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).

Property Details

$_decorators protected_oe property

Decorators.
protected array $_decorators
return array

$_forceAttach protected_oe property

Forces immediate attachment of a notification to a listener.
protected bool $_forceAttach
return boolean

$_handles protected_oe property

Additional handle definitions.
protected array $_handles
return array

$_listeners protected_oe property

Hash containing all attached listener objects.
protected array $_listeners
return array

$_storage protected_oe property

The storage location where we store the messages.
protected Horde_Notification_Storage $_storage
return Horde_Notification_Storage