36
36
*
37
37
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
38
38
* @author Tobias Schultze <http://tobion.de>
39
- *
40
- * @internal
41
39
*/
42
40
abstract class AbstractSessionListener implements EventSubscriberInterface, ResetInterface
43
41
{
44
42
public const NO_AUTO_CACHE_CONTROL_HEADER = 'Symfony-Session-NoAutoCacheControl ' ;
45
43
44
+
45
+ /**
46
+ * @internal
47
+ */
46
48
protected $ container ;
47
49
private $ sessionUsageStack = [];
48
50
private $ debug ;
@@ -52,13 +54,19 @@ abstract class AbstractSessionListener implements EventSubscriberInterface, Rese
52
54
*/
53
55
private $ sessionOptions ;
54
56
57
+ /**
58
+ * @internal
59
+ */
55
60
public function __construct (ContainerInterface $ container = null , bool $ debug = false , array $ sessionOptions = [])
56
61
{
57
62
$ this ->container = $ container ;
58
63
$ this ->debug = $ debug ;
59
64
$ this ->sessionOptions = $ sessionOptions ;
60
65
}
61
66
67
+ /**
68
+ * @internal
69
+ */
62
70
public function onKernelRequest (RequestEvent $ event )
63
71
{
64
72
if (!$ event ->isMainRequest ()) {
@@ -94,6 +102,9 @@ public function onKernelRequest(RequestEvent $event)
94
102
$ this ->sessionUsageStack [] = $ session instanceof Session ? $ session ->getUsageIndex () : 0 ;
95
103
}
96
104
105
+ /**
106
+ * @internal
107
+ */
97
108
public function onKernelResponse (ResponseEvent $ event )
98
109
{
99
110
if (!$ event ->isMainRequest () || (!$ this ->container ->has ('initialized_session ' ) && !$ event ->getRequest ()->hasSession ())) {
@@ -222,13 +233,19 @@ public function onKernelResponse(ResponseEvent $event)
222
233
}
223
234
}
224
235
236
+ /**
237
+ * @internal
238
+ */
225
239
public function onFinishRequest (FinishRequestEvent $ event )
226
240
{
227
241
if ($ event ->isMainRequest ()) {
228
242
array_pop ($ this ->sessionUsageStack );
229
243
}
230
244
}
231
245
246
+ /**
247
+ * @internal
248
+ */
232
249
public function onSessionUsage (): void
233
250
{
234
251
if (!$ this ->debug ) {
@@ -264,6 +281,9 @@ public function onSessionUsage(): void
264
281
throw new UnexpectedSessionUsageException ('Session was used while the request was declared stateless. ' );
265
282
}
266
283
284
+ /**
285
+ * @internal
286
+ */
267
287
public static function getSubscribedEvents (): array
268
288
{
269
289
return [
@@ -274,6 +294,9 @@ public static function getSubscribedEvents(): array
274
294
];
275
295
}
276
296
297
+ /**
298
+ * @internal
299
+ */
277
300
public function reset (): void
278
301
{
279
302
if (\PHP_SESSION_ACTIVE === session_status ()) {
@@ -291,6 +314,8 @@ public function reset(): void
291
314
/**
292
315
* Gets the session object.
293
316
*
317
+ * @internal
318
+ *
294
319
* @return SessionInterface|null
295
320
*/
296
321
abstract protected function getSession ();
0 commit comments