Overview

Packages

  • Notification

Classes

  • Horde_Notification
  • Horde_Notification_Event
  • Horde_Notification_Event_Status
  • Horde_Notification_Exception
  • Horde_Notification_Handler
  • Horde_Notification_Handler_Decorator_Alarm
  • Horde_Notification_Handler_Decorator_Base
  • Horde_Notification_Handler_Decorator_Log
  • Horde_Notification_Listener
  • Horde_Notification_Listener_Audio
  • Horde_Notification_Listener_Status
  • Horde_Notification_Storage_Object
  • Horde_Notification_Storage_Session

Interfaces

  • Horde_Notification_Storage_Interface
  • Overview
  • Package
  • Class
  • Tree
 1: <?php
 2: /**
 3:  * A class that stores notifications in an object.
 4:  *
 5:  * @category Horde
 6:  * @package  Notification
 7:  * @author   Jan Schneider <jan@horde.org>
 8:  * @license  http://www.horde.org/licenses/lgpl21 LGPL 2.1
 9:  * @link     http://pear.horde.org/index.php?package=Notification
10:  */
11: 
12: /**
13:  * A class that stores notifications in an object.
14:  *
15:  * Copyright 2010-2012 Horde LLC (http://www.horde.org/)
16:  *
17:  * See the enclosed file COPYING for license information (LGPL). If you
18:  * did not receive this file, see http://www.horde.org/licenses/lgpl21.
19:  *
20:  * @category Horde
21:  * @package  Notification
22:  * @author   Jan Schneider <jan@horde.org>
23:  * @license  http://www.horde.org/licenses/lgpl21 LGPL 2.1
24:  * @link     http://pear.horde.org/index.php?package=Notification
25:  */
26: class Horde_Notification_Storage_Object
27: implements Horde_Notification_Storage_Interface
28: {
29:     /**
30:      * Holds the notifications pushed into this storage object.
31:      *
32:      * @var array
33:      */
34:     public $notifications = array();
35: 
36:     /**
37:      * Return the given stack from the notification store.
38:      *
39:      * @param string $key  The key for the data.
40:      *
41:      * @return mixed  The notification data stored for the given key.
42:      */
43:     public function get($key)
44:     {
45:         return $this->notifications[$key];
46:     }
47: 
48:     /**
49:      * Set the given stack in the notification store.
50:      *
51:      * @param string $key   The key for the data.
52:      * @param mixed $value  The data.
53:      */
54:     public function set($key, $value)
55:     {
56:         $this->notifications[$key] = $value;
57:     }
58: 
59:     /**
60:      * Is the given stack present in the notification store?
61:      *
62:      * @param string $key  The key of the data.
63:      *
64:      * @return boolean  True if the element is set, false otherwise.
65:      */
66:     public function exists($key)
67:     {
68:         return isset($this->notifications[$key]);
69:     }
70: 
71:     /**
72:      * Unset the given stack in the notification store.
73:      *
74:      * @param string $key  The key of the data.
75:      */
76:     public function clear($key)
77:     {
78:         unset($this->notifications[$key]);
79:     }
80: 
81:     /**
82:      * Store a new event for the given listener stack.
83:      *
84:      * @param string $listener                    The event will be stored for
85:      *                                            this listener.
86:      * @param Horde_Notification_Event $event  The event to store.
87:      */
88:     public function push($listener, Horde_Notification_Event $event)
89:     {
90:         $this->notifications[$listener][] = $event;
91:     }
92: 
93: }
94: 
API documentation generated by ApiGen