From ae9fbaa709208aae8778636256ac8b73305db1c2 Mon Sep 17 00:00:00 2001 From: PJ Dietz Date: Sun, 13 Jul 2014 10:26:01 -0400 Subject: [PATCH] Add phpdoc for HttpException and subclasses. --- .../WellRESTed/Exceptions/HttpExceptions.php | 61 ++++++++++++++++--- 1 file changed, 53 insertions(+), 8 deletions(-) diff --git a/src/pjdietz/WellRESTed/Exceptions/HttpExceptions.php b/src/pjdietz/WellRESTed/Exceptions/HttpExceptions.php index 01ec2d4..74c50d1 100644 --- a/src/pjdietz/WellRESTed/Exceptions/HttpExceptions.php +++ b/src/pjdietz/WellRESTed/Exceptions/HttpExceptions.php @@ -1,39 +1,84 @@ + * @copyright Copyright 2014 by PJ Dietz + * @license MIT + */ + namespace pjdietz\WellRESTed\Exceptions; +/** + * Base exception for HTTP-related errors. Also represents a 500 Internal Server error. + */ class HttpException extends WellRESTedException { + /** @var int HTTP Status Code */ protected $code = 500; + /** @var string Default description for the error */ protected $message = "500 Internal Server Error"; } +/** + * Represents a 400 Bad Request error. + */ class BadRequestException extends HttpException { + /** @var int HTTP Status Code */ protected $code = 400; + /** @var string Default description for the error */ protected $message = "400 Bad Request"; } -class ForbiddenException extends HttpException -{ - protected $code = 401; - protected $message = "401 Forbidden"; -} - +/** + * Represents a 401 Unauthorization error. + */ class UnauthorizedException extends HttpException { - protected $code = 403; - protected $message = "403 Unauthorized"; + /** @var int HTTP Status Code */ + protected $code = 401; + /** @var string Default description for the error */ + protected $message = "401 Unauthorized"; } +/** + * Represents a 403 Forbidden error. + */ +class ForbiddenException extends HttpException +{ + /** @var int HTTP Status Code */ + protected $code = 403; + /** @var string Default description for the error */ + protected $message = "403 Forbidden"; +} + +/** + * Represents a 404 Not Found error. + */ class NotFoundException extends HttpException { + /** @var int HTTP Status Code */ protected $code = 404; + /** @var string Default description for the error */ protected $message = "404 Not Found"; } +/** + * Represents a 409 Conflict error. + */ class ConflictException extends HttpException { + /** @var int HTTP Status Code */ protected $code = 409; + /** @var string Default description for the error */ protected $message = "409 Conflict"; }