comparison vendor/symfony/http-foundation/Session/SessionInterface.php @ 0:4c8ae668cc8c

Initial import (non-working)
author Chris Cannam
date Wed, 29 Nov 2017 16:09:58 +0000
parents
children 1fec387a4317
comparison
equal deleted inserted replaced
-1:000000000000 0:4c8ae668cc8c
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 namespace Symfony\Component\HttpFoundation\Session;
13
14 use Symfony\Component\HttpFoundation\Session\Storage\MetadataBag;
15
16 /**
17 * Interface for the session.
18 *
19 * @author Drak <drak@zikula.org>
20 */
21 interface SessionInterface
22 {
23 /**
24 * Starts the session storage.
25 *
26 * @return bool True if session started
27 *
28 * @throws \RuntimeException If session fails to start.
29 */
30 public function start();
31
32 /**
33 * Returns the session ID.
34 *
35 * @return string The session ID
36 */
37 public function getId();
38
39 /**
40 * Sets the session ID.
41 *
42 * @param string $id
43 */
44 public function setId($id);
45
46 /**
47 * Returns the session name.
48 *
49 * @return mixed The session name
50 */
51 public function getName();
52
53 /**
54 * Sets the session name.
55 *
56 * @param string $name
57 */
58 public function setName($name);
59
60 /**
61 * Invalidates the current session.
62 *
63 * Clears all session attributes and flashes and regenerates the
64 * session and deletes the old session from persistence.
65 *
66 * @param int $lifetime Sets the cookie lifetime for the session cookie. A null value
67 * will leave the system settings unchanged, 0 sets the cookie
68 * to expire with browser session. Time is in seconds, and is
69 * not a Unix timestamp.
70 *
71 * @return bool True if session invalidated, false if error
72 */
73 public function invalidate($lifetime = null);
74
75 /**
76 * Migrates the current session to a new session id while maintaining all
77 * session attributes.
78 *
79 * @param bool $destroy Whether to delete the old session or leave it to garbage collection
80 * @param int $lifetime Sets the cookie lifetime for the session cookie. A null value
81 * will leave the system settings unchanged, 0 sets the cookie
82 * to expire with browser session. Time is in seconds, and is
83 * not a Unix timestamp.
84 *
85 * @return bool True if session migrated, false if error
86 */
87 public function migrate($destroy = false, $lifetime = null);
88
89 /**
90 * Force the session to be saved and closed.
91 *
92 * This method is generally not required for real sessions as
93 * the session will be automatically saved at the end of
94 * code execution.
95 */
96 public function save();
97
98 /**
99 * Checks if an attribute is defined.
100 *
101 * @param string $name The attribute name
102 *
103 * @return bool true if the attribute is defined, false otherwise
104 */
105 public function has($name);
106
107 /**
108 * Returns an attribute.
109 *
110 * @param string $name The attribute name
111 * @param mixed $default The default value if not found
112 *
113 * @return mixed
114 */
115 public function get($name, $default = null);
116
117 /**
118 * Sets an attribute.
119 *
120 * @param string $name
121 * @param mixed $value
122 */
123 public function set($name, $value);
124
125 /**
126 * Returns attributes.
127 *
128 * @return array Attributes
129 */
130 public function all();
131
132 /**
133 * Sets attributes.
134 *
135 * @param array $attributes Attributes
136 */
137 public function replace(array $attributes);
138
139 /**
140 * Removes an attribute.
141 *
142 * @param string $name
143 *
144 * @return mixed The removed value or null when it does not exist
145 */
146 public function remove($name);
147
148 /**
149 * Clears all attributes.
150 */
151 public function clear();
152
153 /**
154 * Checks if the session was started.
155 *
156 * @return bool
157 */
158 public function isStarted();
159
160 /**
161 * Registers a SessionBagInterface with the session.
162 *
163 * @param SessionBagInterface $bag
164 */
165 public function registerBag(SessionBagInterface $bag);
166
167 /**
168 * Gets a bag instance by name.
169 *
170 * @param string $name
171 *
172 * @return SessionBagInterface
173 */
174 public function getBag($name);
175
176 /**
177 * Gets session meta.
178 *
179 * @return MetadataBag
180 */
181 public function getMetadataBag();
182 }