| 1 | <?php declare(strict_types=1); |
||
| 5 | final class Session |
||
| 6 | { |
||
| 7 | /** |
||
| 8 | * @var string |
||
| 9 | */ |
||
| 10 | private $id = ''; |
||
| 11 | |||
| 12 | /** |
||
| 13 | * @var array |
||
| 14 | */ |
||
| 15 | private $contents = []; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * @var SessionIdInterface |
||
| 19 | */ |
||
| 20 | private $sessionId = []; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * @var int |
||
| 24 | */ |
||
| 25 | private $status = \PHP_SESSION_NONE; |
||
| 26 | |||
| 27 | /** |
||
| 28 | * @param string $id |
||
| 29 | * @param array $contents |
||
| 30 | * @param SessionIdInterface $sessionId |
||
| 31 | */ |
||
| 32 | 15 | public function __construct(string $id, array $contents, SessionIdInterface $sessionId) |
|
| 42 | |||
| 43 | /** |
||
| 44 | * @return string |
||
| 45 | */ |
||
| 46 | 14 | public function getId(): string |
|
| 50 | |||
| 51 | /** |
||
| 52 | * @param array $contents |
||
| 53 | */ |
||
| 54 | 4 | public function setContents(array $contents) |
|
| 58 | |||
| 59 | /** |
||
| 60 | * @return array |
||
| 61 | */ |
||
| 62 | 14 | public function getContents(): array |
|
| 66 | |||
| 67 | 2 | public function begin() |
|
| 79 | |||
| 80 | 2 | public function end() |
|
| 89 | |||
| 90 | /** |
||
| 91 | * @return bool |
||
| 92 | */ |
||
| 93 | 5 | public function isActive(): bool |
|
| 97 | |||
| 98 | 1 | public function regenerate() |
|
| 109 | } |
||
| 110 |