server = $server; $this->uri = $uri; $this->queryParams = $queryParams; $this->postParams = $postParams; $this->method = $method; $this->body = $body; $this->header = $header; } public function getServer() :array { return $this->server; } public function setServer(array $server): void { $this->server = $server; } public function getUri (): string { return $this->uri; } public function setUri($uri):void { $this->uri = $uri; } public function getQueryParams() { return $this->queryParams; } public function setQueryParams($queryParams): void { $this->queryParams = $queryParams; } public function getPostParams() { return $this->postParams; } public function setPostParams($postParams): void { $this->postParams = $postParams; } public function getMethod () { return $this->method; } public function setMethod ($method):void { $this->method = $method; } public function getHeader () { return $this->header; } public function setHeader ($header): void { $this->header = $header; } public function getBody () { return $this->body; } public function setBody ($body):void { $this->body = $body; } public function getSwooleRequest () { return $this->swooleRequest; } public function setSwooleRequesty ($swooleRequest):void { $this->swooleRequest = $swooleRequest; } public static function init (\Swoole\Http\Request $swooleRequest) { $server = $swooleRequest->server; $method = $server['request_method'] ?? 'GET'; $uri = $server['request_uri']; $body = $swooleRequest->rawContent(); $request = new self($server,$uri,$swooleRequest->get,$swooleRequest->post,$method,$swooleRequest->header,$body); $request->swooleRequest = $swooleRequest; return $request; } }