Repository navigation
Expand file tree
/
Copy pathSessionProxy.php
More file actions
214 lines (172 loc) · 4.55 KB
/
Copy pathSessionProxy.php
File metadata and controls
214 lines (172 loc) · 4.55 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
205
206
207
208
209
210
211
212
213
214
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact [email protected]
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Session;
use Hyperf\Context\Context;
use Hyperf\Contract\SessionInterface;
class SessionProxy extends Session
{
public function __construct()
{
// Do nothing
}
public function flash(string $key, mixed $value = true): void
{
$this->getSession()->flash($key, $value);
}
public function now(string $key, mixed $value): void
{
$this->getSession()->now($key, $value);
}
public function reflash(): void
{
$this->getSession()->reflash();
}
public function keep($keys = null): void
{
$this->getSession()->keep($keys);
}
public function flashInput(array $value): void
{
$this->getSession()->flashInput($value);
}
public function ageFlashData(): void
{
$this->getSession()->ageFlashData();
}
public function isValidId(string $id): bool
{
return $this->getSession()->isValidId($id);
}
public function start(): bool
{
return $this->getSession()->start();
}
public function getId(): string
{
return $this->getSession()->getId();
}
public function setId(string $id): void
{
$this->getSession()->setId($id);
}
public function getName(): string
{
return $this->getSession()->getName();
}
public function setName(string $name): void
{
$this->getSession()->setName($name);
}
public function invalidate(?int $lifetime = null): bool
{
return $this->getSession()->invalidate($lifetime);
}
public function migrate(bool $destroy = false, ?int $lifetime = null): bool
{
return $this->getSession()->migrate($destroy, $lifetime);
}
public function save(): void
{
$this->getSession()->save();
}
public function has(string $name): bool
{
return $this->getSession()->has($name);
}
public function get(string $name, $default = null)
{
return $this->getSession()->get($name, $default);
}
public function set(string $name, $value): void
{
$this->getSession()->set($name, $value);
}
public function put($key, $value = null): void
{
$this->getSession()->put($key, $value);
}
public function all(): array
{
return $this->getSession()->all();
}
public function replace(array $attributes): void
{
$this->getSession()->replace($attributes);
}
public function remove(string $name)
{
return $this->getSession()->remove($name);
}
public function forget($keys): void
{
$this->getSession()->forget($keys);
}
public function clear(): void
{
$this->getSession()->clear();
}
public function isStarted(): bool
{
return $this->getSession()->isStarted();
}
public function token(): string
{
return $this->getSession()->token();
}
public function regenerateToken(): string
{
return $this->getSession()->regenerateToken();
}
public function previousUrl(): ?string
{
return $this->getSession()->previousUrl();
}
public function setPreviousUrl(string $url): void
{
$this->getSession()->setPreviousUrl($url);
}
public function push(string $key, $value): void
{
$this->getSession()->push($key, $value);
}
protected function getSession(): Session
{
return Context::get(SessionInterface::class);
}
protected function mergeNewFlashes(array $keys): void
{
$this->getSession()->mergeNewFlashes($keys);
}
protected function removeFromOldFlashData(array $keys): void
{
$this->getSession()->removeFromOldFlashData($keys);
}
protected function generateSessionId(): string
{
return $this->getSession()->generateSessionId();
}
protected function loadSession(): void
{
$this->getSession()->loadSession();
}
protected function readFromHandler(): array
{
return $this->getSession()->readFromHandler();
}
protected function prepareForUnserialize(string $data): string
{
return $this->getSession()->prepareForUnserialize($data);
}
protected function prepareForStorage(string $data): string
{
return $this->getSession()->prepareForStorage($data);
}
}