@@ -112,7 +112,7 @@ |
||
112 | 112 | |
113 | 113 | $map = static::getMap(); |
114 | 114 | |
115 | - return $map[ $api_code ] ?? null; |
|
115 | + return $map[$api_code] ?? null; |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | /** |
@@ -10,56 +10,56 @@ |
||
10 | 10 | */ |
11 | 11 | return [ |
12 | 12 | |
13 | - 'ok' => 'موفق', |
|
14 | - 'no_error_message' => 'خطای شماره :api_code', |
|
13 | + 'ok' => 'موفق', |
|
14 | + 'no_error_message' => 'خطای شماره :api_code', |
|
15 | 15 | |
16 | - // can be used by Exception Handler (if enabled) |
|
17 | - 'uncaught_exception' => 'استثناء مدیریت نشده :message', |
|
18 | - // we talking API call here, hence we have http_not_found |
|
19 | - 'http_exception' => 'استثناء HTTP :message', |
|
16 | + // can be used by Exception Handler (if enabled) |
|
17 | + 'uncaught_exception' => 'استثناء مدیریت نشده :message', |
|
18 | + // we talking API call here, hence we have http_not_found |
|
19 | + 'http_exception' => 'استثناء HTTP :message', |
|
20 | 20 | |
21 | - // HttpException handler (added in 6.4.0) |
|
22 | - // Error messages for HttpException caught w/o custom messages |
|
23 | - // https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml |
|
24 | - 'http_400' => 'Bad Request', |
|
25 | - 'http_401' => 'اجازه دسترسی ندارید', |
|
26 | - 'http_402' => 'Payment Required', |
|
27 | - 'http_403' => 'Forbidden', |
|
28 | - 'http_404' => 'Not Found', |
|
29 | - 'http_405' => 'Method Not Allowed', |
|
30 | - 'http_406' => 'Not Acceptable', |
|
31 | - 'http_407' => 'Proxy Authentication Required', |
|
32 | - 'http_408' => 'Request Timeout', |
|
33 | - 'http_409' => 'Conflict', |
|
34 | - 'http_410' => 'Gone', |
|
35 | - 'http_411' => 'Length Required', |
|
36 | - 'http_412' => 'Precondition Failed', |
|
37 | - 'http_413' => 'Payload Too Large', |
|
38 | - 'http_414' => 'URI Too Long', |
|
39 | - 'http_415' => 'Unsupported Media Type', |
|
40 | - 'http_416' => 'Range Not Satisfiable', |
|
41 | - 'http_417' => 'Expectation Failed', |
|
42 | - 'http_421' => 'Misdirected Request', |
|
43 | - 'http_422' => 'داده معتبر نیست', |
|
44 | - 'http_423' => 'Locked', |
|
45 | - 'http_424' => 'Failed Dependency', |
|
46 | - 'http_425' => 'Too Early', |
|
47 | - 'http_426' => 'Upgrade Required', |
|
48 | - 'http_428' => 'Precondition Required', |
|
49 | - 'http_429' => 'Too Many Requests', |
|
50 | - 'http_431' => 'Request Header Fields Too Large', |
|
51 | - 'http_451' => 'Unavailable For Legal Reasons', |
|
52 | - 'http_500' => 'Internal Server Error', |
|
53 | - 'http_501' => 'Not Implemented', |
|
54 | - 'http_502' => 'Bad Gateway', |
|
55 | - 'http_503' => 'Service Unavailable', |
|
56 | - 'http_504' => 'Gateway Timeout', |
|
57 | - 'http_505' => 'HTTP Version Not Supported', |
|
58 | - 'http_506' => 'Variant Also Negotiates', |
|
59 | - 'http_507' => 'Insufficient Storage', |
|
60 | - 'http_508' => 'Loop Detected', |
|
61 | - 'http_509' => 'Unassigned', |
|
62 | - 'http_510' => 'Not Extended', |
|
63 | - 'http_511' => 'Network Authentication Required', |
|
21 | + // HttpException handler (added in 6.4.0) |
|
22 | + // Error messages for HttpException caught w/o custom messages |
|
23 | + // https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml |
|
24 | + 'http_400' => 'Bad Request', |
|
25 | + 'http_401' => 'اجازه دسترسی ندارید', |
|
26 | + 'http_402' => 'Payment Required', |
|
27 | + 'http_403' => 'Forbidden', |
|
28 | + 'http_404' => 'Not Found', |
|
29 | + 'http_405' => 'Method Not Allowed', |
|
30 | + 'http_406' => 'Not Acceptable', |
|
31 | + 'http_407' => 'Proxy Authentication Required', |
|
32 | + 'http_408' => 'Request Timeout', |
|
33 | + 'http_409' => 'Conflict', |
|
34 | + 'http_410' => 'Gone', |
|
35 | + 'http_411' => 'Length Required', |
|
36 | + 'http_412' => 'Precondition Failed', |
|
37 | + 'http_413' => 'Payload Too Large', |
|
38 | + 'http_414' => 'URI Too Long', |
|
39 | + 'http_415' => 'Unsupported Media Type', |
|
40 | + 'http_416' => 'Range Not Satisfiable', |
|
41 | + 'http_417' => 'Expectation Failed', |
|
42 | + 'http_421' => 'Misdirected Request', |
|
43 | + 'http_422' => 'داده معتبر نیست', |
|
44 | + 'http_423' => 'Locked', |
|
45 | + 'http_424' => 'Failed Dependency', |
|
46 | + 'http_425' => 'Too Early', |
|
47 | + 'http_426' => 'Upgrade Required', |
|
48 | + 'http_428' => 'Precondition Required', |
|
49 | + 'http_429' => 'Too Many Requests', |
|
50 | + 'http_431' => 'Request Header Fields Too Large', |
|
51 | + 'http_451' => 'Unavailable For Legal Reasons', |
|
52 | + 'http_500' => 'Internal Server Error', |
|
53 | + 'http_501' => 'Not Implemented', |
|
54 | + 'http_502' => 'Bad Gateway', |
|
55 | + 'http_503' => 'Service Unavailable', |
|
56 | + 'http_504' => 'Gateway Timeout', |
|
57 | + 'http_505' => 'HTTP Version Not Supported', |
|
58 | + 'http_506' => 'Variant Also Negotiates', |
|
59 | + 'http_507' => 'Insufficient Storage', |
|
60 | + 'http_508' => 'Loop Detected', |
|
61 | + 'http_509' => 'Unassigned', |
|
62 | + 'http_510' => 'Not Extended', |
|
63 | + 'http_511' => 'Network Authentication Required', |
|
64 | 64 | ]; |
65 | 65 |
@@ -21,172 +21,172 @@ |
||
21 | 21 | */ |
22 | 22 | class BaseApiCodes |
23 | 23 | { |
24 | - use ApiCodesHelpers; |
|
25 | - |
|
26 | - /** |
|
27 | - * protected code range - lowest code for reserved range. |
|
28 | - * |
|
29 | - * @var int |
|
30 | - */ |
|
31 | - public const RESERVED_MIN_API_CODE_OFFSET = 0; |
|
32 | - |
|
33 | - /** |
|
34 | - * protected code range - highest code for reserved range |
|
35 | - * |
|
36 | - * @var int |
|
37 | - */ |
|
38 | - public const RESERVED_MAX_API_CODE_OFFSET = 19; |
|
39 | - |
|
40 | - /** |
|
41 | - * built-in codes: OK |
|
42 | - * |
|
43 | - * @var int |
|
44 | - */ |
|
45 | - protected const OK_OFFSET = 0; |
|
46 | - /** |
|
47 | - * built-in code for fallback message mapping |
|
48 | - * |
|
49 | - * @var int |
|
50 | - */ |
|
51 | - protected const NO_ERROR_MESSAGE_OFFSET = 1; |
|
52 | - /** |
|
53 | - * built-in error code for HTTP_NOT_FOUND exception |
|
54 | - * |
|
55 | - * @var int |
|
56 | - */ |
|
57 | - protected const EX_HTTP_NOT_FOUND_OFFSET = 10; |
|
58 | - /** |
|
59 | - * built-in error code for HTTP_SERVICE_UNAVAILABLE exception |
|
60 | - * |
|
61 | - * @var int |
|
62 | - */ |
|
63 | - protected const EX_HTTP_SERVICE_UNAVAILABLE_OFFSET = 11; |
|
64 | - /** |
|
65 | - * built-in error code for HTTP_EXCEPTION |
|
66 | - * |
|
67 | - * @var int |
|
68 | - */ |
|
69 | - protected const EX_HTTP_EXCEPTION_OFFSET = 12; |
|
70 | - /** |
|
71 | - * built-in error code for UNCAUGHT_EXCEPTION |
|
72 | - * |
|
73 | - * @var int |
|
74 | - */ |
|
75 | - protected const EX_UNCAUGHT_EXCEPTION_OFFSET = 13; |
|
76 | - |
|
77 | - /** |
|
78 | - * built-in error code for \Illuminate\Auth\AuthenticationException |
|
79 | - * |
|
80 | - * @var int |
|
81 | - */ |
|
82 | - protected const EX_AUTHENTICATION_EXCEPTION_OFFSET = 14; |
|
83 | - |
|
84 | - /** |
|
85 | - * built-in error code for \Illuminate\Auth\AuthenticationException |
|
86 | - * |
|
87 | - * @var int |
|
88 | - */ |
|
89 | - protected const EX_VALIDATION_EXCEPTION_OFFSET = 15; |
|
90 | - |
|
91 | - /** |
|
92 | - * Returns base code mapping array |
|
93 | - * |
|
94 | - * @return array |
|
95 | - */ |
|
96 | - protected static function getBaseMap(): array |
|
97 | - { |
|
98 | - $tpl = 'response-builder::builder.http_%d'; |
|
99 | - |
|
100 | - return [ |
|
101 | - self::OK() => 'response-builder::builder.ok', |
|
102 | - self::NO_ERROR_MESSAGE() => 'response-builder::builder.no_error_message', |
|
103 | - self::EX_HTTP_EXCEPTION() => 'response-builder::builder.http_exception', |
|
104 | - self::EX_UNCAUGHT_EXCEPTION() => 'response-builder::builder.uncaught_exception', |
|
105 | - self::EX_HTTP_NOT_FOUND() => sprintf($tpl, HttpResponse::HTTP_NOT_FOUND), |
|
106 | - self::EX_HTTP_SERVICE_UNAVAILABLE() => sprintf($tpl, HttpResponse::HTTP_SERVICE_UNAVAILABLE), |
|
107 | - self::EX_AUTHENTICATION_EXCEPTION() => sprintf($tpl, HttpResponse::HTTP_UNAUTHORIZED), |
|
108 | - self::EX_VALIDATION_EXCEPTION() => sprintf($tpl, HttpResponse::HTTP_UNPROCESSABLE_ENTITY), |
|
109 | - ]; |
|
110 | - } |
|
111 | - |
|
112 | - /** |
|
113 | - * Returns API code for internal code OK |
|
114 | - * |
|
115 | - * @return int valid API code in current range |
|
116 | - */ |
|
117 | - public static function OK(): int |
|
118 | - { |
|
119 | - return static::getCodeForInternalOffset(static::OK_OFFSET); |
|
120 | - } |
|
121 | - |
|
122 | - /** |
|
123 | - * Returns API code for internal code NO_ERROR_MESSAGE |
|
124 | - * |
|
125 | - * @return int valid API code in current range |
|
126 | - */ |
|
127 | - public static function NO_ERROR_MESSAGE(): int |
|
128 | - { |
|
129 | - return static::getCodeForInternalOffset(static::NO_ERROR_MESSAGE_OFFSET); |
|
130 | - } |
|
131 | - |
|
132 | - /** |
|
133 | - * Returns API code for internal code EX_HTTP_NOT_FOUND |
|
134 | - * |
|
135 | - * @return int valid API code in current range |
|
136 | - */ |
|
137 | - public static function EX_HTTP_NOT_FOUND(): int |
|
138 | - { |
|
139 | - return static::getCodeForInternalOffset(static::EX_HTTP_NOT_FOUND_OFFSET); |
|
140 | - } |
|
141 | - |
|
142 | - /** |
|
143 | - * Returns API code for internal code EX_HTTP_EXCEPTION |
|
144 | - * |
|
145 | - * @return int valid API code in current range |
|
146 | - */ |
|
147 | - public static function EX_HTTP_EXCEPTION(): int |
|
148 | - { |
|
149 | - return static::getCodeForInternalOffset(static::EX_HTTP_EXCEPTION_OFFSET); |
|
150 | - } |
|
151 | - |
|
152 | - /** |
|
153 | - * Returns API code for internal code EX_UNCAUGHT_EXCEPTION |
|
154 | - * |
|
155 | - * @return int valid API code in current range |
|
156 | - */ |
|
157 | - public static function EX_UNCAUGHT_EXCEPTION(): int |
|
158 | - { |
|
159 | - return static::getCodeForInternalOffset(static::EX_UNCAUGHT_EXCEPTION_OFFSET); |
|
160 | - } |
|
161 | - |
|
162 | - /** |
|
163 | - * Returns API code for internal code EX_AUTHENTICATION_EXCEPTION |
|
164 | - * |
|
165 | - * @return int valid API code in current range |
|
166 | - */ |
|
167 | - public static function EX_AUTHENTICATION_EXCEPTION(): int |
|
168 | - { |
|
169 | - return static::getCodeForInternalOffset(static::EX_AUTHENTICATION_EXCEPTION_OFFSET); |
|
170 | - } |
|
171 | - |
|
172 | - /** |
|
173 | - * Returns API code for internal code EX_VALIDATION_EXCEPTION |
|
174 | - * |
|
175 | - * @return int valid API code in current range |
|
176 | - */ |
|
177 | - public static function EX_VALIDATION_EXCEPTION(): int |
|
178 | - { |
|
179 | - return static::getCodeForInternalOffset(static::EX_VALIDATION_EXCEPTION_OFFSET); |
|
180 | - } |
|
181 | - |
|
182 | - /** |
|
183 | - * Returns API code for internal code EX_HTTP_SERVICE_UNAVAILABLE |
|
184 | - * |
|
185 | - * @return int valid API code in current range |
|
186 | - */ |
|
187 | - public static function EX_HTTP_SERVICE_UNAVAILABLE(): int |
|
188 | - { |
|
189 | - return static::getCodeForInternalOffset(static::EX_HTTP_SERVICE_UNAVAILABLE_OFFSET); |
|
190 | - } |
|
24 | + use ApiCodesHelpers; |
|
25 | + |
|
26 | + /** |
|
27 | + * protected code range - lowest code for reserved range. |
|
28 | + * |
|
29 | + * @var int |
|
30 | + */ |
|
31 | + public const RESERVED_MIN_API_CODE_OFFSET = 0; |
|
32 | + |
|
33 | + /** |
|
34 | + * protected code range - highest code for reserved range |
|
35 | + * |
|
36 | + * @var int |
|
37 | + */ |
|
38 | + public const RESERVED_MAX_API_CODE_OFFSET = 19; |
|
39 | + |
|
40 | + /** |
|
41 | + * built-in codes: OK |
|
42 | + * |
|
43 | + * @var int |
|
44 | + */ |
|
45 | + protected const OK_OFFSET = 0; |
|
46 | + /** |
|
47 | + * built-in code for fallback message mapping |
|
48 | + * |
|
49 | + * @var int |
|
50 | + */ |
|
51 | + protected const NO_ERROR_MESSAGE_OFFSET = 1; |
|
52 | + /** |
|
53 | + * built-in error code for HTTP_NOT_FOUND exception |
|
54 | + * |
|
55 | + * @var int |
|
56 | + */ |
|
57 | + protected const EX_HTTP_NOT_FOUND_OFFSET = 10; |
|
58 | + /** |
|
59 | + * built-in error code for HTTP_SERVICE_UNAVAILABLE exception |
|
60 | + * |
|
61 | + * @var int |
|
62 | + */ |
|
63 | + protected const EX_HTTP_SERVICE_UNAVAILABLE_OFFSET = 11; |
|
64 | + /** |
|
65 | + * built-in error code for HTTP_EXCEPTION |
|
66 | + * |
|
67 | + * @var int |
|
68 | + */ |
|
69 | + protected const EX_HTTP_EXCEPTION_OFFSET = 12; |
|
70 | + /** |
|
71 | + * built-in error code for UNCAUGHT_EXCEPTION |
|
72 | + * |
|
73 | + * @var int |
|
74 | + */ |
|
75 | + protected const EX_UNCAUGHT_EXCEPTION_OFFSET = 13; |
|
76 | + |
|
77 | + /** |
|
78 | + * built-in error code for \Illuminate\Auth\AuthenticationException |
|
79 | + * |
|
80 | + * @var int |
|
81 | + */ |
|
82 | + protected const EX_AUTHENTICATION_EXCEPTION_OFFSET = 14; |
|
83 | + |
|
84 | + /** |
|
85 | + * built-in error code for \Illuminate\Auth\AuthenticationException |
|
86 | + * |
|
87 | + * @var int |
|
88 | + */ |
|
89 | + protected const EX_VALIDATION_EXCEPTION_OFFSET = 15; |
|
90 | + |
|
91 | + /** |
|
92 | + * Returns base code mapping array |
|
93 | + * |
|
94 | + * @return array |
|
95 | + */ |
|
96 | + protected static function getBaseMap(): array |
|
97 | + { |
|
98 | + $tpl = 'response-builder::builder.http_%d'; |
|
99 | + |
|
100 | + return [ |
|
101 | + self::OK() => 'response-builder::builder.ok', |
|
102 | + self::NO_ERROR_MESSAGE() => 'response-builder::builder.no_error_message', |
|
103 | + self::EX_HTTP_EXCEPTION() => 'response-builder::builder.http_exception', |
|
104 | + self::EX_UNCAUGHT_EXCEPTION() => 'response-builder::builder.uncaught_exception', |
|
105 | + self::EX_HTTP_NOT_FOUND() => sprintf($tpl, HttpResponse::HTTP_NOT_FOUND), |
|
106 | + self::EX_HTTP_SERVICE_UNAVAILABLE() => sprintf($tpl, HttpResponse::HTTP_SERVICE_UNAVAILABLE), |
|
107 | + self::EX_AUTHENTICATION_EXCEPTION() => sprintf($tpl, HttpResponse::HTTP_UNAUTHORIZED), |
|
108 | + self::EX_VALIDATION_EXCEPTION() => sprintf($tpl, HttpResponse::HTTP_UNPROCESSABLE_ENTITY), |
|
109 | + ]; |
|
110 | + } |
|
111 | + |
|
112 | + /** |
|
113 | + * Returns API code for internal code OK |
|
114 | + * |
|
115 | + * @return int valid API code in current range |
|
116 | + */ |
|
117 | + public static function OK(): int |
|
118 | + { |
|
119 | + return static::getCodeForInternalOffset(static::OK_OFFSET); |
|
120 | + } |
|
121 | + |
|
122 | + /** |
|
123 | + * Returns API code for internal code NO_ERROR_MESSAGE |
|
124 | + * |
|
125 | + * @return int valid API code in current range |
|
126 | + */ |
|
127 | + public static function NO_ERROR_MESSAGE(): int |
|
128 | + { |
|
129 | + return static::getCodeForInternalOffset(static::NO_ERROR_MESSAGE_OFFSET); |
|
130 | + } |
|
131 | + |
|
132 | + /** |
|
133 | + * Returns API code for internal code EX_HTTP_NOT_FOUND |
|
134 | + * |
|
135 | + * @return int valid API code in current range |
|
136 | + */ |
|
137 | + public static function EX_HTTP_NOT_FOUND(): int |
|
138 | + { |
|
139 | + return static::getCodeForInternalOffset(static::EX_HTTP_NOT_FOUND_OFFSET); |
|
140 | + } |
|
141 | + |
|
142 | + /** |
|
143 | + * Returns API code for internal code EX_HTTP_EXCEPTION |
|
144 | + * |
|
145 | + * @return int valid API code in current range |
|
146 | + */ |
|
147 | + public static function EX_HTTP_EXCEPTION(): int |
|
148 | + { |
|
149 | + return static::getCodeForInternalOffset(static::EX_HTTP_EXCEPTION_OFFSET); |
|
150 | + } |
|
151 | + |
|
152 | + /** |
|
153 | + * Returns API code for internal code EX_UNCAUGHT_EXCEPTION |
|
154 | + * |
|
155 | + * @return int valid API code in current range |
|
156 | + */ |
|
157 | + public static function EX_UNCAUGHT_EXCEPTION(): int |
|
158 | + { |
|
159 | + return static::getCodeForInternalOffset(static::EX_UNCAUGHT_EXCEPTION_OFFSET); |
|
160 | + } |
|
161 | + |
|
162 | + /** |
|
163 | + * Returns API code for internal code EX_AUTHENTICATION_EXCEPTION |
|
164 | + * |
|
165 | + * @return int valid API code in current range |
|
166 | + */ |
|
167 | + public static function EX_AUTHENTICATION_EXCEPTION(): int |
|
168 | + { |
|
169 | + return static::getCodeForInternalOffset(static::EX_AUTHENTICATION_EXCEPTION_OFFSET); |
|
170 | + } |
|
171 | + |
|
172 | + /** |
|
173 | + * Returns API code for internal code EX_VALIDATION_EXCEPTION |
|
174 | + * |
|
175 | + * @return int valid API code in current range |
|
176 | + */ |
|
177 | + public static function EX_VALIDATION_EXCEPTION(): int |
|
178 | + { |
|
179 | + return static::getCodeForInternalOffset(static::EX_VALIDATION_EXCEPTION_OFFSET); |
|
180 | + } |
|
181 | + |
|
182 | + /** |
|
183 | + * Returns API code for internal code EX_HTTP_SERVICE_UNAVAILABLE |
|
184 | + * |
|
185 | + * @return int valid API code in current range |
|
186 | + */ |
|
187 | + public static function EX_HTTP_SERVICE_UNAVAILABLE(): int |
|
188 | + { |
|
189 | + return static::getCodeForInternalOffset(static::EX_HTTP_SERVICE_UNAVAILABLE_OFFSET); |
|
190 | + } |
|
191 | 191 | |
192 | 192 | } |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * @return \Symfony\Component\HttpFoundation\Response |
73 | 73 | */ |
74 | 74 | protected static function processException(\Exception $ex, array $ex_cfg, |
75 | - int $fallback_http_code = HttpResponse::HTTP_INTERNAL_SERVER_ERROR) |
|
75 | + int $fallback_http_code = HttpResponse::HTTP_INTERNAL_SERVER_ERROR) |
|
76 | 76 | { |
77 | 77 | $api_code = $ex_cfg['api_code']; |
78 | 78 | $http_code = $ex_cfg['http_code'] ?? $fallback_http_code; |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | * @return HttpResponse |
142 | 142 | */ |
143 | 143 | protected function unauthenticated(/** @scrutinizer ignore-unused */ $request, |
144 | - AuthException $exception): HttpResponse |
|
144 | + AuthException $exception): HttpResponse |
|
145 | 145 | { |
146 | 146 | $cfg = self::getExceptionHandlerConfig(); |
147 | 147 | |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | * @return HttpResponse |
163 | 163 | */ |
164 | 164 | protected static function error(Exception $ex, |
165 | - int $api_code, int $http_code = null, string $error_message = null): HttpResponse |
|
165 | + int $api_code, int $http_code = null, string $error_message = null): HttpResponse |
|
166 | 166 | { |
167 | 167 | $ex_http_code = ($ex instanceof HttpException) ? $ex->getStatusCode() : $ex->getCode(); |
168 | 168 | $http_code = $http_code ?? $ex_http_code; |
@@ -45,11 +45,11 @@ discard block |
||
45 | 45 | do { |
46 | 46 | if ($cfg === null) { |
47 | 47 | // Default handler MUST be present by design and always return something useful. |
48 | - $cfg = self::getExceptionHandlerConfig()[ RB::KEY_DEFAULT ]; |
|
48 | + $cfg = self::getExceptionHandlerConfig()[RB::KEY_DEFAULT]; |
|
49 | 49 | } |
50 | 50 | |
51 | - $handler = new $cfg[ RB::KEY_HANDLER ](); |
|
52 | - $handler_result = $handler->handle($cfg[ RB::KEY_CONFIG ], $ex); |
|
51 | + $handler = new $cfg[RB::KEY_HANDLER](); |
|
52 | + $handler_result = $handler->handle($cfg[RB::KEY_CONFIG], $ex); |
|
53 | 53 | if ($handler_result !== null) { |
54 | 54 | $result = self::processException($ex, $handler_result); |
55 | 55 | } else { |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | $cfg = self::getExceptionHandlerConfig(); |
148 | 148 | |
149 | 149 | // This config entry is guaranted to exist. Enforced by tests. |
150 | - $cfg = $cfg[ HttpException::class ][ RB::KEY_CONFIG ][ HttpResponse::HTTP_UNAUTHORIZED ]; |
|
150 | + $cfg = $cfg[HttpException::class][RB::KEY_CONFIG][HttpResponse::HTTP_UNAUTHORIZED]; |
|
151 | 151 | |
152 | 152 | return static::processException($exception, $cfg, HttpResponse::HTTP_UNAUTHORIZED); |
153 | 153 | } |
@@ -277,13 +277,13 @@ discard block |
||
277 | 277 | |
278 | 278 | // check for exact class name match... |
279 | 279 | if (\array_key_exists($cls, $cfg)) { |
280 | - $result = $cfg[ $cls ]; |
|
280 | + $result = $cfg[$cls]; |
|
281 | 281 | } else { |
282 | 282 | // no exact match, then lets try with `instanceof` |
283 | 283 | // Config entries are already sorted by priority. |
284 | 284 | foreach (\array_keys($cfg) as $class_name) { |
285 | 285 | if ($ex instanceof $class_name) { |
286 | - $result = $cfg[ $class_name ]; |
|
286 | + $result = $cfg[$class_name]; |
|
287 | 287 | break; |
288 | 288 | } |
289 | 289 | } |
@@ -10,58 +10,58 @@ |
||
10 | 10 | */ |
11 | 11 | return [ |
12 | 12 | |
13 | - 'ok' => 'OK', |
|
14 | - 'no_error_message' => 'Fehler #:api_code', |
|
13 | + 'ok' => 'OK', |
|
14 | + 'no_error_message' => 'Fehler #:api_code', |
|
15 | 15 | |
16 | - // Used by Exception Handler Helper (when used) |
|
17 | - 'uncaught_exception' => 'Ungefangene Ausnahme: :message', |
|
18 | - 'http_exception' => 'HTTP Ausnahme: :message', |
|
16 | + // Used by Exception Handler Helper (when used) |
|
17 | + 'uncaught_exception' => 'Ungefangene Ausnahme: :message', |
|
18 | + 'http_exception' => 'HTTP Ausnahme: :message', |
|
19 | 19 | |
20 | - // HttpException handler (added in 6.4.0) |
|
21 | - // Error messages for HttpException caught w/o custom messages |
|
22 | - // https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml |
|
23 | - // |
|
24 | - // German translation based on https://wiki.selfhtml.org/wiki/HTTP/Statuscodes |
|
25 | - 'http_400' => 'Ungültige Anfrage', |
|
26 | - 'http_401' => 'Unautorisiert', |
|
27 | - 'http_402' => 'Bezahlung benötigt', |
|
28 | - 'http_403' => 'Verboten', |
|
29 | - 'http_404' => 'Nicht gefunden', |
|
30 | - 'http_405' => 'Methode nicht erlaubt', |
|
31 | - 'http_406' => 'Nicht akzeptabel', |
|
32 | - 'http_407' => 'Proxy-Authentifizierung benötigt', |
|
33 | - 'http_408' => 'Anfrage-Zeitüberschreitung', |
|
34 | - 'http_409' => 'Konflikt', |
|
35 | - 'http_410' => 'Verschwunden', |
|
36 | - 'http_411' => 'Länge benötigt', |
|
37 | - 'http_412' => 'Vorbedingung missglückt', |
|
38 | - 'http_413' => 'Anfrage-Entität zu groß', |
|
39 | - 'http_414' => 'Anfrage-URI zu lang', |
|
40 | - 'http_415' => 'Nicht unterstützter Medientyp', |
|
41 | - 'http_416' => 'Anfrage-Bereich nicht erfüllbar', |
|
42 | - 'http_417' => 'Erwartung missglückt', |
|
43 | - 'http_421' => 'Fehlgeleitete Anforderung', |
|
44 | - 'http_422' => 'Kann nicht verarbeitet werden', |
|
45 | - 'http_423' => 'Gesperrt', |
|
46 | - 'http_424' => 'Vorhergehende Bedingung nicht erfüllt', |
|
47 | - 'http_425' => 'Too Early', // FIXME |
|
48 | - 'http_426' => 'Update benötigt', |
|
49 | - 'http_428' => ' Vorbedingung benötigt', |
|
50 | - 'http_429' => 'Zu viele Anfragen', |
|
51 | - 'http_431' => 'Headerfelds zu groß', |
|
52 | - 'http_451' => 'Ressource aus rechtlichen Gründen nicht verfügbar', |
|
20 | + // HttpException handler (added in 6.4.0) |
|
21 | + // Error messages for HttpException caught w/o custom messages |
|
22 | + // https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml |
|
23 | + // |
|
24 | + // German translation based on https://wiki.selfhtml.org/wiki/HTTP/Statuscodes |
|
25 | + 'http_400' => 'Ungültige Anfrage', |
|
26 | + 'http_401' => 'Unautorisiert', |
|
27 | + 'http_402' => 'Bezahlung benötigt', |
|
28 | + 'http_403' => 'Verboten', |
|
29 | + 'http_404' => 'Nicht gefunden', |
|
30 | + 'http_405' => 'Methode nicht erlaubt', |
|
31 | + 'http_406' => 'Nicht akzeptabel', |
|
32 | + 'http_407' => 'Proxy-Authentifizierung benötigt', |
|
33 | + 'http_408' => 'Anfrage-Zeitüberschreitung', |
|
34 | + 'http_409' => 'Konflikt', |
|
35 | + 'http_410' => 'Verschwunden', |
|
36 | + 'http_411' => 'Länge benötigt', |
|
37 | + 'http_412' => 'Vorbedingung missglückt', |
|
38 | + 'http_413' => 'Anfrage-Entität zu groß', |
|
39 | + 'http_414' => 'Anfrage-URI zu lang', |
|
40 | + 'http_415' => 'Nicht unterstützter Medientyp', |
|
41 | + 'http_416' => 'Anfrage-Bereich nicht erfüllbar', |
|
42 | + 'http_417' => 'Erwartung missglückt', |
|
43 | + 'http_421' => 'Fehlgeleitete Anforderung', |
|
44 | + 'http_422' => 'Kann nicht verarbeitet werden', |
|
45 | + 'http_423' => 'Gesperrt', |
|
46 | + 'http_424' => 'Vorhergehende Bedingung nicht erfüllt', |
|
47 | + 'http_425' => 'Too Early', // FIXME |
|
48 | + 'http_426' => 'Update benötigt', |
|
49 | + 'http_428' => ' Vorbedingung benötigt', |
|
50 | + 'http_429' => 'Zu viele Anfragen', |
|
51 | + 'http_431' => 'Headerfelds zu groß', |
|
52 | + 'http_451' => 'Ressource aus rechtlichen Gründen nicht verfügbar', |
|
53 | 53 | |
54 | - 'http_500' => 'Interner Server-Fehler', |
|
55 | - 'http_501' => 'Nicht implementiert', |
|
56 | - 'http_502' => 'Schlechtes Portal', |
|
57 | - 'http_503' => 'Dienst nicht verfügbar', |
|
58 | - 'http_504' => 'Portal-Auszeit', |
|
59 | - 'http_505' => 'HTTP-Version nicht unterstützt', |
|
60 | - 'http_506' => 'Variant Also Negotiates', // FIXME |
|
61 | - 'http_507' => 'Speicher des Servers reicht nicht aus', |
|
62 | - 'http_508' => 'Endlosschleife', |
|
63 | - 'http_509' => 'Unassigned', // FIXME |
|
64 | - 'http_510' => 'Zu wenig Informationen', |
|
65 | - 'http_511' => 'Identizifierung benötigt', |
|
54 | + 'http_500' => 'Interner Server-Fehler', |
|
55 | + 'http_501' => 'Nicht implementiert', |
|
56 | + 'http_502' => 'Schlechtes Portal', |
|
57 | + 'http_503' => 'Dienst nicht verfügbar', |
|
58 | + 'http_504' => 'Portal-Auszeit', |
|
59 | + 'http_505' => 'HTTP-Version nicht unterstützt', |
|
60 | + 'http_506' => 'Variant Also Negotiates', // FIXME |
|
61 | + 'http_507' => 'Speicher des Servers reicht nicht aus', |
|
62 | + 'http_508' => 'Endlosschleife', |
|
63 | + 'http_509' => 'Unassigned', // FIXME |
|
64 | + 'http_510' => 'Zu wenig Informationen', |
|
65 | + 'http_511' => 'Identizifierung benötigt', |
|
66 | 66 | ]; |
67 | 67 |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | 'http_422' => 'Kann nicht verarbeitet werden', |
45 | 45 | 'http_423' => 'Gesperrt', |
46 | 46 | 'http_424' => 'Vorhergehende Bedingung nicht erfüllt', |
47 | - 'http_425' => 'Too Early', // FIXME |
|
47 | + 'http_425' => 'Too Early', // FIXME |
|
48 | 48 | 'http_426' => 'Update benötigt', |
49 | 49 | 'http_428' => ' Vorbedingung benötigt', |
50 | 50 | 'http_429' => 'Zu viele Anfragen', |
@@ -57,10 +57,10 @@ discard block |
||
57 | 57 | 'http_503' => 'Dienst nicht verfügbar', |
58 | 58 | 'http_504' => 'Portal-Auszeit', |
59 | 59 | 'http_505' => 'HTTP-Version nicht unterstützt', |
60 | - 'http_506' => 'Variant Also Negotiates', // FIXME |
|
60 | + 'http_506' => 'Variant Also Negotiates', // FIXME |
|
61 | 61 | 'http_507' => 'Speicher des Servers reicht nicht aus', |
62 | 62 | 'http_508' => 'Endlosschleife', |
63 | - 'http_509' => 'Unassigned', // FIXME |
|
63 | + 'http_509' => 'Unassigned', // FIXME |
|
64 | 64 | 'http_510' => 'Zu wenig Informationen', |
65 | 65 | 'http_511' => 'Identizifierung benötigt', |
66 | 66 | ]; |
@@ -10,56 +10,56 @@ |
||
10 | 10 | */ |
11 | 11 | return [ |
12 | 12 | |
13 | - 'ok' => 'OK', |
|
14 | - 'no_error_message' => 'Error #:api_code', |
|
13 | + 'ok' => 'OK', |
|
14 | + 'no_error_message' => 'Error #:api_code', |
|
15 | 15 | |
16 | - // Used by Exception Handler Helper (when used) |
|
17 | - 'uncaught_exception' => 'Uncaught exception: :message', |
|
18 | - 'http_exception' => 'HTTP exception: :message', |
|
16 | + // Used by Exception Handler Helper (when used) |
|
17 | + 'uncaught_exception' => 'Uncaught exception: :message', |
|
18 | + 'http_exception' => 'HTTP exception: :message', |
|
19 | 19 | |
20 | - // HttpException handler (added in 6.4.0) |
|
21 | - // Error messages for HttpException caught w/o custom messages |
|
22 | - // https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml |
|
23 | - 'http_400' => 'Bad Request', |
|
24 | - 'http_401' => 'Unauthorized', |
|
25 | - 'http_402' => 'Payment Required', |
|
26 | - 'http_403' => 'Forbidden', |
|
27 | - 'http_404' => 'Not Found', |
|
28 | - 'http_405' => 'Method Not Allowed', |
|
29 | - 'http_406' => 'Not Acceptable', |
|
30 | - 'http_407' => 'Proxy Authentication Required', |
|
31 | - 'http_408' => 'Request Timeout', |
|
32 | - 'http_409' => 'Conflict', |
|
33 | - 'http_410' => 'Gone', |
|
34 | - 'http_411' => 'Length Required', |
|
35 | - 'http_412' => 'Precondition Failed', |
|
36 | - 'http_413' => 'Payload Too Large', |
|
37 | - 'http_414' => 'URI Too Long', |
|
38 | - 'http_415' => 'Unsupported Media Type', |
|
39 | - 'http_416' => 'Range Not Satisfiable', |
|
40 | - 'http_417' => 'Expectation Failed', |
|
41 | - 'http_421' => 'Misdirected Request', |
|
42 | - 'http_422' => 'Unprocessable Entity', |
|
43 | - 'http_423' => 'Locked', |
|
44 | - 'http_424' => 'Failed Dependency', |
|
45 | - 'http_425' => 'Too Early', |
|
46 | - 'http_426' => 'Upgrade Required', |
|
47 | - 'http_428' => 'Precondition Required', |
|
48 | - 'http_429' => 'Too Many Requests', |
|
49 | - 'http_431' => 'Request Header Fields Too Large', |
|
50 | - 'http_451' => 'Unavailable For Legal Reasons', |
|
20 | + // HttpException handler (added in 6.4.0) |
|
21 | + // Error messages for HttpException caught w/o custom messages |
|
22 | + // https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml |
|
23 | + 'http_400' => 'Bad Request', |
|
24 | + 'http_401' => 'Unauthorized', |
|
25 | + 'http_402' => 'Payment Required', |
|
26 | + 'http_403' => 'Forbidden', |
|
27 | + 'http_404' => 'Not Found', |
|
28 | + 'http_405' => 'Method Not Allowed', |
|
29 | + 'http_406' => 'Not Acceptable', |
|
30 | + 'http_407' => 'Proxy Authentication Required', |
|
31 | + 'http_408' => 'Request Timeout', |
|
32 | + 'http_409' => 'Conflict', |
|
33 | + 'http_410' => 'Gone', |
|
34 | + 'http_411' => 'Length Required', |
|
35 | + 'http_412' => 'Precondition Failed', |
|
36 | + 'http_413' => 'Payload Too Large', |
|
37 | + 'http_414' => 'URI Too Long', |
|
38 | + 'http_415' => 'Unsupported Media Type', |
|
39 | + 'http_416' => 'Range Not Satisfiable', |
|
40 | + 'http_417' => 'Expectation Failed', |
|
41 | + 'http_421' => 'Misdirected Request', |
|
42 | + 'http_422' => 'Unprocessable Entity', |
|
43 | + 'http_423' => 'Locked', |
|
44 | + 'http_424' => 'Failed Dependency', |
|
45 | + 'http_425' => 'Too Early', |
|
46 | + 'http_426' => 'Upgrade Required', |
|
47 | + 'http_428' => 'Precondition Required', |
|
48 | + 'http_429' => 'Too Many Requests', |
|
49 | + 'http_431' => 'Request Header Fields Too Large', |
|
50 | + 'http_451' => 'Unavailable For Legal Reasons', |
|
51 | 51 | |
52 | - 'http_500' => 'Internal Server Error', |
|
53 | - 'http_501' => 'Not Implemented', |
|
54 | - 'http_502' => 'Bad Gateway', |
|
55 | - 'http_503' => 'Service Unavailable', |
|
56 | - 'http_504' => 'Gateway Timeout', |
|
57 | - 'http_505' => 'HTTP Version Not Supported', |
|
58 | - 'http_506' => 'Variant Also Negotiates', |
|
59 | - 'http_507' => 'Insufficient Storage', |
|
60 | - 'http_508' => 'Loop Detected', |
|
61 | - 'http_509' => 'Unassigned', |
|
62 | - 'http_510' => 'Not Extended', |
|
63 | - 'http_511' => 'Network Authentication Required', |
|
52 | + 'http_500' => 'Internal Server Error', |
|
53 | + 'http_501' => 'Not Implemented', |
|
54 | + 'http_502' => 'Bad Gateway', |
|
55 | + 'http_503' => 'Service Unavailable', |
|
56 | + 'http_504' => 'Gateway Timeout', |
|
57 | + 'http_505' => 'HTTP Version Not Supported', |
|
58 | + 'http_506' => 'Variant Also Negotiates', |
|
59 | + 'http_507' => 'Insufficient Storage', |
|
60 | + 'http_508' => 'Loop Detected', |
|
61 | + 'http_509' => 'Unassigned', |
|
62 | + 'http_510' => 'Not Extended', |
|
63 | + 'http_511' => 'Network Authentication Required', |
|
64 | 64 | ]; |
65 | 65 |
@@ -10,55 +10,55 @@ |
||
10 | 10 | */ |
11 | 11 | return [ |
12 | 12 | |
13 | - 'ok' => 'OK', |
|
14 | - 'no_error_message' => 'Błąd #:api_code', |
|
13 | + 'ok' => 'OK', |
|
14 | + 'no_error_message' => 'Błąd #:api_code', |
|
15 | 15 | |
16 | - // Used by Exception Handler Helper (when used) |
|
17 | - 'uncaught_exception' => 'Nieprzechwycony wyjątek: :message', |
|
18 | - 'http_exception' => 'Wyjątek HTTP: :message', |
|
16 | + // Used by Exception Handler Helper (when used) |
|
17 | + 'uncaught_exception' => 'Nieprzechwycony wyjątek: :message', |
|
18 | + 'http_exception' => 'Wyjątek HTTP: :message', |
|
19 | 19 | |
20 | - // HttpException handler (added in 6.4.0) |
|
21 | - // Error messages for HttpException caught w/o custom messages |
|
22 | - // https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml |
|
23 | - 'http_400' => 'Bad Request', |
|
24 | - 'http_401' => 'Unauthorized', |
|
25 | - 'http_402' => 'Payment Required', |
|
26 | - 'http_403' => 'Forbidden', |
|
27 | - 'http_404' => 'Not Found', |
|
28 | - 'http_405' => 'Method Not Allowed', |
|
29 | - 'http_406' => 'Not Acceptable', |
|
30 | - 'http_407' => 'Proxy Authentication Required', |
|
31 | - 'http_408' => 'Request Timeout', |
|
32 | - 'http_409' => 'Conflict', |
|
33 | - 'http_410' => 'Gone', |
|
34 | - 'http_411' => 'Length Required', |
|
35 | - 'http_412' => 'Precondition Failed', |
|
36 | - 'http_413' => 'Payload Too Large', |
|
37 | - 'http_414' => 'URI Too Long', |
|
38 | - 'http_415' => 'Unsupported Media Type', |
|
39 | - 'http_416' => 'Range Not Satisfiable', |
|
40 | - 'http_417' => 'Expectation Failed', |
|
41 | - 'http_421' => 'Misdirected Request', |
|
42 | - 'http_422' => 'Unprocessable Entity', |
|
43 | - 'http_423' => 'Locked', |
|
44 | - 'http_424' => 'Failed Dependency', |
|
45 | - 'http_425' => 'Too Early', |
|
46 | - 'http_426' => 'Upgrade Required', |
|
47 | - 'http_428' => 'Precondition Required', |
|
48 | - 'http_429' => 'Too Many Requests', |
|
49 | - 'http_431' => 'Request Header Fields Too Large', |
|
50 | - 'http_451' => 'Unavailable For Legal Reasons', |
|
20 | + // HttpException handler (added in 6.4.0) |
|
21 | + // Error messages for HttpException caught w/o custom messages |
|
22 | + // https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml |
|
23 | + 'http_400' => 'Bad Request', |
|
24 | + 'http_401' => 'Unauthorized', |
|
25 | + 'http_402' => 'Payment Required', |
|
26 | + 'http_403' => 'Forbidden', |
|
27 | + 'http_404' => 'Not Found', |
|
28 | + 'http_405' => 'Method Not Allowed', |
|
29 | + 'http_406' => 'Not Acceptable', |
|
30 | + 'http_407' => 'Proxy Authentication Required', |
|
31 | + 'http_408' => 'Request Timeout', |
|
32 | + 'http_409' => 'Conflict', |
|
33 | + 'http_410' => 'Gone', |
|
34 | + 'http_411' => 'Length Required', |
|
35 | + 'http_412' => 'Precondition Failed', |
|
36 | + 'http_413' => 'Payload Too Large', |
|
37 | + 'http_414' => 'URI Too Long', |
|
38 | + 'http_415' => 'Unsupported Media Type', |
|
39 | + 'http_416' => 'Range Not Satisfiable', |
|
40 | + 'http_417' => 'Expectation Failed', |
|
41 | + 'http_421' => 'Misdirected Request', |
|
42 | + 'http_422' => 'Unprocessable Entity', |
|
43 | + 'http_423' => 'Locked', |
|
44 | + 'http_424' => 'Failed Dependency', |
|
45 | + 'http_425' => 'Too Early', |
|
46 | + 'http_426' => 'Upgrade Required', |
|
47 | + 'http_428' => 'Precondition Required', |
|
48 | + 'http_429' => 'Too Many Requests', |
|
49 | + 'http_431' => 'Request Header Fields Too Large', |
|
50 | + 'http_451' => 'Unavailable For Legal Reasons', |
|
51 | 51 | |
52 | - 'http_500' => 'Internal Server Error', |
|
53 | - 'http_501' => 'Not Implemented', |
|
54 | - 'http_502' => 'Bad Gateway', |
|
55 | - 'http_503' => 'Service Unavailable', |
|
56 | - 'http_504' => 'Gateway Timeout', |
|
57 | - 'http_505' => 'HTTP Version Not Supported', |
|
58 | - 'http_506' => 'Variant Also Negotiates', |
|
59 | - 'http_507' => 'Insufficient Storage', |
|
60 | - 'http_508' => 'Loop Detected', |
|
61 | - 'http_509' => 'Unassigned', |
|
62 | - 'http_510' => 'Not Extended', |
|
63 | - 'http_511' => 'Network Authentication Required', |
|
52 | + 'http_500' => 'Internal Server Error', |
|
53 | + 'http_501' => 'Not Implemented', |
|
54 | + 'http_502' => 'Bad Gateway', |
|
55 | + 'http_503' => 'Service Unavailable', |
|
56 | + 'http_504' => 'Gateway Timeout', |
|
57 | + 'http_505' => 'HTTP Version Not Supported', |
|
58 | + 'http_506' => 'Variant Also Negotiates', |
|
59 | + 'http_507' => 'Insufficient Storage', |
|
60 | + 'http_508' => 'Loop Detected', |
|
61 | + 'http_509' => 'Unassigned', |
|
62 | + 'http_510' => 'Not Extended', |
|
63 | + 'http_511' => 'Network Authentication Required', |
|
64 | 64 | ]; |
@@ -42,12 +42,12 @@ |
||
42 | 42 | $config = \array_replace($default_config, $user_config); |
43 | 43 | |
44 | 44 | $http_code = $ex->getStatusCode(); |
45 | - $result = $config[ $http_code ] ?? null; |
|
45 | + $result = $config[$http_code] ?? null; |
|
46 | 46 | |
47 | 47 | // If we do not have dedicated entry fort this particular http_code, |
48 | 48 | // fall back to default value. |
49 | 49 | if ($result === null) { |
50 | - $result = $config[ RB::KEY_DEFAULT ]; |
|
50 | + $result = $config[RB::KEY_DEFAULT]; |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | // Some defaults to fall back to if not set in user config. |
@@ -375,7 +375,7 @@ |
||
375 | 375 | |
376 | 376 | if ($debug_data !== null) { |
377 | 377 | $debug_key = Config::get(RB::CONF_KEY_DEBUG_DEBUG_KEY, RB::KEY_DEBUG); |
378 | - $response[ $debug_key ] = $debug_data; |
|
378 | + $response[$debug_key] = $debug_data; |
|
379 | 379 | } |
380 | 380 | |
381 | 381 | return $response; |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | * @return HttpResponse |
86 | 86 | */ |
87 | 87 | public static function success($data = null, $api_code = null, array $placeholders = null, |
88 | - int $http_code = null, int $json_opts = null): HttpResponse |
|
88 | + int $http_code = null, int $json_opts = null): HttpResponse |
|
89 | 89 | { |
90 | 90 | return static::asSuccess($api_code) |
91 | 91 | ->withData($data) |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | * @return HttpResponse |
114 | 114 | */ |
115 | 115 | public static function error(int $api_code, array $placeholders = null, $data = null, int $http_code = null, |
116 | - int $json_opts = null): HttpResponse |
|
116 | + int $json_opts = null): HttpResponse |
|
117 | 117 | { |
118 | 118 | return static::asError($api_code) |
119 | 119 | ->withPlaceholders($placeholders) |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | public function withJsonOptions(int $json_opts = null): self |
198 | 198 | { |
199 | 199 | Validator::assertIsType('json_opts', $json_opts, [Type::INTEGER, |
200 | - Type::NULL]); |
|
200 | + Type::NULL]); |
|
201 | 201 | $this->json_opts = $json_opts; |
202 | 202 | |
203 | 203 | return $this; |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | public function withDebugData(array $debug_data = null): self |
212 | 212 | { |
213 | 213 | Validator::assertIsType('$debug_data', $debug_data, [Type::ARRAY, |
214 | - Type::NULL]); |
|
214 | + Type::NULL]); |
|
215 | 215 | $this->debug_data = $debug_data; |
216 | 216 | |
217 | 217 | return $this; |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | public function withMessage(string $msg = null): self |
226 | 226 | { |
227 | 227 | Validator::assertIsType('message', $msg, [Type::STRING, |
228 | - Type::NULL]); |
|
228 | + Type::NULL]); |
|
229 | 229 | $this->message = $msg; |
230 | 230 | |
231 | 231 | return $this; |
@@ -312,8 +312,8 @@ discard block |
||
312 | 312 | * @noinspection PhpTooManyParametersInspection |
313 | 313 | */ |
314 | 314 | protected function make(bool $success, int $api_code, $msg_or_api_code, $data = null, |
315 | - int $http_code = null, array $placeholders = null, array $http_headers = null, |
|
316 | - int $json_opts = null, array $debug_data = null): HttpResponse |
|
315 | + int $http_code = null, array $placeholders = null, array $http_headers = null, |
|
316 | + int $json_opts = null, array $debug_data = null): HttpResponse |
|
317 | 317 | { |
318 | 318 | $http_headers = $http_headers ?? []; |
319 | 319 | $http_code = $http_code ?? ($success ? RB::DEFAULT_HTTP_CODE_OK : RB::DEFAULT_HTTP_CODE_ERROR); |
@@ -352,8 +352,8 @@ discard block |
||
352 | 352 | * @noinspection PhpTooManyParametersInspection |
353 | 353 | */ |
354 | 354 | protected function buildResponse(bool $success, int $api_code, |
355 | - $msg_or_api_code, array $placeholders = null, |
|
356 | - $data = null, array $debug_data = null): array |
|
355 | + $msg_or_api_code, array $placeholders = null, |
|
356 | + $data = null, array $debug_data = null): array |
|
357 | 357 | { |
358 | 358 | // ensure $data is either @null, array or object of class with configured mapping. |
359 | 359 | $data = (new Converter())->convert($data); |