From 7f418669a5e11ef1afcc13d9e8bffea6f3c6eac8 Mon Sep 17 00:00:00 2001 From: alirezajavadigit Date: Fri, 8 Nov 2024 03:29:14 +0330 Subject: [PATCH] :white_check_mark: fix: update default values for dataKey and status fields --- src/System/Traits/HasAttribute.php | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/System/Traits/HasAttribute.php b/src/System/Traits/HasAttribute.php index 625d34d..dc7e6ef 100644 --- a/src/System/Traits/HasAttribute.php +++ b/src/System/Traits/HasAttribute.php @@ -37,7 +37,7 @@ trait HasAttribute /** * @var string|null $dataKey Stores the key for the data payload in the response. */ - private ?string $dataKey = null; + private ?string $dataKey = "data"; /** * @var mixed|null $data Stores the data payload to be included in the response. @@ -47,7 +47,7 @@ trait HasAttribute /** * @var array $status Stores the HTTP status code and message for the response. */ - private $status = [200, '']; + private $status = [200, 'Ok']; /** * @var array $headers Stores the custom headers to be included in the response. @@ -83,7 +83,6 @@ trait HasAttribute public function setMessage(string $message) { $this->message = $message; - return $this; } @@ -126,7 +125,7 @@ public function setData(mixed $data, string $key = "data") * * @return mixed The data payload included in the response. */ - public function getData() + public function getData(): mixed { return $this->data; } @@ -160,7 +159,7 @@ public function setStatus(int $status, string $message = "") * * @return int The HTTP status code and message for the response. */ - public function getStatus() + public function getStatus(): array { return $this->status; } @@ -174,7 +173,6 @@ public function getStatus() public function setHeaders(array $headers) { $this->headers = $headers; - return $this; } @@ -206,7 +204,6 @@ public function getHideStatus(): bool public function setHideStatus() { $this->hideStatus = true; - return $this; } @@ -228,7 +225,6 @@ public function getHideData(): bool public function setHideData() { $this->hideData = true; - return $this; } @@ -250,7 +246,6 @@ public function getHideMessage(): bool public function setHideMessage() { $this->hideMessage = true; - return $this; } @@ -272,7 +267,6 @@ public function getHideSuccess(): bool public function setHideSuccess() { $this->hideSuccess = true; - return $this; }