1 | <?php |
||
11 | class AuraSession |
||
12 | { |
||
13 | use Utils\StorageTrait; |
||
14 | |||
15 | const KEY = 'AURA_SESSION'; |
||
16 | const STORAGE_KEY = 'AURA_SESSION_STORAGE'; |
||
17 | |||
18 | /** |
||
19 | * @var SessionFactory |
||
20 | */ |
||
21 | private $factory; |
||
22 | |||
23 | /** |
||
24 | * @var string|null The session name |
||
25 | */ |
||
26 | private $name; |
||
27 | |||
28 | /** |
||
29 | * Returns the session instance. |
||
30 | * |
||
31 | * @param ServerRequestInterface $request |
||
32 | * |
||
33 | * @return Session|null |
||
34 | */ |
||
35 | public static function getSession(ServerRequestInterface $request) |
||
39 | |||
40 | /** |
||
41 | * Set the session factory. |
||
42 | * |
||
43 | * @param SessionFactory|null $factory |
||
44 | */ |
||
45 | public function __construct(SessionFactory $factory = null) |
||
49 | |||
50 | /** |
||
51 | * Set the session name. |
||
52 | * |
||
53 | * @param string $name |
||
54 | * |
||
55 | * @return self |
||
56 | */ |
||
57 | public function name($name) |
||
63 | |||
64 | /** |
||
65 | * Execute the middleware. |
||
66 | * |
||
67 | * @param ServerRequestInterface $request |
||
68 | * @param ResponseInterface $response |
||
69 | * @param callable $next |
||
70 | * |
||
71 | * @return ResponseInterface |
||
72 | */ |
||
73 | public function __invoke(ServerRequestInterface $request, ResponseInterface $response, callable $next) |
||
92 | } |
||
93 |