From 9915452311d26224a63c5ce024246a0ca890b51b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Thu, 9 Sep 2021 19:23:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- http-server/Constrict/ServerRequest.php | 127 ++++++++++++++++++++++++ http-server/Constrict/TRequest.php | 82 +++++++++++++++ 2 files changed, 209 insertions(+) create mode 100644 http-server/Constrict/ServerRequest.php create mode 100644 http-server/Constrict/TRequest.php diff --git a/http-server/Constrict/ServerRequest.php b/http-server/Constrict/ServerRequest.php new file mode 100644 index 00000000..033034e1 --- /dev/null +++ b/http-server/Constrict/ServerRequest.php @@ -0,0 +1,127 @@ +cookies; + } + + + /** + * @param array $cookies + * @return $this|ServerRequest + */ + public function withCookieParams(array $cookies): ServerRequestInterface + { + $this->cookies = $cookies; + return $this; + } + + + /** + * @return array + */ + public function getQueryParams(): array + { + return []; + } + + public function withQueryParams(array $query): ServerRequestInterface + { + return $this; + } + + public function getUploadedFiles() + { + // TODO: Implement getUploadedFiles() method. + } + + public function withUploadedFiles(array $uploadedFiles): ServerRequestInterface + { + return $this; + } + + + /** + * @return array|object|null + */ + public function getParsedBody(): object|array|null + { + return null; + } + + + /** + * @param array|object|null $data + * @return ServerRequestInterface + */ + public function withParsedBody($data): ServerRequestInterface + { + return $this; + } + + + /** + * @return array + */ + public function getAttributes(): array + { + return []; + } + + + /** + * @param string $name + * @param null $default + * @return mixed|null + */ + public function getAttribute($name, $default = null) + { + return $default; + } + + + /** + * @param string $name + * @param mixed $value + * @return ServerRequestInterface + */ + public function withAttribute($name, $value): ServerRequestInterface + { + return $this; + } + + + /** + * @param string $name + * @return ServerRequestInterface + */ + public function withoutAttribute($name): ServerRequestInterface + { + // TODO: Implement withoutAttribute() method. + return $this; + } +} diff --git a/http-server/Constrict/TRequest.php b/http-server/Constrict/TRequest.php new file mode 100644 index 00000000..b78fc48a --- /dev/null +++ b/http-server/Constrict/TRequest.php @@ -0,0 +1,82 @@ +method; + } + + + /** + * @param string $method + * @return RequestInterface + */ + public function withMethod($method): RequestInterface + { + // TODO: Implement withMethod() method. + $this->method = $method; + return $this; + } + + + /** + * @return UriInterface + */ + public function getUri(): UriInterface + { + // TODO: Implement getUri() method. + return $this->uri; + } + + + /** + * @param UriInterface $uri + * @param false $preserveHost + * @return $this|TRequest + */ + public function withUri(UriInterface $uri, $preserveHost = false): RequestInterface + { + $this->uri = $uri; + return $this; + } +}