Newer
Older
flow-task / server / libs / utils.php
@eugene-sukhodolskiy eugene-sukhodolskiy 20 days ago 589 bytes Init
<?php

function response_prepared($data) {
	$response = [
		"response" => $data
	];

	@header('Content-Type: application/json');

	return json_encode($response);
}

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(String $class, String $errtext): Array {
	return [
		"error" => [
			"class" => ucfirst($class),
			"text" => $errtext
		]
	];
}