$message] + $extra, $status); } public static function noContent(): never { http_response_code(204); header('Cache-Control: no-store'); exit; } /** Decoded JSON request body or an error response when it is not an object. */ public static function body(): array { $raw = file_get_contents('php://input'); if ($raw === false || $raw === '') { self::error('Request body must be JSON', 400); } $data = json_decode($raw, true); if (!is_array($data)) { self::error('Request body must be a JSON object', 400); } return $data; } }