<?php function app() { global $app; return $app; }; function dd($var) { die(var_dump($var)); } function normalize_input_user_name(String $uname) :String { return trim(addslashes(strip_tags($uname))); } function get_create_at_timestamp() :String { return date("Y-m-d H:i:s"); } function error_response(String $class, String $errtext) :Array { return response(false, [ "error" => [ "class" => ucfirst($class), "text" => $errtext ] ]); } function success_response(Array $data) :Array { return response(true, [ "data" => $data ]); } function response(bool $status, Array $body = []) :Array { @header('Content-Type: application/json'); return json_encode([ "status" => $status, "response" => $resp ]); }