| 1 | <?php |
||
| 7 | class Server implements ServerInterface |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * Retrieves a value defined in the superglobal $_SERVER. |
||
| 11 | * |
||
| 12 | * @param string $value The key's name. |
||
| 13 | * @return string|mixed |
||
| 14 | */ |
||
| 15 | public static function getValue($value, $default = '') |
||
| 23 | |||
| 24 | /** |
||
| 25 | * Retrieves all values defined in the superglobal $_SERVER. |
||
| 26 | * |
||
| 27 | * @param string $value The key's name. |
||
| 28 | * @return string|mixed |
||
| 29 | */ |
||
| 30 | public static function getValues() |
||
| 34 | |||
| 35 | |||
| 36 | public function get() |
||
| 41 | |||
| 42 | public function post() |
||
| 47 | |||
| 48 | public function files() |
||
| 53 | |||
| 54 | public function all() |
||
| 58 | } |
||
| 59 |
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: