Initial commit: sync from server - all domains and code
This commit is contained in:
22
www/fahrschultermin.de/app/Support/Response.php
Normal file
22
www/fahrschultermin.de/app/Support/Response.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Support;
|
||||
|
||||
final class Response
|
||||
{
|
||||
public static function json(array $data, int $status = 200): never
|
||||
{
|
||||
http_response_code($status);
|
||||
header('Content-Type: application/json; charset=utf-8');
|
||||
echo json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function noContent(): never
|
||||
{
|
||||
http_response_code(204);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user