We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b2e8c02 commit 239b2ccCopy full SHA for 239b2cc
system/Superglobals.php
@@ -18,18 +18,29 @@
18
*/
19
final class Superglobals
20
{
21
+ private array $server;
22
+ private array $get;
23
+
24
+ public function __construct(?array $server = null, ?array $get = null)
25
+ {
26
+ $this->server = $server ?? $_SERVER;
27
+ $this->get = $get ?? $_GET;
28
+ }
29
30
public function server(string $key): ?string
31
- return $_SERVER[$key] ?? null;
32
+ return $this->server[$key] ?? null;
33
}
34
35
public function setServer(string $key, string $value): void
36
- $_SERVER[$key] = $value;
37
+ $this->server[$key] = $value;
38
+ $_SERVER[$key] = $value;
39
40
41
public function setGetArray(array $array): void
42
- $_GET = $array;
43
+ $this->get = $array;
44
+ $_GET = $array;
45
46
0 commit comments