1: <?php
2: /**
3: * @filesource Kotchasan/Http/NotFound.php
4: *
5: * @copyright 2016 Goragod.com
6: * @license http://www.kotchasan.com/license/
7: *
8: * @see http://www.kotchasan.com/
9: */
10:
11: namespace Kotchasan\Http;
12:
13: /**
14: * Response Class.
15: *
16: * @author Goragod Wiriya <admin@goragod.com>
17: *
18: * @since 1.0
19: */
20: class NotFound extends Response
21: {
22: /**
23: * Send HTTP Error 404.
24: *
25: * @param string||null $message ถ้าไม่กำหนดจะใช้ข้อความจากระบบ
26: * @param int $code Error Code (default 404)
27: */
28: public function __construct($message = null, $code = 404)
29: {
30: $message = empty($message) ? '404 Not Found' : $message;
31: parent::__construct($code);
32: $response = $this->withProtocolVersion('1.0');
33: if ($message) {
34: $response->withContent($message);
35: }
36: $response->send();
37: exit;
38: }
39: }
40: