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
29 * Get the message associed with the 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
37 public static function getMessage( $code ) {
38 static $statusMessage = array(
40 101 => 'Switching Protocols',
45 203 => 'Non-Authoritative Information',
47 205 => 'Reset Content',
48 206 => 'Partial Content',
49 207 => 'Multi-Status',
50 300 => 'Multiple Choices',
51 301 => 'Moved Permanently',
54 304 => 'Not Modified',
56 307 => 'Temporary Redirect',
58 401 => 'Unauthorized',
59 402 => 'Payment Required',
62 405 => 'Method Not Allowed',
63 406 => 'Not Acceptable',
64 407 => 'Proxy Authentication Required',
65 408 => 'Request Timeout',
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',
77 424 => 'Failed Dependency',
78 500 => 'Internal Server Error',
79 501 => 'Not Implemented',
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;