Adding request class for testing

This commit is contained in:
Adrian Preuß committed 2019-05-04 22:23:50 +02:00
1 parent 18b3a03dcf
commit fd6b71b459
2 files changed
+20

No files matched your search

+2
View File
@@ -70,6 +70,8 @@
}
private function init() {
Request::init();
$this->hooks = new Hooks();
$this->modules = new Modules($this);
$this->template = new Template($this);
+18
View File
@@ -2,6 +2,24 @@
namespace fruithost;
class Request {
private static $get = [];
public static function init() {
self::$get = $_GET;
}
public static function has($name) {
return in_array($name, self::$get);
}
public static function get($name) {
if(self::has($name)) {
return null;
}
return self::$get[$name];
}
public static function url() {
return $_SERVER['REQUEST_URI'];
}