blob: 08046f30bf00123311673874c79a6d783c0f7d0f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
<?php /* Copyright (c) 2024 Freya Murphy */
class Error_model extends Model {
private function get_msg(&$data, int $code)
{
http_response_code($code);
$data['title'] = $code;
$msg = ucfirst(lang('error_' . $code, FALSE));
if (!$msg) {
$error_text = lang('error', NULL);
$msg = $error_text[array_rand($error_text)];
$msg = sprintf($msg, $code);
}
$data['msg'] = $msg;
}
public function get_data(int $code): array
{
$data = parent::get_base_data('error');
$this->get_msg($data, $code);
return $data;
}
}
?>
|