1
|
|
|
<?php |
2
|
|
|
namespace WebServCo\Framework; |
3
|
|
|
|
4
|
|
|
final class Http |
5
|
|
|
{ |
6
|
|
|
const METHOD_GET = 'GET'; |
7
|
|
|
const METHOD_HEAD = 'HEAD'; |
8
|
|
|
const METHOD_POST = 'POST'; |
9
|
|
|
const METHOD_PUT = 'PUT'; |
10
|
|
|
const METHOD_DELETE = 'DELETE'; |
11
|
|
|
const METHOD_CONNECT = 'CONNECT'; |
12
|
|
|
const METHOD_OPTIONS = 'OPTIONS'; |
13
|
|
|
const METHOD_TRACE = 'TRACE'; |
14
|
|
|
|
15
|
|
|
public static $statusCodes = [ |
16
|
|
|
100 => 'Continue', |
17
|
|
|
101 => 'Switching Protocols', |
18
|
|
|
102 => 'Processing', |
19
|
|
|
200 => 'OK', |
20
|
|
|
201 => 'Created', |
21
|
|
|
202 => 'Accepted', |
22
|
|
|
203 => 'Non-Authoritative Information', |
23
|
|
|
204 => 'No Content', |
24
|
|
|
205 => 'Reset Content', |
25
|
|
|
206 => 'Partial Content', |
26
|
|
|
207 => 'Multi-Status', |
27
|
|
|
208 => 'Already Reported', |
28
|
|
|
226 => 'IM Used', |
29
|
|
|
300 => 'Multiple Choices', |
30
|
|
|
301 => 'Moved Permanently', |
31
|
|
|
302 => 'Moved Temporarily', |
32
|
|
|
303 => 'See Other', |
33
|
|
|
304 => 'Not Modified', |
34
|
|
|
305 => 'Use Proxy', |
35
|
|
|
307 => 'Temporary Redirect', |
36
|
|
|
308 => 'Permanent Redirect', |
37
|
|
|
400 => 'Bad Request', |
38
|
|
|
401 => 'Unauthorized', |
39
|
|
|
402 => 'Payment Required', |
40
|
|
|
403 => 'Forbidden', |
41
|
|
|
404 => 'Not Found', |
42
|
|
|
405 => 'Method Not Allowed', |
43
|
|
|
406 => 'Not Acceptable', |
44
|
|
|
407 => 'Proxy Authentication Required', |
45
|
|
|
408 => 'Request Time-out', |
46
|
|
|
409 => 'Conflict', |
47
|
|
|
410 => 'Gone', |
48
|
|
|
411 => 'Length Required', |
49
|
|
|
412 => 'Precondition Failed', |
50
|
|
|
413 => 'Request Entity Too Large', |
51
|
|
|
414 => 'Request-URI Too Large', |
52
|
|
|
415 => 'Unsupported Media Type', |
53
|
|
|
416 => 'Requested Range Not Satisfiable', |
54
|
|
|
417 => 'Expectation Failed', |
55
|
|
|
421 => 'Misdirected Request', |
56
|
|
|
422 => 'Unprocessable Entity', |
57
|
|
|
423 => 'Locked', |
58
|
|
|
424 => 'Failed Dependency', |
59
|
|
|
426 => 'Upgrade Required', |
60
|
|
|
428 => 'Precondition Required', |
61
|
|
|
429 => 'Too Many Requests', |
62
|
|
|
431 => 'Request Header Fields Too Large', |
63
|
|
|
451 => 'Unavailable For Legal Reasons', |
64
|
|
|
500 => 'Internal Server Error', |
65
|
|
|
501 => 'Not Implemented', |
66
|
|
|
502 => 'Bad Gateway', |
67
|
|
|
503 => 'Service Unavailable', |
68
|
|
|
504 => 'Gateway Time-out', |
69
|
|
|
505 => 'HTTP Version not supported', |
70
|
|
|
506 => 'Variant Also Negotiates', |
71
|
|
|
507 => 'Insufficient Storage', |
72
|
|
|
508 => 'Loop Detected', |
73
|
|
|
510 => 'Not Extended', |
74
|
|
|
511 => 'Network Authentication Required', |
75
|
|
|
]; |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* Retrieve list of supported HTTP methods. |
79
|
|
|
* |
80
|
|
|
* @return array |
81
|
|
|
*/ |
82
|
|
|
public static function getMethods() |
83
|
|
|
{ |
84
|
|
|
return [self::METHOD_GET, self::METHOD_HEAD, self::METHOD_POST]; |
85
|
|
|
} |
86
|
|
|
} |
87
|
|
|
|