@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | * @var bool |
| 29 | 29 | */ |
| 30 | 30 | protected $json; |
| 31 | - function __construct($data=null, int $code=null) |
|
| 31 | + function __construct($data = null, int $code = null) |
|
| 32 | 32 | { |
| 33 | 33 | $this->data = $data; |
| 34 | 34 | $this->code = $code; |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | * [send description] |
| 61 | 61 | * @date 2019-11-09 |
| 62 | 62 | */ |
| 63 | - public function send(bool $exit=true):void |
|
| 63 | + public function send(bool $exit = true):void |
|
| 64 | 64 | { |
| 65 | 65 | http_response_code($this->code ?? 200); |
| 66 | 66 | |
@@ -64,11 +64,17 @@ |
||
| 64 | 64 | { |
| 65 | 65 | http_response_code($this->code ?? 200); |
| 66 | 66 | |
| 67 | - if ($this->json) header('Content-Type: application/json'); |
|
| 67 | + if ($this->json) { |
|
| 68 | + header('Content-Type: application/json'); |
|
| 69 | + } |
|
| 68 | 70 | |
| 69 | - if ($data != null) echo !$this->json ? $this->data : json_encode($this->data); |
|
| 71 | + if ($data != null) { |
|
| 72 | + echo !$this->json ? $this->data : json_encode($this->data); |
|
| 73 | + } |
|
| 70 | 74 | |
| 71 | - if ($exit) exit(EXIT_SUCCESS); |
|
| 75 | + if ($exit) { |
|
| 76 | + exit(EXIT_SUCCESS); |
|
| 77 | + } |
|
| 72 | 78 | } |
| 73 | 79 | } |
| 74 | 80 | ?> |
@@ -2,7 +2,7 @@ |
||
| 2 | 2 | declare(strict_types=1); |
| 3 | 3 | |
| 4 | 4 | if (!function_exists('response')) { |
| 5 | - function response($data=null, int $code=null):RESTResponse |
|
| 5 | + function response($data = null, int $code = null):RESTResponse |
|
| 6 | 6 | { |
| 7 | 7 | return new RESTResponse($data, $code); |
| 8 | 8 | } |