blob: 905599cf7877e6e293d27c7aefe943b794a46185 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
<?php
namespace Micropoly\Handlers;
class JsonAPIResult
{
public $data;
public int $statuscode = 200;
public function __construct($data, int $statuscode = 200)
{
$this->data = $data;
$this->statuscode = $statuscode;
}
public function send(): void
{
http_response_code($this->statuscode);
header("Content-Type: application/json; charset=UTF-8");
echo json_encode($this->data);
}
}
|