1 | <?php |
||
11 | class StorableSession implements StorableSessionInterface |
||
12 | { |
||
13 | /** @var SessionIdInterface */ |
||
14 | private $id; |
||
15 | /** @var SessionInterface */ |
||
16 | private $wrappedSession; |
||
17 | /** @var \PSR7Sessions\Storage\Adapter\StorageInterface */ |
||
18 | private $storage; |
||
19 | |||
20 | public static function create(StorageInterface $storage):StorableSession |
||
24 | |||
25 | /** |
||
26 | * @internal Should only be called by a storage |
||
27 | */ |
||
28 | public static function fromId( |
||
38 | |||
39 | public function __construct(SessionInterface $wrappedSession, StorageInterface $storage) |
||
45 | |||
46 | public function getId() : SessionIdInterface |
||
50 | |||
51 | public function set(string $key, $value) |
||
56 | |||
57 | public function get(string $key, $default = null) |
||
61 | |||
62 | public function remove(string $key) |
||
67 | |||
68 | public function clear() |
||
73 | |||
74 | public function has(string $key) : bool |
||
78 | |||
79 | public function hasChanged() : bool |
||
83 | |||
84 | public function isEmpty() : bool |
||
88 | |||
89 | public function jsonSerialize() |
||
93 | |||
94 | private function save() |
||
98 | } |
||
99 |