From 12070174d856d766dcfdd7cfa8bf8acef15b98f4 Mon Sep 17 00:00:00 2001 From: whwyy Date: Fri, 1 Dec 2023 20:29:26 +0800 Subject: [PATCH] eee --- src/Constrict/ConstrictRequest.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Constrict/ConstrictRequest.php b/src/Constrict/ConstrictRequest.php index 2dedbfb..49e0c7e 100644 --- a/src/Constrict/ConstrictRequest.php +++ b/src/Constrict/ConstrictRequest.php @@ -30,10 +30,10 @@ class ConstrictRequest extends Message implements RequestInterface, ServerReques */ private array|null|object $parsedBody = null; - private array $files = []; - private array $queryParams = []; - + private array $files = []; + private array $queryParams = []; private array $serverParams = []; + private array $_attributes = []; /** @@ -448,7 +448,7 @@ class ConstrictRequest extends Message implements RequestInterface, ServerReques public function getAttributes(): array { // TODO: Implement getAttributes() method. - return []; + return $this->_attributes; } /** @@ -469,7 +469,7 @@ class ConstrictRequest extends Message implements RequestInterface, ServerReques public function getAttribute(string $name, $default = null): mixed { // TODO: Implement getAttribute() method. - return null; + return $this->_attributes[$name] ?? $default; } /** @@ -490,6 +490,7 @@ class ConstrictRequest extends Message implements RequestInterface, ServerReques public function withAttribute(string $name, $value): static { // TODO: Implement withAttribute() method. + $this->_attributes[$name] = $value; return $this; } @@ -510,6 +511,7 @@ class ConstrictRequest extends Message implements RequestInterface, ServerReques public function withoutAttribute(string $name): static { // TODO: Implement withoutAttribute() method. + unset($this->_attributes[$name]); return $this; }