mutateRequest(); } } public function getJSONRequest() { return json_decode(file_get_contents('php://input'), true); } public function mutateRequest() { if(Request::$contentType == "application/json") { Request::$data = $this->getJSONRequest(); } else { if(Request::$method == "post") { Request::$data = $_POST; } Request::$query = $_GET; }; } public function contentType() { return Request::$contentType; } public function method() { return Request::$method; } public function get($name) { return Request::$query[$name] ?? null; } public function has($name) { return $this->input($name) !== null; } public function post($name) { return Request::$data[$name] ?? null; } public function input($name) { return Request::staticGet($name) ?? Request::staticPost($name) ?? null; } public function staticContentType() { return $this->contentType(); } public function staticMethod() { return $this->method(); } public function staticGet($name) { return $this->get($name); } public function staticHeaders() { return Request::$headers; } public function staticFile() { return Request::$file; } public function staticSession() { return Request::$session; } public function staticCookie() { return Request::$cookie; } public function staticPost($name) { return $this->post($name); } public function staticInput($name) { return $this->input($name); } public function staticHas($name) { return $this->has($name); } public function getAttribute($name) { return $this->input($name); } }; define("request", new Request(), false);