| 1 | <?php |
||
| 19 | class GlobalStateProvider implements IGlobalStateProvider |
||
| 20 | { |
||
| 21 | /** |
||
| 22 | * @return array |
||
| 23 | */ |
||
| 24 | public function &getServerSuperGlobal() |
||
| 28 | |||
| 29 | /** |
||
| 30 | * @return array |
||
| 31 | */ |
||
| 32 | public function &getGetSuperGlobal() |
||
| 36 | |||
| 37 | /** |
||
| 38 | * @return array |
||
| 39 | */ |
||
| 40 | public function &getPostSuperGlobal() |
||
| 44 | |||
| 45 | /** |
||
| 46 | * @return array |
||
| 47 | */ |
||
| 48 | public function &getSessionSuperGlobal() |
||
| 52 | } |
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: