refactor: code style changes

Signed-off-by: miguel456 <me@nogueira.codes>
This commit is contained in:
2023-01-15 00:04:00 +00:00
parent 25155bff2e
commit 3727c84f3e
146 changed files with 1013 additions and 1341 deletions

View File

@@ -1,32 +1,41 @@
<?php
namespace App\Helpers;
/**
* Class JSON - Used for JSON responses.
* @package App\Helpers
*/
class JSON
{
protected $type;
protected $type, $status, $message, $code, $data, $additional;
protected $status;
protected $message;
protected $code;
protected $data;
protected $additional;
/**
* @param mixed $type
* @param mixed $type
*/
public function setResponseType($type): JSON
{
$this->type = $type;
return $this;
}
/**
* @param mixed $additional
* @param mixed $additional
*/
public function setAdditional($additional)
{
$this->additional = $additional;
return $this;
}
@@ -55,12 +64,13 @@ class JSON
}
/**
* @param mixed $status
* @param mixed $status
* @return JSON
*/
public function setStatus($status)
{
$this->status = $status;
return $this;
}
@@ -73,12 +83,13 @@ class JSON
}
/**
* @param mixed $message
* @param mixed $message
* @return JSON
*/
public function setMessage($message)
{
$this->message = $message;
return $this;
}
@@ -91,12 +102,13 @@ class JSON
}
/**
* @param mixed $code
* @param mixed $code
* @return JSON
*/
public function setCode($code)
{
$this->code = $code;
return $this;
}
@@ -109,12 +121,13 @@ class JSON
}
/**
* @param mixed $data
* @param mixed $data
* @return JSON
*/
public function setData($data)
{
$this->data = $data;
return $this;
}
@@ -126,17 +139,15 @@ class JSON
'meta' => [
'status' => $this->getStatus(),
'message' => $this->getMessage(),
]
],
];
if (!empty($this->additional))
{
foreach($this->additional as $additionalKeyName => $key)
{
if (! empty($this->additional)) {
foreach ($this->additional as $additionalKeyName => $key) {
$response[$additionalKeyName] = $key;
}
}
return response($response, $this->getCode(), $headers);
}
}