1 | <?php |
||
8 | class SessionAdapter implements AdapterInterface |
||
9 | { |
||
10 | |||
11 | /** |
||
12 | * @var array |
||
13 | */ |
||
14 | protected $session; |
||
15 | |||
16 | public function __construct() |
||
24 | |||
25 | /** |
||
26 | * @inheritdoc |
||
27 | */ |
||
28 | public function set($name, $object) |
||
32 | |||
33 | /** |
||
34 | * @inheritdoc |
||
35 | */ |
||
36 | public function has($name) |
||
40 | |||
41 | /** |
||
42 | * @inheritdoc |
||
43 | */ |
||
44 | public function get($name) |
||
48 | } |
||
49 |
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: