Session.php
3.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
<?php
namespace Illuminate\Contracts\Session;
interface Session
{
/**
* Get the name of the session.
*
* @return string
*/
public function getName();
/**
* Set the name of the session.
*
* @param string $name
* @return void
*/
public function setName($name);
/**
* Get the current session ID.
*
* @return string
*/
public function getId();
/**
* Set the session ID.
*
* @param string $id
* @return void
*/
public function setId($id);
/**
* Start the session, reading the data from a handler.
*
* @return bool
*/
public function start();
/**
* Save the session data to storage.
*
* @return void
*/
public function save();
/**
* Get all of the session data.
*
* @return array
*/
public function all();
/**
* Checks if a key exists.
*
* @param string|array $key
* @return bool
*/
public function exists($key);
/**
* Checks if a key is present and not null.
*
* @param string|array $key
* @return bool
*/
public function has($key);
/**
* Get an item from the session.
*
* @param string $key
* @param mixed $default
* @return mixed
*/
public function get($key, $default = null);
/**
* Get the value of a given key and then forget it.
*
* @param string $key
* @param mixed $default
* @return mixed
*/
public function pull($key, $default = null);
/**
* Put a key / value pair or array of key / value pairs in the session.
*
* @param string|array $key
* @param mixed $value
* @return void
*/
public function put($key, $value = null);
/**
* Get the CSRF token value.
*
* @return string
*/
public function token();
/**
* Regenerate the CSRF token value.
*
* @return void
*/
public function regenerateToken();
/**
* Remove an item from the session, returning its value.
*
* @param string $key
* @return mixed
*/
public function remove($key);
/**
* Remove one or many items from the session.
*
* @param string|array $keys
* @return void
*/
public function forget($keys);
/**
* Remove all of the items from the session.
*
* @return void
*/
public function flush();
/**
* Flush the session data and regenerate the ID.
*
* @return bool
*/
public function invalidate();
/**
* Generate a new session identifier.
*
* @param bool $destroy
* @return bool
*/
public function regenerate($destroy = false);
/**
* Generate a new session ID for the session.
*
* @param bool $destroy
* @return bool
*/
public function migrate($destroy = false);
/**
* Determine if the session has been started.
*
* @return bool
*/
public function isStarted();
/**
* Get the previous URL from the session.
*
* @return string|null
*/
public function previousUrl();
/**
* Set the "previous" URL in the session.
*
* @param string $url
* @return void
*/
public function setPreviousUrl($url);
/**
* Get the session handler instance.
*
* @return \SessionHandlerInterface
*/
public function getHandler();
/**
* Determine if the session handler needs a request.
*
* @return bool
*/
public function handlerNeedsRequest();
/**
* Set the request on the handler instance.
*
* @param \Illuminate\Http\Request $request
* @return void
*/
public function setRequestOnHandler($request);
}