mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Making messages optional for HTTP exceptions.
This commit is contained in:
parent
8bd0f18a53
commit
01eb0bf07d
1 changed files with 5 additions and 5 deletions
|
@ -31,7 +31,7 @@ class BadRequestException extends RuntimeException {
|
|||
* @param string $message If no message is given 'Bad Request' will be the message
|
||||
* @param string $code Status code, defaults to 401
|
||||
*/
|
||||
public function __construct($message, $code = 400) {
|
||||
public function __construct($message = null, $code = 400) {
|
||||
if (empty($message)) {
|
||||
$message = 'Bad Request';
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ class UnauthorizedException extends RuntimeException {
|
|||
* @param string $message If no message is given 'Unauthorized' will be the message
|
||||
* @param string $code Status code, defaults to 401
|
||||
*/
|
||||
public function __construct($message, $code = 401) {
|
||||
public function __construct($message = null, $code = 401) {
|
||||
if (empty($message)) {
|
||||
$message = 'Unauthorized';
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ class ForbiddenException extends RuntimeException {
|
|||
* @param string $message If no message is given 'Forbidden' will be the message
|
||||
* @param string $code Status code, defaults to 401
|
||||
*/
|
||||
public function __construct($message, $code = 403) {
|
||||
public function __construct($message = null, $code = 403) {
|
||||
if (empty($message)) {
|
||||
$message = 'Forbidden';
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ class NotFoundException extends RuntimeException {
|
|||
* @param string $message If no message is given 'Not Found' will be the message
|
||||
* @param string $code Status code, defaults to 404
|
||||
*/
|
||||
public function __construct($message, $code = 404) {
|
||||
public function __construct($message = null, $code = 404) {
|
||||
if (empty($message)) {
|
||||
$message = 'Not Found';
|
||||
}
|
||||
|
@ -111,7 +111,7 @@ class InternalErrorException extends CakeException {
|
|||
* @param string $message If no message is given 'Not Found' will be the message
|
||||
* @param string $code Status code, defaults to 404
|
||||
*/
|
||||
public function __construct($message, $code = 500) {
|
||||
public function __construct($message = null, $code = 500) {
|
||||
if (empty($message)) {
|
||||
$message = 'Internal Server Error';
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue