1 | <?php |
||
13 | class HttpRequestAdapter extends AbstractHttpAdapter |
||
14 | { |
||
15 | /** |
||
16 | * @var array |
||
17 | */ |
||
18 | protected $serverVars; |
||
19 | |||
20 | /** |
||
21 | * Set up the server vars - they can be overridden if required |
||
22 | */ |
||
23 | public function __construct() |
||
27 | |||
28 | /** |
||
29 | * {@inheritDoc} |
||
30 | */ |
||
31 | public function toPsr7($input) |
||
52 | |||
53 | /** |
||
54 | * {@inheritDoc} |
||
55 | */ |
||
56 | public function fromPsr7($input) |
||
70 | |||
71 | /** |
||
72 | * Get the full request URI (can be empty, but probably won't be) |
||
73 | * |
||
74 | * @param string $path |
||
75 | * @return string |
||
76 | */ |
||
77 | public function getUri($path) |
||
103 | |||
104 | /** |
||
105 | * @return array |
||
106 | */ |
||
107 | public function getServerVars() |
||
111 | |||
112 | /** |
||
113 | * @param array $vars |
||
114 | * @return $this |
||
115 | */ |
||
116 | public function setServerVars(array $vars) |
||
121 | } |
||
122 |
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: