Clarify that these are interfaces by renaming them to Interface.php.
authorGunnar Wrobel <p@rdus.de>
Wed, 4 Nov 2009 22:47:10 +0000 (23:47 +0100)
committerGunnar Wrobel <p@rdus.de>
Wed, 4 Nov 2009 22:47:10 +0000 (23:47 +0100)
framework/Notification/lib/Horde/Notification/Handler.php [deleted file]
framework/Notification/lib/Horde/Notification/Handler/Alarm.php
framework/Notification/lib/Horde/Notification/Handler/Base.php
framework/Notification/lib/Horde/Notification/Handler/Hordelog.php
framework/Notification/lib/Horde/Notification/Handler/Interface.php [new file with mode: 0644]
framework/Notification/lib/Horde/Notification/Handler/Logged.php
framework/Notification/lib/Horde/Notification/Storage.php [deleted file]
framework/Notification/lib/Horde/Notification/Storage/Interface.php [new file with mode: 0644]
framework/Notification/lib/Horde/Notification/Storage/Session.php
framework/Notification/package.xml

diff --git a/framework/Notification/lib/Horde/Notification/Handler.php b/framework/Notification/lib/Horde/Notification/Handler.php
deleted file mode 100644 (file)
index b29e4e1..0000000
+++ /dev/null
@@ -1,117 +0,0 @@
-<?php
-/**
- * The Horde_Notification_Handler:: interfaces describes the handlers that
- * notify the listeners.
- *
- * Copyright 2001-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.
- *
- * @author  Jan Schneider <jan@horde.org>
- * @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 <davidu@everydns.net>
-     *
-     * @param string $my_listener  The name of the listener.
-     *
-     * @return integer  The number of messages in the stack.
-     */
-    public function count($my_listener = null);
-}
index 13ba61f..4b4e43d 100644 (file)
@@ -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;
index daf472b..8d67669 100644 (file)
@@ -12,7 +12,8 @@
  * @author  Jan Schneider <jan@horde.org>
  * @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;
     }
 
index 5dbdb76..5558f47 100644 (file)
@@ -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 (file)
index 0000000..c321284
--- /dev/null
@@ -0,0 +1,117 @@
+<?php
+/**
+ * The Horde_Notification_Handler:: interfaces describes the handlers that
+ * notify the listeners.
+ *
+ * Copyright 2001-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.
+ *
+ * @author  Jan Schneider <jan@horde.org>
+ * @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 <davidu@everydns.net>
+     *
+     * @param string $my_listener  The name of the listener.
+     *
+     * @return integer  The number of messages in the stack.
+     */
+    public function count($my_listener = null);
+}
index 63d20d6..fbf3e10 100644 (file)
@@ -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 (file)
index ca35e7a..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-<?php
-/**
- * An interface describing a storage location for notification messages.
- *
- * PHP version 5
- *
- * @category Horde
- * @package  Notification
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @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 <wrobel@pardus.de>
- * @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 (file)
index 0000000..f6382d6
--- /dev/null
@@ -0,0 +1,39 @@
+<?php
+/**
+ * An interface describing a storage location for notification messages.
+ *
+ * PHP version 5
+ *
+ * @category Horde
+ * @package  Notification
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @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 <wrobel@pardus.de>
+ * @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
index 0232fcb..45c52b7 100644 (file)
@@ -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.
index d80e2b6..c02fd82 100644 (file)
@@ -33,11 +33,11 @@ http://pear.php.net/dtd/package-2.0.xsd">
    <dir name="lib">
     <dir name="Horde">
      <dir name="Notification">
-      <file name="Handler.php" role="php" />
       <dir name="Handler">
        <file name="Alarm.php" role="php" />
        <file name="Base.php" role="php" />
        <file name="Hordelog.php" role="php" />
+       <file name="Interface.php" role="php" />
        <file name="Logged.php" role="php" />
       </dir> <!-- /lib/Horde/Notification/Handler -->
       <dir name="Listener">
@@ -48,8 +48,8 @@ http://pear.php.net/dtd/package-2.0.xsd">
       </dir> <!-- /lib/Horde/Notification/Listener -->
       <file name="Event.php" role="php" />
       <file name="Listener.php" role="php" />
-      <file name="Storage.php" role="php" />
       <dir name="Storage">
+       <file name="Interface.php" role="php" />
        <file name="Session.php" role="php" />
       </dir> <!-- /lib/Horde/Notification/Storage -->
      </dir> <!-- /lib/Horde/Notification -->
@@ -115,10 +115,10 @@ http://pear.php.net/dtd/package-2.0.xsd">
  </dependencies>
  <phprelease>
   <filelist>
-   <install name="lib/Horde/Notification/Handler.php" as="Horde/Notification/Handler.php" />
    <install name="lib/Horde/Notification/Handler/Alarm.php" as="Horde/Notification/Handler/Alarm.php" />
    <install name="lib/Horde/Notification/Handler/Base.php" as="Horde/Notification/Handler/Base.php" />
    <install name="lib/Horde/Notification/Handler/Hordelog.php" as="Horde/Notification/Handler/Hordelog.php" />
+   <install name="lib/Horde/Notification/Handler/Interface.php" as="Horde/Notification/Handler/Interface.php" />
    <install name="lib/Horde/Notification/Handler/Logged.php" as="Horde/Notification/Handler/Logged.php" />
    <install name="lib/Horde/Notification/Listener/Audio.php" as="Horde/Notification/Listener/Audio.php" />
    <install name="lib/Horde/Notification/Listener/Javascript.php" as="Horde/Notification/Listener/Javascript.php" />
@@ -126,7 +126,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
    <install name="lib/Horde/Notification/Listener/Status.php" as="Horde/Notification/Listener/Status.php" />
    <install name="lib/Horde/Notification/Event.php" as="Horde/Notification/Event.php" />
    <install name="lib/Horde/Notification/Listener.php" as="Horde/Notification/Listener.php" />
-   <install name="lib/Horde/Notification/Storage.php" as="Horde/Notification/Storage.php" />
+   <install name="lib/Horde/Notification/Storage/Interface.php" as="Horde/Notification/Storage/Interface.php" />
    <install name="lib/Horde/Notification/Storage/Session.php" as="Horde/Notification/Storage/Session.php" />
    <install name="lib/Horde/Notification.php" as="Horde/Notification.php" />
    <install name="test/Horde/Notification/AllTests.php" as="Horde/Notification/AllTests.php" />