header('Content-Type: application/json; charset=utf-8'); echo json_encode($value, $options, $dept); exit(0); } SimpleRouter::response()->json($value, $options, $dept); } /** * Create API error response * * @param string $value Body of error * @param int $code HTTP code of error */ public static function apiError(string $value, int $code): void { Response::response()->header('Content-Type: application/json; charset=utf-8')->httpCode($code); echo $value; exit(0); } /** * Create redirect response * * @param string $url New target * @param ?int $code HTTP code */ public static function redirect(string $url, ?int $code = null): void { if ($code !== null) { Response::response()->httpCode($code); } Response::response()->redirect($url); } }