Fix hook situation for Skin::doEditSectionLink
[mediawiki.git] / includes / libs / HttpStatus.php
blob809bfdf5a8ca531609de19aa7f3a6ed4d29d13cc
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 * @param $code Integer: status code
32 * @return String or null: message or null if $code is not in the list of
33 * messages
35 public static function getMessage( $code ) {
36 static $statusMessage = array(
37 100 => 'Continue',
38 101 => 'Switching Protocols',
39 102 => 'Processing',
40 200 => 'OK',
41 201 => 'Created',
42 202 => 'Accepted',
43 203 => 'Non-Authoritative Information',
44 204 => 'No Content',
45 205 => 'Reset Content',
46 206 => 'Partial Content',
47 207 => 'Multi-Status',
48 300 => 'Multiple Choices',
49 301 => 'Moved Permanently',
50 302 => 'Found',
51 303 => 'See Other',
52 304 => 'Not Modified',
53 305 => 'Use Proxy',
54 307 => 'Temporary Redirect',
55 400 => 'Bad Request',
56 401 => 'Unauthorized',
57 402 => 'Payment Required',
58 403 => 'Forbidden',
59 404 => 'Not Found',
60 405 => 'Method Not Allowed',
61 406 => 'Not Acceptable',
62 407 => 'Proxy Authentication Required',
63 408 => 'Request Timeout',
64 409 => 'Conflict',
65 410 => 'Gone',
66 411 => 'Length Required',
67 412 => 'Precondition Failed',
68 413 => 'Request Entity Too Large',
69 414 => 'Request-URI Too Large',
70 415 => 'Unsupported Media Type',
71 416 => 'Request Range Not Satisfiable',
72 417 => 'Expectation Failed',
73 422 => 'Unprocessable Entity',
74 423 => 'Locked',
75 424 => 'Failed Dependency',
76 428 => 'Precondition Required',
77 429 => 'Too Many Requests',
78 431 => 'Request Header Fields Too Large',
79 500 => 'Internal Server Error',
80 501 => 'Not Implemented',
81 502 => 'Bad Gateway',
82 503 => 'Service Unavailable',
83 504 => 'Gateway Timeout',
84 505 => 'HTTP Version Not Supported',
85 507 => 'Insufficient Storage',
86 511 => 'Network Authentication Required',
88 return isset( $statusMessage[$code] ) ? $statusMessage[$code] : null;