diff http-response-status-codes.inc @ 48:c6d0892f81ff

Documentation.
author Tom Fredrik Blenning Klaussen <bfg@blenning.no>
date Tue, 09 Oct 2012 20:05:12 +0200
parents f42dbf44b661
children 6cb775b62281
line wrap: on
line diff
--- a/http-response-status-codes.inc	Mon Oct 08 17:35:08 2012 +0200
+++ b/http-response-status-codes.inc	Tue Oct 09 20:05:12 2012 +0200
@@ -5,61 +5,187 @@
  * Recess Framework (http://www.recessframework.com/)
  *
  * @author Kris Jordan
- * @license MIT
- * @package recess.http
+ * @author Tom Fredrik Blenning Klaussen
+ * @copyright MIT
  */
 class StatusCodes
 {
   // [Informational 1xx]
+  /**
+   * <a href="http://httpstatus.es/100">HTTP_CONTINUE</a>
+   */
   const HTTP_CONTINUE = 100;
+  /**
+   * <a href="http://httpstatus.es/101">HTTP_SWITCHING_PROTOCOLS</a>
+   */
   const HTTP_SWITCHING_PROTOCOLS = 101;
 
   // [Successful 2xx]
+  /**
+   * <a href="http://httpstatus.es/200">HTTP_OK</a>
+   */
   const HTTP_OK = 200;
+  /**
+   * <a href="http://httpstatus.es/201">HTTP_CREATED</a>
+   */
   const HTTP_CREATED = 201;
+  /**
+   * <a href="http://httpstatus.es/202">HTTP_ACCEPTED</a>
+   */
   const HTTP_ACCEPTED = 202;
+  /**
+   * <a href="http://httpstatus.es/203">HTTP_ACCEPTED</a>
+   */
   const HTTP_NONAUTHORITATIVE_INFORMATION = 203;
+  /**
+   * <a href="http://httpstatus.es/204">HTTP_NO_CONTENT</a>
+   */
   const HTTP_NO_CONTENT = 204;
+  /**
+   * <a href="http://httpstatus.es/205">HTTP_RESET_CONTENT</a>
+   */
   const HTTP_RESET_CONTENT = 205;
+  /**
+   * <a href="http://httpstatus.es/206">HTTP_PARTIAL_CONTENT</a>
+   */
   const HTTP_PARTIAL_CONTENT = 206;
 
   // [Redirection 3xx]
+  /**
+   * <a href="http://httpstatus.es/300">HTTP_MULTIPLE_CHOICES</a>
+   */
   const HTTP_MULTIPLE_CHOICES = 300;
+  /**
+   * <a href="http://httpstatus.es/301">HTTP_MOVED_PERMANENTLY</a>
+   */
   const HTTP_MOVED_PERMANENTLY = 301;
+  /**
+   * <a href="http://httpstatus.es/302">HTTP_FOUND</a>
+   */
   const HTTP_FOUND = 302;
+  /**
+   * <a href="http://httpstatus.es/303">HTTP_SEE_OTHER</a>
+   */
   const HTTP_SEE_OTHER = 303;
+  /**
+   * <a href="http://httpstatus.es/304">HTTP_NOT_MODIFIED</a>
+   */
   const HTTP_NOT_MODIFIED = 304;
+  /**
+   * <a href="http://httpstatus.es/305">HTTP_USE_PROXY</a>
+   */
   const HTTP_USE_PROXY = 305;
-  const HTTP_UNUSED= 306;
+  /**
+   * <a href="http://httpstatus.es/306">HTTP_UNUSED</a>
+   */
+  const HTTP_UNUSED = 306;
+  /**
+   * <a href="http://httpstatus.es/307">HTTP_TEMPORARY_REDIRECT</a>
+   */
   const HTTP_TEMPORARY_REDIRECT = 307;
 
   // [Client Error 4xx]
-  const errorCodesBeginAt = 400;
+  /**
+   * Defines the beginning of errorCodes
+   */
+  private const errorCodesBeginAt = 400;
+  /**
+   * <a href="http://httpstatus.es/400">HTTP_BAD_REQUEST</a>
+   */
   const HTTP_BAD_REQUEST = 400;
+  /**
+   * <a href="http://httpstatus.es/401">HTTP_UNAUTHORIZED</a>
+   */
   const HTTP_UNAUTHORIZED = 401;
+  /**
+   * <a href="http://httpstatus.es/402">HTTP_PAYMENT_REQUIRED</a>
+   */
   const HTTP_PAYMENT_REQUIRED = 402;
+  /**
+   * <a href="http://httpstatus.es/403">HTTP_FORBIDDEN</a>
+   */
   const HTTP_FORBIDDEN = 403;
+  /**
+   * <a href="http://httpstatus.es/404">HTTP_NOT_FOUND</a>
+   */
   const HTTP_NOT_FOUND = 404;
+  /**
+   * <a href="http://httpstatus.es/405">HTTP_METHOD_NOT_ALLOWED</a>
+   */
   const HTTP_METHOD_NOT_ALLOWED = 405;
+  /**
+   * <a href="http://httpstatus.es/406">HTTP_NOT_ACCEPTABLE</a>
+   */
   const HTTP_NOT_ACCEPTABLE = 406;
+  /**
+   * <a href="http://httpstatus.es/407">HTTP_PROXY_AUTHENTICATION_REQUIRED</a>
+   */
   const HTTP_PROXY_AUTHENTICATION_REQUIRED = 407;
+  /**
+   * <a href="http://httpstatus.es/408">HTTP_REQUEST_TIMEOUT</a>
+   */
   const HTTP_REQUEST_TIMEOUT = 408;
+  /**
+   * <a href="http://httpstatus.es/409">HTTP_CONFLICT</a>
+   */
   const HTTP_CONFLICT = 409;
+  /**
+   * <a href="http://httpstatus.es/410">HTTP_GONE</a>
+   */
   const HTTP_GONE = 410;
+  /**
+   * <a href="http://httpstatus.es/411">HTTP_LENGTH_REQUIRED</a>
+   */
   const HTTP_LENGTH_REQUIRED = 411;
+  /**
+   * <a href="http://httpstatus.es/412">HTTP_PRECONDITION_FAILED</a>
+   */
   const HTTP_PRECONDITION_FAILED = 412;
+  /**
+   * <a href="http://httpstatus.es/413">HTTP_REQUEST_ENTITY_TOO_LARGE</a>
+   */
   const HTTP_REQUEST_ENTITY_TOO_LARGE = 413;
+  /**
+   * <a href="http://httpstatus.es/414">HTTP_REQUEST_URI_TOO_LONG</a>
+   */
   const HTTP_REQUEST_URI_TOO_LONG = 414;
+  /**
+   * <a href="http://httpstatus.es/415">HTTP_UNSUPPORTED_MEDIA_TYPE</a>
+   */
   const HTTP_UNSUPPORTED_MEDIA_TYPE = 415;
+  /**
+   * <a href="http://httpstatus.es/416">HTTP_REQUESTED_RANGE_NOT_SATISFIABLE</a>
+   */
   const HTTP_REQUESTED_RANGE_NOT_SATISFIABLE = 416;
+  /**
+   * <a href="http://httpstatus.es/417">HTTP_EXPECTATION_FAILED</a>
+   */
   const HTTP_EXPECTATION_FAILED = 417;
 
   // [Server Error 5xx]
+  /**
+   * <a href="http://httpstatus.es/500">HTTP_INTERNAL_SERVER_ERROR</a>
+   */
   const HTTP_INTERNAL_SERVER_ERROR = 500;
+  /**
+   * <a href="http://httpstatus.es/501">HTTP_NOT_IMPLEMENTED</a>
+   */
   const HTTP_NOT_IMPLEMENTED = 501;
+  /**
+   * <a href="http://httpstatus.es/502">HTTP_BAD_GATEWAY</a>
+   */
   const HTTP_BAD_GATEWAY = 502;
+  /**
+   * <a href="http://httpstatus.es/503">HTTP_SERVICE_UNAVAILABLE</a>
+   */
   const HTTP_SERVICE_UNAVAILABLE = 503;
+  /**
+   * <a href="http://httpstatus.es/504">HTTP_GATEWAY_TIMEOUT</a>
+   */
   const HTTP_GATEWAY_TIMEOUT = 504;
+  /**
+   * <a href="http://httpstatus.es/505">HTTP_VERSION_NOT_SUPPORTED</a>
+   */
   const HTTP_VERSION_NOT_SUPPORTED = 505;
 
   private static $messages =
@@ -116,21 +242,45 @@
 	  505=>'505 HTTP Version Not Supported'
 	  );
 
+  /**
+   * Get the header for the specified code.
+   *
+   * @param $code Http status code
+   * @return A textual representation of the header
+   */
   public static function httpHeaderFor($code)
   {
     return 'HTTP/1.1 ' . self::$messages[$code];
   }
 
+  /**
+   * Get a canonical status message for the specified code
+   *
+   * @param $code Http status code
+   * @return Text for the specified code
+   */
   public static function getMessageForCode($code)
   {
     return self::$messages[$code];
   }
 
+  /**
+   * Checks if the specified code is an error code.
+   *
+   * @param $code Http status code
+   * @return bool Answer
+   */
   public static function isError($code)
   {
     return is_numeric($code) && $code >= self::HTTP_BAD_REQUEST;
   }
 
+  /**
+   * Can the specified status code have a body?
+   *
+   * @param $code Http status code
+   * @return bool Answer
+   */
   public static function canHaveBody($code)
   {
     return