summaryrefslogtreecommitdiff
path: root/src/web/_model/error.php
blob: 11b56f944474039e2441433e4c3e5b6b8d3e0b50 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?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) {
			$msg = ucfirst(lang('error'));
		}
		$data['msg'] = $msg;

	}

	public function get_data(int $code): array
	{
		$data = parent::get_base_data('error');
		$this->get_msg($data, $code);
		return $data;
	}
}
?>