From: Gunnar Wrobel Date: Wed, 4 Nov 2009 22:47:10 +0000 (+0100) Subject: Clarify that these are interfaces by renaming them to Interface.php. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=8f39f7ba1947693696174bea03cdbc095d149953;p=horde.git Clarify that these are interfaces by renaming them to Interface.php. --- diff --git a/framework/Notification/lib/Horde/Notification/Handler.php b/framework/Notification/lib/Horde/Notification/Handler.php deleted file mode 100644 index b29e4e10a..000000000 --- a/framework/Notification/lib/Horde/Notification/Handler.php +++ /dev/null @@ -1,117 +0,0 @@ - - * @package Horde_Notification - */ -interface Horde_Notification_Handler -{ - /** - * Registers a listener with the notification object and includes - * the necessary library file dynamically. - * - * @param string $listener The name of the listener to attach. These - * names must be unique; further listeners with - * the same name will be ignored. - * @param array $params A hash containing any additional configuration - * or connection parameters a listener driver - * might need. - * @param string $class 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. - * @throws Horde_Exception - */ - public function attach($listener, $params = null, $class = null); - - /** - * Remove a listener from the notification list. This will discard any - * notifications in this listeners stack. - * - * @param string $listner The name of the listener to detach. - * - * @throws Horde_Exception - */ - public function detach($listener); - - /** - * Replaces a listener in the notification list. This preserves all - * notifications in this listeners stack. If the listener does not exist, - * the new listener will be added automatically. - * - * @param string $listener See attach(). - * @param array $params See attach(). - * @param string $class See attach(). - * - * @return Horde_Notification_Listener See attach() - * @throws Horde_Exception - */ - public function replace($listener, array $params = array(), $class = null); - - /** - * Add an event to the Horde message stack. - * - * The event type parameter should begin with 'horde.' unless the - * application defines its own Horde_Notification_Listener subclass that - * handles additional codes. - * - * @param mixed $event Horde_Notification_Event object or message string. - * @param integer $type The type of message: 'horde.error', - * 'horde.warning', 'horde.success', or - * 'horde.message'. - * @param array $flags Array of optional flags that will be passed to the - * registered listeners. - */ - public function push($event, $type = null, array $flags = array()); - - /** - * Passes the message stack to all listeners and asks them to - * handle their messages. - * - * @param array $options An array containing display options for the - * listeners. - */ - public function notify(array $options = array()); - - /** - * Convert the 'listeners' option into the format expected by the - * notification handler. - * - * @param array $options An array containing display options for the - * listeners. - */ - public function setNotificationListeners(array &$options); - - /** - * Passes the message stack to all listeners and asks them to - * handle their messages. - * - * @param array $options An array containing display options for the - * listeners. This array is required to contain the - * correct lowercased listener names as array in the - * entry 'listeners'. - */ - public function notifyListeners(array $options); - - /** - * Return the number of notification messages in the stack. - * - * @author David Ulevitch - * - * @param string $my_listener The name of the listener. - * - * @return integer The number of messages in the stack. - */ - public function count($my_listener = null); -} diff --git a/framework/Notification/lib/Horde/Notification/Handler/Alarm.php b/framework/Notification/lib/Horde/Notification/Handler/Alarm.php index 13ba61f55..4b4e43de2 100644 --- a/framework/Notification/lib/Horde/Notification/Handler/Alarm.php +++ b/framework/Notification/lib/Horde/Notification/Handler/Alarm.php @@ -11,7 +11,7 @@ * @package Horde_Notification */ class Horde_Notification_Handler_Alarm -implements Horde_Notification_Handler +implements Horde_Notification_Handler_Interface { /** * The notification handler decorated by this instance. @@ -36,7 +36,7 @@ implements Horde_Notification_Handler * @param Horde_Alarm $alarm The alarm system to notify. */ public function __construct( - Horde_Notification_Handler $handler, + Horde_Notification_Handler_Interface $handler, Horde_Alarm $alarm ) { $this->_handler = $handler; diff --git a/framework/Notification/lib/Horde/Notification/Handler/Base.php b/framework/Notification/lib/Horde/Notification/Handler/Base.php index daf472be1..8d6766942 100644 --- a/framework/Notification/lib/Horde/Notification/Handler/Base.php +++ b/framework/Notification/lib/Horde/Notification/Handler/Base.php @@ -12,7 +12,8 @@ * @author Jan Schneider * @package Horde_Notification */ -class Horde_Notification_Handler_Base implements Horde_Notification_Handler +class Horde_Notification_Handler_Base +implements Horde_Notification_Handler_Interface { /** * Hash containing all attached listener objects. @@ -41,8 +42,9 @@ class Horde_Notification_Handler_Base implements Horde_Notification_Handler * * @param Horde_Notification_Storage $storage The storage location to use. */ - public function __construct(Horde_Notification_Storage $storage) - { + public function __construct( + Horde_Notification_Storage_Interface $storage + ) { $this->_storage = $storage; } diff --git a/framework/Notification/lib/Horde/Notification/Handler/Hordelog.php b/framework/Notification/lib/Horde/Notification/Handler/Hordelog.php index 5dbdb76ce..5558f472e 100644 --- a/framework/Notification/lib/Horde/Notification/Handler/Hordelog.php +++ b/framework/Notification/lib/Horde/Notification/Handler/Hordelog.php @@ -12,7 +12,7 @@ * @package Horde_Notification */ class Horde_Notification_Handler_Hordelog -implements Horde_Notification_Handler +implements Horde_Notification_Handler_Interface { /** * The notification handler decorated by this instance. @@ -28,8 +28,9 @@ implements Horde_Notification_Handler * @param Horde_Notification_Handler $handler The handler this instance * provides with logging. */ - public function __construct(Horde_Notification_Handler $handler) - { + public function __construct( + Horde_Notification_Handler_Interface $handler + ) { $this->_handler = $handler; } diff --git a/framework/Notification/lib/Horde/Notification/Handler/Interface.php b/framework/Notification/lib/Horde/Notification/Handler/Interface.php new file mode 100644 index 000000000..c321284b2 --- /dev/null +++ b/framework/Notification/lib/Horde/Notification/Handler/Interface.php @@ -0,0 +1,117 @@ + + * @package Horde_Notification + */ +interface Horde_Notification_Handler_Interface +{ + /** + * Registers a listener with the notification object and includes + * the necessary library file dynamically. + * + * @param string $listener The name of the listener to attach. These + * names must be unique; further listeners with + * the same name will be ignored. + * @param array $params A hash containing any additional configuration + * or connection parameters a listener driver + * might need. + * @param string $class 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. + * @throws Horde_Exception + */ + public function attach($listener, $params = null, $class = null); + + /** + * Remove a listener from the notification list. This will discard any + * notifications in this listeners stack. + * + * @param string $listner The name of the listener to detach. + * + * @throws Horde_Exception + */ + public function detach($listener); + + /** + * Replaces a listener in the notification list. This preserves all + * notifications in this listeners stack. If the listener does not exist, + * the new listener will be added automatically. + * + * @param string $listener See attach(). + * @param array $params See attach(). + * @param string $class See attach(). + * + * @return Horde_Notification_Listener See attach() + * @throws Horde_Exception + */ + public function replace($listener, array $params = array(), $class = null); + + /** + * Add an event to the Horde message stack. + * + * The event type parameter should begin with 'horde.' unless the + * application defines its own Horde_Notification_Listener subclass that + * handles additional codes. + * + * @param mixed $event Horde_Notification_Event object or message string. + * @param integer $type The type of message: 'horde.error', + * 'horde.warning', 'horde.success', or + * 'horde.message'. + * @param array $flags Array of optional flags that will be passed to the + * registered listeners. + */ + public function push($event, $type = null, array $flags = array()); + + /** + * Passes the message stack to all listeners and asks them to + * handle their messages. + * + * @param array $options An array containing display options for the + * listeners. + */ + public function notify(array $options = array()); + + /** + * Convert the 'listeners' option into the format expected by the + * notification handler. + * + * @param array $options An array containing display options for the + * listeners. + */ + public function setNotificationListeners(array &$options); + + /** + * Passes the message stack to all listeners and asks them to + * handle their messages. + * + * @param array $options An array containing display options for the + * listeners. This array is required to contain the + * correct lowercased listener names as array in the + * entry 'listeners'. + */ + public function notifyListeners(array $options); + + /** + * Return the number of notification messages in the stack. + * + * @author David Ulevitch + * + * @param string $my_listener The name of the listener. + * + * @return integer The number of messages in the stack. + */ + public function count($my_listener = null); +} diff --git a/framework/Notification/lib/Horde/Notification/Handler/Logged.php b/framework/Notification/lib/Horde/Notification/Handler/Logged.php index 63d20d67e..fbf3e1070 100644 --- a/framework/Notification/lib/Horde/Notification/Handler/Logged.php +++ b/framework/Notification/lib/Horde/Notification/Handler/Logged.php @@ -12,7 +12,7 @@ * @package Horde_Notification */ class Horde_Notification_Handler_Logged -implements Horde_Notification_Handler +implements Horde_Notification_Handler_Interface { /** * The notification handler decorated by this instance. @@ -42,8 +42,10 @@ implements Horde_Notification_Handler * common Logger here (PEAR Log, * Horde_Log_Logger, or Zend_Log). */ - public function __construct(Horde_Notification_Handler $handler, $logger) - { + public function __construct( + Horde_Notification_Handler_Interface $handler, + $logger + ) { $this->_handler = $handler; $this->_logger = $logger; } diff --git a/framework/Notification/lib/Horde/Notification/Storage.php b/framework/Notification/lib/Horde/Notification/Storage.php deleted file mode 100644 index ca35e7a9b..000000000 --- a/framework/Notification/lib/Horde/Notification/Storage.php +++ /dev/null @@ -1,39 +0,0 @@ - - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Notification - */ - -/** - * An interface describing a storage location for notification messages. - * - * Copyright 2009 The Horde Project (http://www.horde.org/) - * - * See the enclosed file COPYING for license information (LGPL). If you - * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. - * - * @category Horde - * @package Notification - * @author Gunnar Wrobel - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Notification - */ -interface Horde_Notification_Storage extends ArrayAccess -{ - /** - * Store a new event. - * - * @param string $listener The event will be stored for this listener. - * @param array $event The event to store. - * - * @return NULL - */ - public function push($listener, array $event); -} \ No newline at end of file diff --git a/framework/Notification/lib/Horde/Notification/Storage/Interface.php b/framework/Notification/lib/Horde/Notification/Storage/Interface.php new file mode 100644 index 000000000..f6382d633 --- /dev/null +++ b/framework/Notification/lib/Horde/Notification/Storage/Interface.php @@ -0,0 +1,39 @@ + + * @license http://www.fsf.org/copyleft/lgpl.html LGPL + * @link http://pear.horde.org/index.php?package=Notification + */ + +/** + * An interface describing a storage location for notification messages. + * + * Copyright 2009 The Horde Project (http://www.horde.org/) + * + * See the enclosed file COPYING for license information (LGPL). If you + * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. + * + * @category Horde + * @package Notification + * @author Gunnar Wrobel + * @license http://www.fsf.org/copyleft/lgpl.html LGPL + * @link http://pear.horde.org/index.php?package=Notification + */ +interface Horde_Notification_Storage_Interface extends ArrayAccess +{ + /** + * Store a new event. + * + * @param string $listener The event will be stored for this listener. + * @param array $event The event to store. + * + * @return NULL + */ + public function push($listener, array $event); +} \ No newline at end of file diff --git a/framework/Notification/lib/Horde/Notification/Storage/Session.php b/framework/Notification/lib/Horde/Notification/Storage/Session.php index 0232fcb28..45c52b738 100644 --- a/framework/Notification/lib/Horde/Notification/Storage/Session.php +++ b/framework/Notification/lib/Horde/Notification/Storage/Session.php @@ -25,7 +25,8 @@ * @license http://www.fsf.org/copyleft/lgpl.html LGPL * @link http://pear.horde.org/index.php?package=Notification */ -class Horde_Notification_Storage_Session implements Horde_Notification_Storage +class Horde_Notification_Storage_Session +implements Horde_Notification_Storage_Interface { /** * The stack name. diff --git a/framework/Notification/package.xml b/framework/Notification/package.xml index d80e2b688..c02fd825d 100644 --- a/framework/Notification/package.xml +++ b/framework/Notification/package.xml @@ -33,11 +33,11 @@ http://pear.php.net/dtd/package-2.0.xsd"> - + @@ -48,8 +48,8 @@ http://pear.php.net/dtd/package-2.0.xsd"> - + @@ -115,10 +115,10 @@ http://pear.php.net/dtd/package-2.0.xsd"> - + @@ -126,7 +126,7 @@ http://pear.php.net/dtd/package-2.0.xsd"> - +