| 1 | <?php |
||
| 7 | class NativeSession implements SessionInterface |
||
| 8 | { |
||
| 9 | use ArrayProxyTrait; |
||
| 10 | |||
| 11 | /** |
||
| 12 | * @inheritDoc |
||
| 13 | */ |
||
| 14 | 5 | public function has($key) |
|
| 18 | |||
| 19 | /** |
||
| 20 | * @inheritDoc |
||
| 21 | */ |
||
| 22 | 3 | public function get($key, $default = null) |
|
| 26 | |||
| 27 | /** |
||
| 28 | * @inheritDoc |
||
| 29 | */ |
||
| 30 | 5 | public function set($key, $value) |
|
| 34 | |||
| 35 | /** |
||
| 36 | * @inheritDoc |
||
| 37 | */ |
||
| 38 | 2 | public function del($key) |
|
| 42 | |||
| 43 | /** |
||
| 44 | * @inheritDoc |
||
| 45 | */ |
||
| 46 | 5 | public function clear() |
|
| 50 | } |
||
| 51 |
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: