(bug 19195) Make user IDs more readily available with the API
[lhc/web/wiklou.git] / includes / libs / HttpStatus.php
1 <?php
2 /**
3 * @todo document
4 */
5 class HttpStatus {
6
7 /**
8 * Get the message associed with the HTTP response code $code
9 *
10 * Replace OutputPage::getStatusMessage( $code )
11 *
12 * @param $code Integer: status code
13 * @return String or null: message or null if $code is not in the list of
14 * messages
15 */
16 public static function getMessage( $code ) {
17 static $statusMessage = array(
18 100 => 'Continue',
19 101 => 'Switching Protocols',
20 102 => 'Processing',
21 200 => 'OK',
22 201 => 'Created',
23 202 => 'Accepted',
24 203 => 'Non-Authoritative Information',
25 204 => 'No Content',
26 205 => 'Reset Content',
27 206 => 'Partial Content',
28 207 => 'Multi-Status',
29 300 => 'Multiple Choices',
30 301 => 'Moved Permanently',
31 302 => 'Found',
32 303 => 'See Other',
33 304 => 'Not Modified',
34 305 => 'Use Proxy',
35 307 => 'Temporary Redirect',
36 400 => 'Bad Request',
37 401 => 'Unauthorized',
38 402 => 'Payment Required',
39 403 => 'Forbidden',
40 404 => 'Not Found',
41 405 => 'Method Not Allowed',
42 406 => 'Not Acceptable',
43 407 => 'Proxy Authentication Required',
44 408 => 'Request Timeout',
45 409 => 'Conflict',
46 410 => 'Gone',
47 411 => 'Length Required',
48 412 => 'Precondition Failed',
49 413 => 'Request Entity Too Large',
50 414 => 'Request-URI Too Large',
51 415 => 'Unsupported Media Type',
52 416 => 'Request Range Not Satisfiable',
53 417 => 'Expectation Failed',
54 422 => 'Unprocessable Entity',
55 423 => 'Locked',
56 424 => 'Failed Dependency',
57 500 => 'Internal Server Error',
58 501 => 'Not Implemented',
59 502 => 'Bad Gateway',
60 503 => 'Service Unavailable',
61 504 => 'Gateway Timeout',
62 505 => 'HTTP Version Not Supported',
63 507 => 'Insufficient Storage'
64 );
65 return isset( $statusMessage[$code] ) ? $statusMessage[$code] : null;
66 }
67
68 }