Commit
This commit is contained in:
parent
0e202e9b96
commit
30c82d69c0
@ -23,9 +23,10 @@ function config(string $key): bool|string|int|float {
|
|||||||
}
|
}
|
||||||
foreach (require $config_override_path as $override_key => $override_value) {
|
foreach (require $config_override_path as $override_key => $override_value) {
|
||||||
if (!array_key_exists($override_key, $config)) {
|
if (!array_key_exists($override_key, $config)) {
|
||||||
throw new Exception('Undefined key in config override file');
|
trigger_error('Undefined key in config file', E_USER_ERROR);
|
||||||
}
|
}
|
||||||
if (gettype($override_value) !== gettype($config[$override_key])) {
|
if (gettype($override_value) !== gettype($config[$override_key])) {
|
||||||
|
trigger_error('Type mismatch in config file', E_USER_ERROR);
|
||||||
throw new Exception('Type mismatch in config override file');
|
throw new Exception('Type mismatch in config override file');
|
||||||
}
|
}
|
||||||
$config[$override_key] = $override_value;
|
$config[$override_key] = $override_value;
|
||||||
@ -56,7 +57,7 @@ function json_response(mixed $data, int $status_code = 200)
|
|||||||
/**
|
/**
|
||||||
* Helper for reading and decoding JSON from request body
|
* Helper for reading and decoding JSON from request body
|
||||||
*/
|
*/
|
||||||
function json_decode_input(): array
|
function json_decode_input(): array|bool|null
|
||||||
{
|
{
|
||||||
return json_decode(file_get_contents('php://input'), true);
|
return json_decode(file_get_contents('php://input'), true);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user