1: <?php
2: /**
3: * The Horde_Kolab_Session_Decorator_Base provides a base for session
4: * decorators.
5: *
6: * PHP version 5
7: *
8: * @category Kolab
9: * @package Kolab_Session
10: * @author Gunnar Wrobel <wrobel@pardus.de>
11: * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
12: * @link http://pear.horde.org/index.php?package=Kolab_Session
13: */
14:
15: /**
16: * The Horde_Kolab_Session_Decorator_Base provides a base for session
17: * decorators.
18: *
19: * Copyright 2009-2012 Horde LLC (http://www.horde.org/)
20: *
21: * See the enclosed file COPYING for license information (LGPL). If you
22: * did not receive this file, see http://www.horde.org/licenses/lgpl21.
23: *
24: * @category Kolab
25: * @package Kolab_Session
26: * @author Gunnar Wrobel <wrobel@pardus.de>
27: * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
28: * @link http://pear.horde.org/index.php?package=Kolab_Session
29: */
30: class Horde_Kolab_Session_Decorator_Base
31: implements Horde_Kolab_Session
32: {
33: /**
34: * The session handler this instance provides with anonymous access.
35: *
36: * @var Horde_Kolab_Session
37: */
38: protected $_session;
39:
40: /**
41: * Constructor.
42: *
43: * @param Horde_Kolab_Session $session The this instance should provide
44: * anonymous access for.
45: */
46: public function __construct(
47: Horde_Kolab_Session $session
48: ) {
49: $this->_session = $session;
50: }
51:
52: /**
53: * Try to connect the session handler.
54: *
55: * @param string $user_id The user ID to connect with.
56: * @param array $credentials An array of login credentials. For Kolab,
57: * this must contain a "password" entry.
58: *
59: * @return NULL
60: *
61: * @throws Horde_Kolab_Session_Exception If the connection failed.
62: */
63: public function connect($user_id = null, array $credentials = null)
64: {
65: $this->_session->connect($user_id, $credentials);
66: }
67:
68: /**
69: * Return the user id used for connecting the session.
70: *
71: * @return string The user id.
72: */
73: public function getId()
74: {
75: return $this->_session->getId();
76: }
77:
78: /**
79: * Return the users mail address.
80: *
81: * @return string The users mail address.
82: */
83: public function getMail()
84: {
85: return $this->_session->getMail();
86: }
87:
88: /**
89: * Return the users uid.
90: *
91: * @return string The users uid.
92: */
93: public function getUid()
94: {
95: return $this->_session->getUid();
96: }
97:
98: /**
99: * Return the users name.
100: *
101: * @return string The users name.
102: */
103: public function getName()
104: {
105: return $this->_session->getName();
106: }
107:
108: /**
109: * Return the imap server.
110: *
111: * @return string The imap host for the current user.
112: */
113: public function getImapServer()
114: {
115: return $this->_session->getImapServer();
116: }
117:
118: /**
119: * Return the freebusy server.
120: *
121: * @return string The freebusy host for the current user.
122: */
123: public function getFreebusyServer()
124: {
125: return $this->_session->getFreebusyServer();
126: }
127:
128: /**
129: * Import the session data from an array.
130: *
131: * @param array The session data.
132: *
133: * @return NULL
134: */
135: public function import(array $session_data)
136: {
137: $this->_session->import($session_data);
138: }
139:
140: /**
141: * Export the session data as array.
142: *
143: * @return array The session data.
144: */
145: public function export()
146: {
147: return $this->_session->export();
148: }
149:
150: /**
151: * Clear the session data.
152: *
153: * @return NULL
154: */
155: public function purge()
156: {
157: $this->_session->purge();
158: }
159: }
160: