ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
CookieSessionId.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
26
30final readonly class CookieSessionId implements SubmittedSessionId
31{
32 public function __construct(
33 private RequestWrapper $cookies,
34 private Refinery $refinery
35 ) {
36 }
37
38 public function get(): string
39 {
40 return $this->cookies->retrieve(
41 (string) session_name(),
42 $this->refinery->byTrying([
43 $this->refinery->kindlyTo()->string(),
44 $this->refinery->always('')
45 ])
46 );
47 }
48}
Reads the submitted session id from the request cookies.
__construct(private RequestWrapper $cookies, private Refinery $refinery)
Builds data types.
Definition: Factory.php:36
The session id a client sent with the current request.
Interface RequestWrapper.