/** * Creates a request with CGI and/or PHP environment data */ public function __construct() { $this->serverParams = $_SERVER; $this->cookieParams = $_COOKIE; $this->queryParams = $_GET; $method = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : null; $this->uri = ServerRequestUri::parse($this)->getUri(); parent::__construct($method, null, ServerHeaders::get($this), $this->getPhpInputStream()); $this->parsedBody = $this->getContentParser()->setContent($this->body)->parse(); $files = ServerFiles::get(); $this->validateUploadedFiles($files); $this->uploadedFiles = $files; }
/** * Initiates server parameters from $_SERVER * * @param ServerRequest $request */ public function __construct(ServerRequest $request) { $this->server = $request->getServerParams(); $this->normalizeServer(); }