1: <?php
2:
3: /*
4: * This file is part of the Symfony package.
5: *
6: * (c) Fabien Potencier <fabien@symfony.com>
7: *
8: * For the full copyright and license information, please view the LICENSE
9: * file that was distributed with this source code.
10: */
11:
12: /**
13: * SessionHandlerInterface
14: *
15: * Provides forward compatibility with PHP 5.4
16: *
17: * Extensive documentation can be found at php.net, see links:
18: *
19: * @see http://php.net/sessionhandlerinterface
20: * @see http://php.net/session.customhandler
21: * @see http://php.net/session-set-save-handler
22: *
23: * @author Drak <drak@zikula.org>
24: */
25: interface SessionHandlerInterface
26: {
27: /**
28: * Open session.
29: *
30: * @see http://php.net/sessionhandlerinterface.open
31: *
32: * @param string $savePath Save path.
33: * @param string $sessionName Session Name.
34: *
35: * @throws \RuntimeException If something goes wrong starting the session.
36: *
37: * @return boolean
38: */
39: public function open($savePath, $sessionName);
40:
41: /**
42: * Close session.
43: *
44: * @see http://php.net/sessionhandlerinterface.close
45: *
46: * @return boolean
47: */
48: public function close();
49:
50: /**
51: * Read session.
52: *
53: * @param string $sessionId
54: *
55: * @see http://php.net/sessionhandlerinterface.read
56: *
57: * @throws \RuntimeException On fatal error but not "record not found".
58: *
59: * @return string String as stored in persistent storage or empty string in all other cases.
60: */
61: public function read($sessionId);
62:
63: /**
64: * Commit session to storage.
65: *
66: * @see http://php.net/sessionhandlerinterface.write
67: *
68: * @param string $sessionId Session ID.
69: * @param string $data Session serialized data to save.
70: *
71: * @return boolean
72: */
73: public function write($sessionId, $data);
74:
75: /**
76: * Destroys this session.
77: *
78: * @see http://php.net/sessionhandlerinterface.destroy
79: *
80: * @param string $sessionId Session ID.
81: *
82: * @throws \RuntimeException On fatal error.
83: *
84: * @return boolean
85: */
86: public function destroy($sessionId);
87:
88: /**
89: * Garbage collection for storage.
90: *
91: * @see http://php.net/sessionhandlerinterface.gc
92: *
93: * @param integer $lifetime Max lifetime in seconds to keep sessions stored.
94: *
95: * @throws \RuntimeException On fatal error.
96: *
97: * @return boolean
98: */
99: public function gc($lifetime);
100: }
101: