# HttpStatus.class.php

Go to the documentation of this file.

    00001 <?php
    00002 /***************************************************************************
    00003  *   Copyright (C) 2006-2007 by Dmitry E. Demidov                          *
    00004  *                                                                         *
    00005  *   This program is free software; you can redistribute it and/or modify  *
    00006  *   it under the terms of the GNU Lesser General Public License as        *
    00007  *   published by the Free Software Foundation; either version 3 of the    *
    00008  *   License, or (at your option) any later version.                       *
    00009  *                                                                         *
    00010  ***************************************************************************/
    00011
    00017     final class HttpStatus extends Enumeration
    00018     {
    00019         const CODE_100  = 100;
    00020         const CODE_101  = 101;
    00021         const CODE_200  = 200;
    00022         const CODE_201  = 201;
    00023         const CODE_202  = 202;
    00024         const CODE_203  = 203;
    00025         const CODE_204  = 204;
    00026         const CODE_205  = 205;
    00027         const CODE_206  = 206;
    00028         const CODE_300  = 300;
    00029         const CODE_301  = 301;
    00030         const CODE_302  = 302;
    00031         const CODE_303  = 303;
    00032         const CODE_304  = 304;
    00033         const CODE_305  = 305;
    00034         const CODE_307  = 307;
    00035         const CODE_400  = 400;
    00036         const CODE_401  = 401;
    00037         const CODE_402  = 402;
    00038         const CODE_403  = 403;
    00039         const CODE_404  = 404;
    00040         const CODE_405  = 405;
    00041         const CODE_406  = 406;
    00042         const CODE_407  = 407;
    00043         const CODE_408  = 408;
    00044         const CODE_409  = 409;
    00045         const CODE_410  = 410;
    00046         const CODE_411  = 411;
    00047         const CODE_412  = 412;
    00048         const CODE_413  = 413;
    00049         const CODE_414  = 414;
    00050         const CODE_415  = 415;
    00051         const CODE_416  = 416;
    00052         const CODE_417  = 417;
    00053         const CODE_500  = 500;
    00054         const CODE_501  = 501;
    00055         const CODE_502  = 502;
    00056         const CODE_503  = 503;
    00057         const CODE_504  = 504;
    00058         const CODE_507  = 507;
    00059         const CODE_510  = 510;
    00060
    00061         protected $names = array(
    00062             self::CODE_100 => 'Continue',
    00063             self::CODE_101 => 'Switching Protocols',
    00064             self::CODE_200 => 'OK',
    00065             self::CODE_201 => 'Created',
    00066             self::CODE_202 => 'Accepted',
    00067             self::CODE_203 => 'Non-Authoritative Information',
    00068             self::CODE_204 => 'No Content',
    00069             self::CODE_205 => 'Reset Content',
    00070             self::CODE_206 => 'Partial Content',
    00071             self::CODE_300 => 'Multiple Choices',
    00072             self::CODE_301 => 'Moved Permanently',
    00073             self::CODE_302 => 'Found',
    00074             self::CODE_303 => 'See Other',
    00075             self::CODE_304 => 'Not Modified',
    00076             self::CODE_305 => 'Use Proxy',
    00077             self::CODE_307 => 'Temporary Redirect',
    00078             self::CODE_400 => 'Bad Request',
    00079             self::CODE_401 => 'Unauthorized',
    00080             self::CODE_402 => 'Payment Required',
    00081             self::CODE_403 => 'Forbidden',
    00082             self::CODE_404 => 'Not Found',
    00083             self::CODE_405 => 'Method Not Allowed',
    00084             self::CODE_406 => 'Not Acceptable',
    00085             self::CODE_407 => 'Proxy Authentication Required',
    00086             self::CODE_408 => 'Request Time-out',
    00087             self::CODE_409 => 'Conflict',
    00088             self::CODE_410 => 'Gone',
    00089             self::CODE_411 => 'Length Required',
    00090             self::CODE_412 => 'Precondition Failed',
    00091             self::CODE_413 => 'Request Entity Too Large',
    00092             self::CODE_414 => 'Request-URI Too Large',
    00093             self::CODE_415 => 'Unsupported Media Type',
    00094             self::CODE_416 => 'Requested range not satisfiable',
    00095             self::CODE_417 => 'Expectation Failed',
    00096             self::CODE_500 => 'Internal Server Error',
    00097             self::CODE_501 => 'Not Implemented',
    00098             self::CODE_502 => 'Bad Gateway',
    00099             self::CODE_503 => 'Service Unavailable',
    00100             self::CODE_504 => 'Gateway Time-out',
    00101             self::CODE_507 => 'Insufficient Storage',
    00102             self::CODE_510 => 'Not Extended'
    00103         );
    00104
    00105         public static function getAnyId()
    00106         {
    00107             return 200;
    00108         }
    00109
    00110         public function toString()
    00111         {
    00112             return 'HTTP/1.1 '.$this->id.' '.$this->name;
    00113         }
    00114     }
    00115 ?>