1 | <?php |
||
23 | final class DefaultSessionData implements SessionInterface |
||
24 | { |
||
25 | /** |
||
26 | * @var array |
||
27 | */ |
||
28 | private $data; |
||
29 | |||
30 | /** |
||
31 | * @var array |
||
32 | */ |
||
33 | private $originalData; |
||
34 | |||
35 | /** |
||
36 | * Instantiation via __construct is not allowed, use |
||
37 | * - {@see DefaultSessionData::fromDecodedTokenData} |
||
38 | * - {@see DefaultSessionData::fromTokenData} |
||
39 | * - {@see DefaultSessionData::newEmptySession} |
||
40 | * instead |
||
41 | */ |
||
42 | 180 | private function __construct() |
|
45 | |||
46 | 30 | public static function fromDecodedTokenData(\stdClass $data) : self |
|
54 | |||
55 | 67 | public static function fromTokenData(array $data): self |
|
69 | |||
70 | 105 | public static function newEmptySession(): self |
|
78 | |||
79 | /** |
||
80 | * {@inheritDoc} |
||
81 | */ |
||
82 | 122 | public function set(string $key, $value) |
|
86 | |||
87 | /** |
||
88 | * {@inheritDoc} |
||
89 | */ |
||
90 | 90 | public function get(string $key, $default = null) |
|
98 | |||
99 | /** |
||
100 | * {@inheritDoc} |
||
101 | */ |
||
102 | 1 | public function remove(string $key) |
|
106 | |||
107 | /** |
||
108 | * {@inheritDoc} |
||
109 | */ |
||
110 | 4 | public function clear() |
|
114 | |||
115 | /** |
||
116 | * {@inheritDoc} |
||
117 | */ |
||
118 | 91 | public function has(string $key): bool |
|
122 | |||
123 | /** |
||
124 | * {@inheritDoc} |
||
125 | */ |
||
126 | 83 | public function hasChanged() : bool |
|
130 | |||
131 | /** |
||
132 | * {@inheritDoc} |
||
133 | */ |
||
134 | 44 | public function isEmpty() : bool |
|
138 | |||
139 | /** |
||
140 | * {@inheritDoc} |
||
141 | */ |
||
142 | 31 | public function jsonSerialize() |
|
146 | |||
147 | /** |
||
148 | * @param int|bool|string|float|array|object|\JsonSerializable $value |
||
149 | * |
||
150 | * @return int|bool|string|float|array |
||
151 | */ |
||
152 | 167 | private static function convertValueToScalar($value) |
|
156 | } |
||
157 |