| 1 | <?php |
||
| 18 | class Session implements SessionInterface |
||
| 19 | { |
||
| 20 | /** |
||
| 21 | * |
||
| 22 | * A copy of the $_COOKIE array. |
||
| 23 | * |
||
| 24 | * @var array |
||
| 25 | * |
||
| 26 | */ |
||
| 27 | protected $cookie; |
||
| 28 | |||
| 29 | /** |
||
| 30 | * |
||
| 31 | * Constructor. |
||
| 32 | * |
||
| 33 | * @param array $cookie A copy of the $_COOKIE array. |
||
| 34 | * |
||
| 35 | */ |
||
| 36 | 22 | public function __construct(array $cookie) |
|
| 40 | |||
| 41 | /** |
||
| 42 | * |
||
| 43 | * Starts a session. |
||
| 44 | * |
||
| 45 | * @return bool |
||
| 46 | * |
||
| 47 | */ |
||
| 48 | 3 | public function start() |
|
| 52 | |||
| 53 | /** |
||
| 54 | * |
||
| 55 | * Resumes a previously-started session. |
||
| 56 | * |
||
| 57 | * @return bool |
||
| 58 | * |
||
| 59 | */ |
||
| 60 | 2 | public function resume() |
|
| 61 | { |
||
| 62 | 2 | if (session_id() !== '') { |
|
| 63 | 1 | return true; |
|
| 64 | } |
||
| 65 | |||
| 66 | 2 | if (isset($this->cookie[session_name()])) { |
|
| 67 | 1 | return $this->start(); |
|
| 68 | } |
||
| 69 | |||
| 70 | 1 | return false; |
|
| 71 | } |
||
| 72 | |||
| 73 | /** |
||
| 74 | * |
||
| 75 | * Regenerates a session ID. |
||
| 76 | * |
||
| 77 | * @return mixed |
||
| 78 | * |
||
| 79 | */ |
||
| 80 | 1 | public function regenerateId() |
|
| 84 | } |
||
| 85 |