1 <?php
2 /**
3 * @package Joomla.Platform
4 * @subpackage Session
5 *
6 * @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
7 * @license GNU General Public License version 2 or later; see LICENSE
8 */
9
10 defined('JPATH_PLATFORM') or die;
11
12 /**
13 * Interface for managing HTTP sessions
14 *
15 * @since 3.5
16 * @deprecated 4.0 The CMS' Session classes will be replaced with the `joomla/session` package
17 */
18 interface JSessionHandlerInterface
19 {
20 /**
21 * Starts the session.
22 *
23 * @return boolean True if started.
24 *
25 * @since 3.5
26 * @throws RuntimeException If something goes wrong starting the session.
27 */
28 public function start();
29
30 /**
31 * Checks if the session is started.
32 *
33 * @return boolean True if started, false otherwise.
34 *
35 * @since 3.5
36 */
37 public function isStarted();
38
39 /**
40 * Returns the session ID
41 *
42 * @return string The session ID
43 *
44 * @since 3.5
45 */
46 public function getId();
47
48 /**
49 * Sets the session ID
50 *
51 * @param string $id The session ID
52 *
53 * @return void
54 *
55 * @since 3.5
56 */
57 public function setId($id);
58
59 /**
60 * Returns the session name
61 *
62 * @return mixed The session name.
63 *
64 * @since 3.5
65 */
66 public function getName();
67
68 /**
69 * Sets the session name
70 *
71 * @param string $name The name of the session
72 *
73 * @return void
74 *
75 * @since 3.5
76 */
77 public function setName($name);
78
79 /**
80 * Regenerates ID that represents this storage.
81 *
82 * Note regenerate+destroy should not clear the session data in memory only delete the session data from persistent storage.
83 *
84 * @param boolean $destroy Destroy session when regenerating?
85 * @param integer $lifetime Sets the cookie lifetime for the session cookie. A null value will leave the system settings unchanged,
86 * 0 sets the cookie to expire with browser session. Time is in seconds, and is not a Unix timestamp.
87 *
88 * @return boolean True if session regenerated, false if error
89 *
90 * @since 3.5
91 */
92 public function regenerate($destroy = false, $lifetime = null);
93
94 /**
95 * Force the session to be saved and closed.
96 *
97 * This method must invoke session_write_close() unless this interface is used for a storage object design for unit or functional testing where
98 * a real PHP session would interfere with testing, in which case it should actually persist the session data if required.
99 *
100 * @return void
101 *
102 * @see session_write_close()
103 * @since 3.5
104 * @throws RuntimeException If the session is saved without being started, or if the session is already closed.
105 */
106 public function save();
107
108 /**
109 * Clear all session data in memory.
110 *
111 * @return void
112 *
113 * @since 3.5
114 */
115 public function clear();
116 }
117