1
|
|
|
<?php |
2
|
|
|
namespace Phrest\Http; |
3
|
|
|
|
4
|
|
|
class StatusCodes |
5
|
|
|
{ |
6
|
|
|
const CONTINUE = 100; |
7
|
|
|
const SWITCHING_PROTOCOLS = 101; |
8
|
|
|
const OK = 200; |
9
|
|
|
const CREATED = 201; |
10
|
|
|
const ACCEPTED = 202; |
11
|
|
|
const NONAUTHORITATIVE_INFORMATION = 203; |
12
|
|
|
const NO_CONTENT = 204; |
13
|
|
|
const RESET_CONTENT = 205; |
14
|
|
|
const PARTIAL_CONTENT = 206; |
15
|
|
|
const MULTIPLE_CHOICES = 300; |
16
|
|
|
const MOVED_PERMANENTLY = 301; |
17
|
|
|
const FOUND = 302; |
18
|
|
|
const SEE_OTHER = 303; |
19
|
|
|
const NOT_MODIFIED = 304; |
20
|
|
|
const USE_PROXY = 305; |
21
|
|
|
const UNUSED= 306; |
22
|
|
|
const TEMPORARY_REDIRECT = 307; |
23
|
|
|
const BAD_REQUEST = 400; |
24
|
|
|
const UNAUTHORIZED = 401; |
25
|
|
|
const PAYMENT_REQUIRED = 402; |
26
|
|
|
const FORBIDDEN = 403; |
27
|
|
|
const NOT_FOUND = 404; |
28
|
|
|
const METHOD_NOT_ALLOWED = 405; |
29
|
|
|
const NOT_ACCEPTABLE = 406; |
30
|
|
|
const PROXY_AUTHENTICATION_REQUIRED = 407; |
31
|
|
|
const REQUEST_TIMEOUT = 408; |
32
|
|
|
const CONFLICT = 409; |
33
|
|
|
const GONE = 410; |
34
|
|
|
const LENGTH_REQUIRED = 411; |
35
|
|
|
const PRECONDITION_FAILED = 412; |
36
|
|
|
const REQUEST_ENTITY_TOO_LARGE = 413; |
37
|
|
|
const REQUEST_URI_TOO_LONG = 414; |
38
|
|
|
const UNSUPPORTED_MEDIA_TYPE = 415; |
39
|
|
|
const REQUESTED_RANGE_NOT_SATISFIABLE = 416; |
40
|
|
|
const EXPECTATION_FAILED = 417; |
41
|
|
|
const INTERNAL_SERVER_ERROR = 500; |
42
|
|
|
const NOT_IMPLEMENTED = 501; |
43
|
|
|
const BAD_GATEWAY = 502; |
44
|
|
|
const SERVICE_UNAVAILABLE = 503; |
45
|
|
|
const GATEWAY_TIMEOUT = 504; |
46
|
|
|
const VERSION_NOT_SUPPORTED = 505; |
47
|
|
|
|
48
|
|
|
private static $messages = array( |
49
|
|
|
100 => 'Continue', |
50
|
|
|
101 => 'Switching Protocols', |
51
|
|
|
200 => 'OK', |
52
|
|
|
201 => 'Created', |
53
|
|
|
202 => 'Accepted', |
54
|
|
|
203 => 'Non-Authoritative Information', |
55
|
|
|
204 => 'No Content', |
56
|
|
|
205 => 'Reset Content', |
57
|
|
|
206 => 'Partial Content', |
58
|
|
|
300 => 'Multiple Choices', |
59
|
|
|
301 => 'Moved Permanently', |
60
|
|
|
302 => 'Found', |
61
|
|
|
303 => 'See Other', |
62
|
|
|
304 => 'Not Modified', |
63
|
|
|
305 => 'Use Proxy', |
64
|
|
|
306 => '(Unused)', |
65
|
|
|
307 => 'Temporary Redirect', |
66
|
|
|
400 => 'Bad Request', |
67
|
|
|
401 => 'Unauthorized', |
68
|
|
|
402 => 'Payment Required', |
69
|
|
|
403 => 'Forbidden', |
70
|
|
|
404 => 'Not Found', |
71
|
|
|
405 => 'Method Not Allowed', |
72
|
|
|
406 => 'Not Acceptable', |
73
|
|
|
407 => 'Proxy Authentication Required', |
74
|
|
|
408 => 'Request Timeout', |
75
|
|
|
409 => 'Conflict', |
76
|
|
|
410 => 'Gone', |
77
|
|
|
411 => 'Length Required', |
78
|
|
|
412 => 'Precondition Failed', |
79
|
|
|
413 => 'Request Entity Too Large', |
80
|
|
|
414 => 'Request-URI Too Long', |
81
|
|
|
415 => 'Unsupported Media Type', |
82
|
|
|
416 => 'Requested Range Not Satisfiable', |
83
|
|
|
417 => 'Expectation Failed', |
84
|
|
|
500 => 'Internal Server Error', |
85
|
|
|
501 => 'Not Implemented', |
86
|
|
|
502 => 'Bad Gateway', |
87
|
|
|
503 => 'Service Unavailable', |
88
|
|
|
504 => 'Gateway Timeout', |
89
|
|
|
505 => 'HTTP Version Not Supported' |
90
|
|
|
); |
91
|
|
|
|
92
|
|
|
public static function message(int $code) { |
93
|
|
|
return self::$messages[$code]; |
94
|
|
|
} |
95
|
|
|
} |