/** * @return Request */ public static function fromGlobals() { $result = new Request(); $result->setContentType($_SERVER['CONTENT_TYPE']); $result->setGet($_GET); $result->setPost($_POST); $result->setQueryString($_SERVER['QUERY_STRING']); $result->setRequestMethod($_SERVER['REQUEST_METHOD']); return $result; }
public function make() { $request = new Request(); $request->setMethod($_SERVER['REQUEST_METHOD']); $request->setHost($_SERVER['HTTP_HOST']); $request->setPath(substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], '?') ?: strlen($_SERVER['REQUEST_URI']))); $request->setGet($_GET); $request->setPost($_POST); return $request; }