public function returnResponse($response, $httpcode = 200, $aditionnalheaders = array())
{
if (empty($httpcode)) {
$httpcode = 200;
}
foreach ($aditionnalheaders as $key => $value) {
header("{$key}: {$value}");
}
http_response_code($httpcode);
self::header($this->debug);
if ($response !== null) {
$json = json_encode($response, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_NUMERIC_CHECK | ($this->debug ? JSON_PRETTY_PRINT : 0));
} else {
$json = '';
}
if ($this->debug) {
echo "<pre>";
var_dump($response);
echo "</pre>";
} else {
echo $json;
}
exit;
}