Skip to content

Commit

Permalink
✅ fix: update default values for dataKey and status fields
Browse files Browse the repository at this point in the history
  • Loading branch information
alirezajavadigit committed Nov 7, 2024
1 parent d23787b commit 7f41866
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/System/Traits/HasAttribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
Expand Down Expand Up @@ -83,7 +83,6 @@ trait HasAttribute
public function setMessage(string $message)
{
$this->message = $message;

return $this;
}

Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand All @@ -174,7 +173,6 @@ public function getStatus()
public function setHeaders(array $headers)
{
$this->headers = $headers;

return $this;
}

Expand Down Expand Up @@ -206,7 +204,6 @@ public function getHideStatus(): bool
public function setHideStatus()
{
$this->hideStatus = true;

return $this;
}

Expand All @@ -228,7 +225,6 @@ public function getHideData(): bool
public function setHideData()
{
$this->hideData = true;

return $this;
}

Expand All @@ -250,7 +246,6 @@ public function getHideMessage(): bool
public function setHideMessage()
{
$this->hideMessage = true;

return $this;
}

Expand All @@ -272,7 +267,6 @@ public function getHideSuccess(): bool
public function setHideSuccess()
{
$this->hideSuccess = true;

return $this;
}

Expand Down

0 comments on commit 7f41866

Please sign in to comment.