From 57353eb9b02af1da80658fe6a18e6a81e80a9472 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 31 Oct 2021 04:54:24 +0000 Subject: [PATCH] Changed scope --- include/api.php | 2 +- src/Module/Debug/Probe.php | 4 +--- src/Module/Debug/WebFinger.php | 4 +--- src/Module/Search/Index.php | 4 +--- src/Module/Special/HTTPException.php | 10 +++++----- src/Network/HTTPException.php | 14 ++++++++++++-- src/Network/HTTPException/AcceptedException.php | 4 ++-- src/Network/HTTPException/BadGatewayException.php | 6 +++--- src/Network/HTTPException/BadRequestException.php | 6 +++--- src/Network/HTTPException/ConflictException.php | 6 +++--- .../HTTPException/ExpectationFailedException.php | 6 +++--- src/Network/HTTPException/ForbiddenException.php | 6 +++--- src/Network/HTTPException/FoundException.php | 4 ++-- .../HTTPException/GatewayTimeoutException.php | 6 +++--- src/Network/HTTPException/GoneException.php | 6 +++--- src/Network/HTTPException/ImATeapotException.php | 6 +++--- .../HTTPException/InternalServerErrorException.php | 6 +++--- .../HTTPException/LenghtRequiredException.php | 6 +++--- .../HTTPException/MethodNotAllowedException.php | 6 +++--- src/Network/HTTPException/MovedPermanently.php | 4 ++-- src/Network/HTTPException/NoContentException.php | 4 ++-- .../HTTPException/NonAcceptableException.php | 6 +++--- src/Network/HTTPException/NotFoundException.php | 6 +++--- .../HTTPException/NotImplementedException.php | 6 +++--- src/Network/HTTPException/NotModifiedException.php | 4 ++-- src/Network/HTTPException/OKException.php | 4 ++-- .../HTTPException/PreconditionFailedException.php | 6 +++--- .../HTTPException/ServiceUnavailableException.php | 6 +++--- .../HTTPException/TemporaryRedirectException.php | 4 ++-- .../HTTPException/TooManyRequestsException.php | 6 +++--- .../HTTPException/UnauthorizedException.php | 6 +++--- .../HTTPException/UnprocessableEntityException.php | 6 +++--- .../UnsupportedMediaTypeException.php | 6 +++--- 33 files changed, 95 insertions(+), 91 deletions(-) diff --git a/include/api.php b/include/api.php index fc73ae8500..b6869a2b13 100644 --- a/include/api.php +++ b/include/api.php @@ -371,7 +371,7 @@ function api_call(App $a, App\Arguments $args = null) Logger::warning(API_LOG_PREFIX . 'not implemented', ['module' => 'api', 'action' => 'call', 'query' => DI::args()->getQueryString()]); throw new NotFoundException(); } catch (HTTPException $e) { - header("HTTP/1.1 {$e->getCode()} {$e->httpdesc}"); + header("HTTP/1.1 {$e->getCode()} {$e->getDescription()}"); return api_error($type, $e, $args); } } diff --git a/src/Module/Debug/Probe.php b/src/Module/Debug/Probe.php index 6c2891c0be..304096b2ec 100644 --- a/src/Module/Debug/Probe.php +++ b/src/Module/Debug/Probe.php @@ -35,9 +35,7 @@ class Probe extends BaseModule public static function content(array $parameters = []) { if (!local_user()) { - $e = new HTTPException\ForbiddenException(DI::l10n()->t('Only logged in users are permitted to perform a probing.')); - $e->httpdesc = DI::l10n()->t('Public access denied.'); - throw $e; + throw new HTTPException\ForbiddenException(DI::l10n()->t('Only logged in users are permitted to perform a probing.')); } $addr = $_GET['addr'] ?? ''; diff --git a/src/Module/Debug/WebFinger.php b/src/Module/Debug/WebFinger.php index ace1c1f9a4..e8a619f0b9 100644 --- a/src/Module/Debug/WebFinger.php +++ b/src/Module/Debug/WebFinger.php @@ -34,9 +34,7 @@ class WebFinger extends BaseModule public static function content(array $parameters = []) { if (!local_user()) { - $e = new \Friendica\Network\HTTPException\ForbiddenException(DI::l10n()->t('Only logged in users are permitted to perform a probing.')); - $e->httpdesc = DI::l10n()->t('Public access denied.'); - throw $e; + throw new \Friendica\Network\HTTPException\ForbiddenException(DI::l10n()->t('Only logged in users are permitted to perform a probing.')); } $addr = $_GET['addr'] ?? ''; diff --git a/src/Module/Search/Index.php b/src/Module/Search/Index.php index 7be5058c2b..5220317bf9 100644 --- a/src/Module/Search/Index.php +++ b/src/Module/Search/Index.php @@ -51,9 +51,7 @@ class Index extends BaseSearch } if (DI::config()->get('system', 'local_search') && !Session::isAuthenticated()) { - $e = new HTTPException\ForbiddenException(DI::l10n()->t('Only logged in users are permitted to perform a search.')); - $e->httpdesc = DI::l10n()->t('Public access denied.'); - throw $e; + throw new HTTPException\ForbiddenException(DI::l10n()->t('Only logged in users are permitted to perform a search.')); } if (DI::config()->get('system', 'permit_crawling') && !Session::isAuthenticated()) { diff --git a/src/Module/Special/HTTPException.php b/src/Module/Special/HTTPException.php index 137b72b36e..8fe4c8ce57 100644 --- a/src/Module/Special/HTTPException.php +++ b/src/Module/Special/HTTPException.php @@ -45,8 +45,8 @@ class HTTPException { // Explanations are mostly taken from https://en.wikipedia.org/wiki/List_of_HTTP_status_codes $vars = [ - '$title' => $e->httpdesc ?: 'Error ' . $e->getCode(), - '$message' => $e->getMessage() ?: $e->explanation, + '$title' => $e->getDescription() ?: 'Error ' . $e->getCode(), + '$message' => $e->getMessage() ?: $e->getExplanation(), '$back' => DI::l10n()->t('Go back'), '$stack_trace' => DI::l10n()->t('Stack trace:'), ]; @@ -74,7 +74,7 @@ class HTTPException $content = Renderer::replaceMacros($tpl, self::getVars($e)); } - System::httpExit($e->getCode(), $e->httpdesc, $content); + System::httpExit($e->getCode(), $e->getDescription(), $content); } /** @@ -86,10 +86,10 @@ class HTTPException */ public static function content(\Friendica\Network\HTTPException $e) { - header($_SERVER["SERVER_PROTOCOL"] . ' ' . $e->getCode() . ' ' . $e->httpdesc); + header($_SERVER["SERVER_PROTOCOL"] . ' ' . $e->getCode() . ' ' . $e->getDescription()); if ($e->getCode() >= 400) { - Logger::debug('Exit with error', ['code' => $e->getCode(), 'description' => $e->httpdesc, 'query' => DI::args()->getQueryString(), 'callstack' => System::callstack(20), 'method' => $_SERVER['REQUEST_METHOD'], 'agent' => $_SERVER['HTTP_USER_AGENT'] ?? '']); + Logger::debug('Exit with error', ['code' => $e->getCode(), 'description' => $e->getDescription(), 'query' => DI::args()->getQueryString(), 'callstack' => System::callstack(20), 'method' => $_SERVER['REQUEST_METHOD'], 'agent' => $_SERVER['HTTP_USER_AGENT'] ?? '']); } $tpl = Renderer::getMarkupTemplate('exception.tpl'); diff --git a/src/Network/HTTPException.php b/src/Network/HTTPException.php index 1ca6bd36df..a0cdcdf6af 100644 --- a/src/Network/HTTPException.php +++ b/src/Network/HTTPException.php @@ -31,11 +31,21 @@ use Exception; */ abstract class HTTPException extends Exception { - public $httpdesc = ''; - public $explanation = ''; + protected $httpdesc = ''; + protected $explanation = ''; public function __construct($message = '', Exception $previous = null) { parent::__construct($message, $this->code, $previous); } + + public function getDescription() + { + return $this->httpdesc; + } + + public function getExplanation() + { + return $this->explanation; + } } diff --git a/src/Network/HTTPException/AcceptedException.php b/src/Network/HTTPException/AcceptedException.php index e7a8e5a3e0..3c42802ed7 100644 --- a/src/Network/HTTPException/AcceptedException.php +++ b/src/Network/HTTPException/AcceptedException.php @@ -25,6 +25,6 @@ use Friendica\Network\HTTPException; class AcceptedException extends HTTPException { - protected $code = 202; - var $httpdesc = 'Accepted'; + protected $code = 202; + protected $httpdesc = 'Accepted'; } diff --git a/src/Network/HTTPException/BadGatewayException.php b/src/Network/HTTPException/BadGatewayException.php index d2f6c3fbeb..c80202a41a 100644 --- a/src/Network/HTTPException/BadGatewayException.php +++ b/src/Network/HTTPException/BadGatewayException.php @@ -25,7 +25,7 @@ use Friendica\Network\HTTPException; class BadGatewayException extends HTTPException { - protected $code = 502; - var $httpdesc = 'Bad Gateway'; - var $explanation = 'The server was acting as a gateway or proxy and received an invalid response from the upstream server.'; + protected $code = 502; + protected $httpdesc = 'Bad Gateway'; + protected $explanation = 'The server was acting as a gateway or proxy and received an invalid response from the upstream server.'; } diff --git a/src/Network/HTTPException/BadRequestException.php b/src/Network/HTTPException/BadRequestException.php index c2fe816afc..fef39c1c16 100644 --- a/src/Network/HTTPException/BadRequestException.php +++ b/src/Network/HTTPException/BadRequestException.php @@ -25,7 +25,7 @@ use Friendica\Network\HTTPException; class BadRequestException extends HTTPException { - protected $code = 400; - var $httpdesc = 'Bad Request'; - var $explanation = 'The server cannot or will not process the request due to an apparent client error.'; + protected $code = 400; + protected $httpdesc = 'Bad Request'; + protected $explanation = 'The server cannot or will not process the request due to an apparent client error.'; } diff --git a/src/Network/HTTPException/ConflictException.php b/src/Network/HTTPException/ConflictException.php index 01cfc8dce0..2f7a892e25 100644 --- a/src/Network/HTTPException/ConflictException.php +++ b/src/Network/HTTPException/ConflictException.php @@ -25,7 +25,7 @@ use Friendica\Network\HTTPException; class ConflictException extends HTTPException { - protected $code = 409; - var $httpdesc = 'Conflict '; - var $explanation = 'Indicates that the request could not be processed because of conflict in the current state of the resource, such as an edit conflict between multiple simultaneous updates.'; + protected $code = 409; + protected $httpdesc = 'Conflict '; + protected $explanation = 'Indicates that the request could not be processed because of conflict in the current state of the resource, such as an edit conflict between multiple simultaneous updates.'; } diff --git a/src/Network/HTTPException/ExpectationFailedException.php b/src/Network/HTTPException/ExpectationFailedException.php index 9ae58bcc81..5c1bc6ab7f 100644 --- a/src/Network/HTTPException/ExpectationFailedException.php +++ b/src/Network/HTTPException/ExpectationFailedException.php @@ -25,7 +25,7 @@ use Friendica\Network\HTTPException; class ExpectationFailedException extends HTTPException { - protected $code = 417; - var $httpdesc = 'Expectation Failed'; - var $explanation = 'The server cannot meet the requirements of the Expect request-header field.'; + protected $code = 417; + protected $httpdesc = 'Expectation Failed'; + protected $explanation = 'The server cannot meet the requirements of the Expect request-header field.'; } diff --git a/src/Network/HTTPException/ForbiddenException.php b/src/Network/HTTPException/ForbiddenException.php index a1dafa9a5b..2d65987064 100644 --- a/src/Network/HTTPException/ForbiddenException.php +++ b/src/Network/HTTPException/ForbiddenException.php @@ -25,7 +25,7 @@ use Friendica\Network\HTTPException; class ForbiddenException extends HTTPException { - protected $code = 403; - var $httpdesc = 'Forbidden'; - var $explanation = 'The request was valid, but the server is refusing action. The user might not have the necessary permissions for a resource, or may need an account.'; + protected $code = 403; + protected $httpdesc = 'Forbidden'; + protected $explanation = 'The request was valid, but the server is refusing action. The user might not have the necessary permissions for a resource, or may need an account.'; } diff --git a/src/Network/HTTPException/FoundException.php b/src/Network/HTTPException/FoundException.php index c60a5f8c83..8fcaceb773 100644 --- a/src/Network/HTTPException/FoundException.php +++ b/src/Network/HTTPException/FoundException.php @@ -25,6 +25,6 @@ use Friendica\Network\HTTPException; class FoundException extends HTTPException { - protected $code = 302; - var $httpdesc = 'Found (Moved Temporarily)'; + protected $code = 302; + protected $httpdesc = 'Found (Moved Temporarily)'; } diff --git a/src/Network/HTTPException/GatewayTimeoutException.php b/src/Network/HTTPException/GatewayTimeoutException.php index 2f674b2dcd..695616f0d7 100644 --- a/src/Network/HTTPException/GatewayTimeoutException.php +++ b/src/Network/HTTPException/GatewayTimeoutException.php @@ -25,7 +25,7 @@ use Friendica\Network\HTTPException; class GatewayTimeoutException extends HTTPException { - protected $code = 504; - var $httpdesc = 'Gateway Timeout'; - var $explanation = 'The server was acting as a gateway or proxy and did not receive a timely response from the upstream server.'; + protected $code = 504; + protected $httpdesc = 'Gateway Timeout'; + protected $explanation = 'The server was acting as a gateway or proxy and did not receive a timely response from the upstream server.'; } diff --git a/src/Network/HTTPException/GoneException.php b/src/Network/HTTPException/GoneException.php index 73eedcb671..400bbc23e4 100644 --- a/src/Network/HTTPException/GoneException.php +++ b/src/Network/HTTPException/GoneException.php @@ -25,7 +25,7 @@ use Friendica\Network\HTTPException; class GoneException extends HTTPException { - protected $code = 410; - var $httpdesc = 'Gone'; - var $explanation = 'Indicates that the resource requested is no longer available and will not be available again.'; + protected $code = 410; + protected $httpdesc = 'Gone'; + protected $explanation = 'Indicates that the resource requested is no longer available and will not be available again.'; } diff --git a/src/Network/HTTPException/ImATeapotException.php b/src/Network/HTTPException/ImATeapotException.php index dcfd72de04..33f7a641b2 100644 --- a/src/Network/HTTPException/ImATeapotException.php +++ b/src/Network/HTTPException/ImATeapotException.php @@ -25,7 +25,7 @@ use Friendica\Network\HTTPException; class ImATeapotException extends HTTPException { - protected $code = 418; - var $httpdesc = "I'm A Teapot"; - var $explanation = 'This is a teapot that is requested to brew coffee.'; + protected $code = 418; + protected $httpdesc = "I'm A Teapot"; + protected $explanation = 'This is a teapot that is requested to brew coffee.'; } diff --git a/src/Network/HTTPException/InternalServerErrorException.php b/src/Network/HTTPException/InternalServerErrorException.php index d5df8fdd3a..4638d5c849 100644 --- a/src/Network/HTTPException/InternalServerErrorException.php +++ b/src/Network/HTTPException/InternalServerErrorException.php @@ -25,7 +25,7 @@ use Friendica\Network\HTTPException; class InternalServerErrorException extends HTTPException { - protected $code = 500; - var $httpdesc = 'Internal Server Error'; - var $explanation = 'An unexpected condition was encountered and no more specific message is suitable.'; + protected $code = 500; + protected $httpdesc = 'Internal Server Error'; + protected $explanation = 'An unexpected condition was encountered and no more specific message is suitable.'; } diff --git a/src/Network/HTTPException/LenghtRequiredException.php b/src/Network/HTTPException/LenghtRequiredException.php index 3818f681ae..dd0c02f8d7 100644 --- a/src/Network/HTTPException/LenghtRequiredException.php +++ b/src/Network/HTTPException/LenghtRequiredException.php @@ -25,7 +25,7 @@ use Friendica\Network\HTTPException; class LenghtRequiredException extends HTTPException { - protected $code = 411; - var $httpdesc = 'Length Required'; - var $explanation = 'The request did not specify the length of its content, which is required by the requested resource.'; + protected $code = 411; + protected $httpdesc = 'Length Required'; + protected $explanation = 'The request did not specify the length of its content, which is required by the requested resource.'; } diff --git a/src/Network/HTTPException/MethodNotAllowedException.php b/src/Network/HTTPException/MethodNotAllowedException.php index d09c0fe318..03841e5e5f 100644 --- a/src/Network/HTTPException/MethodNotAllowedException.php +++ b/src/Network/HTTPException/MethodNotAllowedException.php @@ -25,7 +25,7 @@ use Friendica\Network\HTTPException; class MethodNotAllowedException extends HTTPException { - protected $code = 405; - var $httpdesc = 'Method Not Allowed'; - var $explanation = 'A request method is not supported for the requested resource; for example, a GET request on a form that requires data to be presented via POST, or a PUT request on a read-only resource.'; + protected $code = 405; + protected $httpdesc = 'Method Not Allowed'; + protected $explanation = 'A request method is not supported for the requested resource; for example, a GET request on a form that requires data to be presented via POST, or a PUT request on a read-only resource.'; } diff --git a/src/Network/HTTPException/MovedPermanently.php b/src/Network/HTTPException/MovedPermanently.php index ef78f87bd6..7ded3847a3 100644 --- a/src/Network/HTTPException/MovedPermanently.php +++ b/src/Network/HTTPException/MovedPermanently.php @@ -25,6 +25,6 @@ use Friendica\Network\HTTPException; class MovedPermanentlyException extends HTTPException { - protected $code = 301; - var $httpdesc = 'Moved Permanently'; + protected $code = 301; + protected $httpdesc = 'Moved Permanently'; } diff --git a/src/Network/HTTPException/NoContentException.php b/src/Network/HTTPException/NoContentException.php index 90d9d2ae6a..f652b66211 100644 --- a/src/Network/HTTPException/NoContentException.php +++ b/src/Network/HTTPException/NoContentException.php @@ -25,6 +25,6 @@ use Friendica\Network\HTTPException; class NoContentException extends HTTPException { - protected $code = 204; - var $httpdesc = 'No Content'; + protected $code = 204; + protected $httpdesc = 'No Content'; } diff --git a/src/Network/HTTPException/NonAcceptableException.php b/src/Network/HTTPException/NonAcceptableException.php index c9811ddb79..3b1c1538af 100644 --- a/src/Network/HTTPException/NonAcceptableException.php +++ b/src/Network/HTTPException/NonAcceptableException.php @@ -25,7 +25,7 @@ use Friendica\Network\HTTPException; class NonAcceptableException extends HTTPException { - protected $code = 406; - var $httpdesc = 'Not Acceptable'; - var $explanation = 'The requested resource is capable of generating only content not acceptable according to the Accept headers sent in the request.'; + protected $code = 406; + protected $httpdesc = 'Not Acceptable'; + protected $explanation = 'The requested resource is capable of generating only content not acceptable according to the Accept headers sent in the request.'; } diff --git a/src/Network/HTTPException/NotFoundException.php b/src/Network/HTTPException/NotFoundException.php index 9acc32031d..33731bd1c1 100644 --- a/src/Network/HTTPException/NotFoundException.php +++ b/src/Network/HTTPException/NotFoundException.php @@ -25,7 +25,7 @@ use Friendica\Network\HTTPException; class NotFoundException extends HTTPException { - protected $code = 404; - var $httpdesc = 'Not Found'; - var $explanation = 'The requested resource could not be found but may be available in the future.'; + protected $code = 404; + protected $httpdesc = 'Not Found'; + protected $explanation = 'The requested resource could not be found but may be available in the future.'; } diff --git a/src/Network/HTTPException/NotImplementedException.php b/src/Network/HTTPException/NotImplementedException.php index 6c2d1e25e6..94e7af0916 100644 --- a/src/Network/HTTPException/NotImplementedException.php +++ b/src/Network/HTTPException/NotImplementedException.php @@ -25,7 +25,7 @@ use Friendica\Network\HTTPException; class NotImplementedException extends HTTPException { - protected $code = 501; - var $httpdesc = 'Not Implemented'; - var $explanation = 'The server either does not recognize the request method, or it lacks the ability to fulfil the request. Usually this implies future availability (e.g., a new feature of a web-service API).'; + protected $code = 501; + protected $httpdesc = 'Not Implemented'; + protected $explanation = 'The server either does not recognize the request method, or it lacks the ability to fulfil the request. Usually this implies future availability (e.g., a new feature of a web-service API).'; } diff --git a/src/Network/HTTPException/NotModifiedException.php b/src/Network/HTTPException/NotModifiedException.php index 431b2096a3..9bdec60f08 100644 --- a/src/Network/HTTPException/NotModifiedException.php +++ b/src/Network/HTTPException/NotModifiedException.php @@ -25,6 +25,6 @@ use Friendica\Network\HTTPException; class NotModifiedException extends HTTPException { - protected $code = 304; - var $httpdesc = 'Not Modified'; + protected $code = 304; + protected $httpdesc = 'Not Modified'; } diff --git a/src/Network/HTTPException/OKException.php b/src/Network/HTTPException/OKException.php index e4b409ce0f..5daa199a94 100644 --- a/src/Network/HTTPException/OKException.php +++ b/src/Network/HTTPException/OKException.php @@ -25,6 +25,6 @@ use Friendica\Network\HTTPException; class OKException extends HTTPException { - protected $code = 200; - var $httpdesc = 'OK'; + protected $code = 200; + protected $httpdesc = 'OK'; } diff --git a/src/Network/HTTPException/PreconditionFailedException.php b/src/Network/HTTPException/PreconditionFailedException.php index fe4ebcb123..7a62ca7d56 100644 --- a/src/Network/HTTPException/PreconditionFailedException.php +++ b/src/Network/HTTPException/PreconditionFailedException.php @@ -25,7 +25,7 @@ use Friendica\Network\HTTPException; class PreconditionFailedException extends HTTPException { - protected $code = 412; - var $httpdesc = 'Precondition Failed'; - var $explanation = 'The server does not meet one of the preconditions that the requester put on the request header fields.'; + protected $code = 412; + protected $httpdesc = 'Precondition Failed'; + protected $explanation = 'The server does not meet one of the preconditions that the requester put on the request header fields.'; } diff --git a/src/Network/HTTPException/ServiceUnavailableException.php b/src/Network/HTTPException/ServiceUnavailableException.php index a88390e6a7..d520a9df0f 100644 --- a/src/Network/HTTPException/ServiceUnavailableException.php +++ b/src/Network/HTTPException/ServiceUnavailableException.php @@ -25,7 +25,7 @@ use Friendica\Network\HTTPException; class ServiceUnavailableException extends HTTPException { - protected $code = 503; - var $httpdesc = 'Service Unavailable'; - var $explanation = 'The server is currently unavailable (because it is overloaded or down for maintenance). Please try again later.'; + protected $code = 503; + protected $httpdesc = 'Service Unavailable'; + protected $explanation = 'The server is currently unavailable (because it is overloaded or down for maintenance). Please try again later.'; } diff --git a/src/Network/HTTPException/TemporaryRedirectException.php b/src/Network/HTTPException/TemporaryRedirectException.php index cae4be7281..008e3798ce 100644 --- a/src/Network/HTTPException/TemporaryRedirectException.php +++ b/src/Network/HTTPException/TemporaryRedirectException.php @@ -25,6 +25,6 @@ use Friendica\Network\HTTPException; class TemporaryRedirectException extends HTTPException { - protected $code = 307; - var $httpdesc = 'Temporary Redirect'; + protected $code = 307; + protected $httpdesc = 'Temporary Redirect'; } diff --git a/src/Network/HTTPException/TooManyRequestsException.php b/src/Network/HTTPException/TooManyRequestsException.php index c94679af72..0861aaefc7 100644 --- a/src/Network/HTTPException/TooManyRequestsException.php +++ b/src/Network/HTTPException/TooManyRequestsException.php @@ -25,7 +25,7 @@ use Friendica\Network\HTTPException; class TooManyRequestsException extends HTTPException { - protected $code = 429; - var $httpdesc = 'Too Many Requests'; - var $explanation = 'The user has sent too many requests in a given amount of time.'; + protected $code = 429; + protected $httpdesc = 'Too Many Requests'; + protected $explanation = 'The user has sent too many requests in a given amount of time.'; } diff --git a/src/Network/HTTPException/UnauthorizedException.php b/src/Network/HTTPException/UnauthorizedException.php index ad6adfd423..4bb2e86285 100644 --- a/src/Network/HTTPException/UnauthorizedException.php +++ b/src/Network/HTTPException/UnauthorizedException.php @@ -25,7 +25,7 @@ use Friendica\Network\HTTPException; class UnauthorizedException extends HTTPException { - protected $code = 401; - var $httpdesc = 'Unauthorized'; - var $explanation = 'Authentication is required and has failed or has not yet been provided.'; + protected $code = 401; + protected $httpdesc = 'Unauthorized'; + protected $explanation = 'Authentication is required and has failed or has not yet been provided.'; } diff --git a/src/Network/HTTPException/UnprocessableEntityException.php b/src/Network/HTTPException/UnprocessableEntityException.php index 29b0d3158e..9c78b73770 100644 --- a/src/Network/HTTPException/UnprocessableEntityException.php +++ b/src/Network/HTTPException/UnprocessableEntityException.php @@ -25,7 +25,7 @@ use Friendica\Network\HTTPException; class UnprocessableEntityException extends HTTPException { - protected $code = 422; - var $httpdesc = 'Unprocessable Entity'; - var $explanation = 'The request was well-formed but was unable to be followed due to semantic errors.'; + protected $code = 422; + protected $httpdesc = 'Unprocessable Entity'; + protected $explanation = 'The request was well-formed but was unable to be followed due to semantic errors.'; } diff --git a/src/Network/HTTPException/UnsupportedMediaTypeException.php b/src/Network/HTTPException/UnsupportedMediaTypeException.php index adf008d015..fad8d9f7e7 100644 --- a/src/Network/HTTPException/UnsupportedMediaTypeException.php +++ b/src/Network/HTTPException/UnsupportedMediaTypeException.php @@ -25,7 +25,7 @@ use Friendica\Network\HTTPException; class UnsupportedMediaTypeException extends HTTPException { - protected $code = 415; - var $httpdesc = 'Unsupported Media Type'; - var $explanation = 'The request entity has a media type which the server or resource does not support. For example, the client uploads an image as image/svg+xml, but the server requires that images use a different format.'; + protected $code = 415; + protected $httpdesc = 'Unsupported Media Type'; + protected $explanation = 'The request entity has a media type which the server or resource does not support. For example, the client uploads an image as image/svg+xml, but the server requires that images use a different format.'; }