File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1818 */
1919final class Superglobals
2020{
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+
2130 public function server (string $ key ): ?string
2231 {
23- return $ _SERVER [$ key ] ?? null ;
32+ return $ this -> server [$ key ] ?? null ;
2433 }
2534
2635 public function setServer (string $ key , string $ value ): void
2736 {
28- $ _SERVER [$ key ] = $ value ;
37+ $ this ->server [$ key ] = $ value ;
38+ $ _SERVER [$ key ] = $ value ;
39+ }
40+
41+ /**
42+ * @return array|string|null
43+ */
44+ public function get (string $ key )
45+ {
46+ return $ this ->get [$ key ] ?? null ;
2947 }
3048
3149 public function setGetArray (array $ array ): void
3250 {
33- $ _GET = $ array ;
51+ $ this ->get = $ array ;
52+ $ _GET = $ array ;
3453 }
3554}
You can’t perform that action at this time.
0 commit comments