Merge "Typo fix"
[mediawiki.git] / includes / libs / HttpStatus.php
blob4f626b23c59ab24558af4482eb98439c6513097c
1 <?php
2 /**
3 * List of HTTP status codes.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
20 * @file
23 /**
24 * @todo document
26 class HttpStatus {
28 /**
29 * Get the message associated with HTTP response code $code
31 * Replace OutputPage::getStatusMessage( $code )
33 * @param $code Integer: status code
34 * @return String or null: message or null if $code is not in the list of
35 * messages
37 public static function getMessage( $code ) {
38 static $statusMessage = array(
39 100 => 'Continue',
40 101 => 'Switching Protocols',
41 102 => 'Processing',
42 200 => 'OK',
43 201 => 'Created',
44 202 => 'Accepted',
45 203 => 'Non-Authoritative Information',
46 204 => 'No Content',
47 205 => 'Reset Content',
48 206 => 'Partial Content',
49 207 => 'Multi-Status',
50 300 => 'Multiple Choices',
51 301 => 'Moved Permanently',
52 302 => 'Found',
53 303 => 'See Other',
54 304 => 'Not Modified',
55 305 => 'Use Proxy',
56 307 => 'Temporary Redirect',
57 400 => 'Bad Request',
58 401 => 'Unauthorized',
59 402 => 'Payment Required',
60 403 => 'Forbidden',
61 404 => 'Not Found',
62 405 => 'Method Not Allowed',
63 406 => 'Not Acceptable',
64 407 => 'Proxy Authentication Required',
65 408 => 'Request Timeout',
66 409 => 'Conflict',
67 410 => 'Gone',
68 411 => 'Length Required',
69 412 => 'Precondition Failed',
70 413 => 'Request Entity Too Large',
71 414 => 'Request-URI Too Large',
72 415 => 'Unsupported Media Type',
73 416 => 'Request Range Not Satisfiable',
74 417 => 'Expectation Failed',
75 422 => 'Unprocessable Entity',
76 423 => 'Locked',
77 424 => 'Failed Dependency',
78 500 => 'Internal Server Error',
79 501 => 'Not Implemented',
80 502 => 'Bad Gateway',
81 503 => 'Service Unavailable',
82 504 => 'Gateway Timeout',
83 505 => 'HTTP Version Not Supported',
84 507 => 'Insufficient Storage'
86 return isset( $statusMessage[$code] ) ? $statusMessage[$code] : null;