| @@ 34-42 (lines=9) @@ | ||
| 31 | /** |
|
| 32 | * @param string $key |
|
| 33 | */ |
|
| 34 | public function get($key) |
|
| 35 | { |
|
| 36 | $this->startSession(); |
|
| 37 | if (!array_key_exists($key, $_SESSION)) { |
|
| 38 | throw new SessionException(sprintf('key "%s" not found in session', $key)); |
|
| 39 | } |
|
| 40 | ||
| 41 | return $_SESSION[$key]; |
|
| 42 | } |
|
| 43 | ||
| 44 | /** |
|
| 45 | * @param string $key |
|
| @@ 59-66 (lines=8) @@ | ||
| 56 | /** |
|
| 57 | * @param string $key |
|
| 58 | */ |
|
| 59 | public function del($key) |
|
| 60 | { |
|
| 61 | $this->startSession(); |
|
| 62 | if (!array_key_exists($key, $_SESSION)) { |
|
| 63 | throw new SessionException(sprintf('key "%s" not found in session', $key)); |
|
| 64 | } |
|
| 65 | unset($_SESSION[$key]); |
|
| 66 | } |
|
| 67 | ||
| 68 | private function startSession() |
|
| 69 | { |
|