* @package Mammut\Protocol */ class Status extends \Mammut\StrictObject { // http status codes, see RFC 2616 section 10 // informal const STATUS_CONTINUE = 100; // Continue const STATUS_P_SWITCH = 101; // Switching Protocols // success const STATUS_OK = 200; // OK const STATUS_CREATED = 201; // Created const STATUS_ACCEPTED = 202; // Accepted const STATUS_NO_AU_INFO = 203; // Non-Authoritative Information const STATUS_NO_CONTENT = 204; // No Content const STATUS_RESET = 205; // Reset Content const STATUS_PARTIAL = 206; // Partial Content // redirection const STATUS_MUL_CHOISE = 300; // Multiple Choices const STATUS_MOVED = 301; // Moved Permanently const STATUS_FOUND = 302; // Found const STATUS_METHOD = 303; // See Other const STATUS_NOT_MOD = 304; // Not Modified const STATUS_USE_PROXY = 305; // Use Proxy // const STATUS_NOT_MOD = 306; // UNUSED const STATUS_TEMP_RED = 307; // Temporary Redirect // client error const STATUS_BAD_REQU = 400; // Bad Request const STATUS_UNAUTH = 401; // Unauthorized const STATUS_PAYM_REQU = 402; // Payment Required const STATUS_FORBIDDEN = 403; // Forbidden const STATUS_NOT_FOUND = 404; // Not Found const STATUS_METH_ALLOW = 405; // Method Not Allowed const STATUS_NOT_ACCEPT = 406; // Not Acceptable const STATUS_PROXY_AUTH = 407; // Proxy Authentication Required const STATUS_TIMEOUT = 408; // Request Timeout const STATUS_CONFLICT = 409; // Conflict const STATUS_GONE = 410; // Gone const STATUS_LENGTH_REQ = 411; // Length Required const STATUS_PRECON_FAIL= 412; // Precondition Failed const STATUS_ENTITY_SIZE= 413; // Request Entity Too Large const STATUS_URI_SIZE = 414; // Request-URI Too Long const STATUS_UNS_MEDIA = 415; // Unsupported Media Type const STATUS_REQ_RANGE = 416; // Requested Range Not Satisfiable const STATUS_EXP_FAIL = 417; // Expectation Failed // server error const STATUS_INTERNAL = 500; // Internal Error const STATUS_NOT_IMPL = 501; // Not implemented const STATUS_BAD_GW = 502; // Bad Gateway const STATUS_SVC_UNAV = 503; // Service Unavailable const STATUS_GW_TIMEOUT = 504; // Gateway Timeout const STATUS_HTTP_UNS = 505; // HTTP Version Not Supported private function __construct() {} // not instancable public static function getMessage($code) { switch ((int) $code) { case self::STATUS_CONTINUE: return 'Continue'; case self::STATUS_P_SWITCH: return 'Switching Protocols '; // success case self::STATUS_OK: return 'OK'; case self::STATUS_CREATED: return 'Created'; case self::STATUS_ACCEPTED: return 'Accepted'; case self::STATUS_NO_AU_INFO: return 'Non-Authoritative Information'; case self::STATUS_NO_CONTENT: return 'No Content'; case self::STATUS_RESET : return 'Reset Content'; case self::STATUS_PARTIAL: return 'Partial Content'; // redirection case self::STATUS_MUL_CHOISE: return 'Multiple Choices'; case self::STATUS_MOVED : return 'Moved Permanently'; case self::STATUS_FOUND : return 'Found'; case self::STATUS_METHOD: return 'See Other'; case self::STATUS_NOT_MOD: return 'Not Modified'; case self::STATUS_USE_PROXY: return 'Use Proxy'; // case self::STATUS_NOT_MOD: return 'UNUSED'; case self::STATUS_TEMP_RED: return 'Temporary Redirect'; // client error case self::STATUS_BAD_REQU: return 'Bad Request'; case self::STATUS_UNAUTH: return 'Unauthorized'; case self::STATUS_PAYM_REQU: return 'Payment Required'; case self::STATUS_FORBIDDEN: return 'Forbidden'; case self::STATUS_NOT_FOUND: return 'Not Found'; case self::STATUS_METH_ALLOW: return 'Method Not Allowed'; case self::STATUS_NOT_ACCEPT: return 'Not Acceptable'; case self::STATUS_PROXY_AUTH: return 'Proxy Authentication Required'; case self::STATUS_TIMEOUT: return 'Request Timeout'; case self::STATUS_CONFLICT: return 'Conflict'; case self::STATUS_GONE : return 'Gone'; case self::STATUS_LENGTH_REQ: return 'Length Required'; case self::STATUS_PRECON_FAIL: return 'Precondition Failed'; case self::STATUS_ENTITY_SIZE: return 'Request Entity Too Large'; case self::STATUS_URI_SIZE: return 'Request-URI Too Long'; case self::STATUS_UNS_MEDIA: return 'Unsupported Media Type'; case self::STATUS_REQ_RANGE: return 'Requested Range Not Satisfiable'; case self::STATUS_EXP_FAIL: return 'Expectation Failed'; // server error case self::STATUS_INTERNAL: return 'Internal Error'; case self::STATUS_NOT_IMPL: return 'Not implemented'; case self::STATUS_BAD_GW: return 'Bad Gateway '; case self::STATUS_SVC_UNAV: return 'Service Unavailable'; case self::STATUS_GW_TIMEOUT: return 'Gateway Timeout'; case self::STATUS_HTTP_UNS: return 'HTTP Version Not Supported'; default: return 'Unknown Error'; } } }