@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | * @return HttpResponse |
| 137 | 137 | */ |
| 138 | 138 | public static function success($data = null, $api_code = null, array $lang_args = null, |
| 139 | - int $http_code = null, int $encoding_options = null): HttpResponse |
|
| 139 | + int $http_code = null, int $encoding_options = null): HttpResponse |
|
| 140 | 140 | { |
| 141 | 141 | return static::buildSuccessResponse($data, $api_code, $lang_args, $http_code, $encoding_options); |
| 142 | 142 | } |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | * @throws \InvalidArgumentException Thrown when provided arguments are invalid. |
| 182 | 182 | */ |
| 183 | 183 | protected static function buildSuccessResponse($data = null, int $api_code = null, array $lang_args = null, |
| 184 | - int $http_code = null, int $encoding_options = null): HttpResponse |
|
| 184 | + int $http_code = null, int $encoding_options = null): HttpResponse |
|
| 185 | 185 | { |
| 186 | 186 | $http_code = $http_code ?? static::DEFAULT_HTTP_CODE_OK; |
| 187 | 187 | $api_code = $api_code ?? BaseApiCodes::OK(); |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | * @return HttpResponse |
| 208 | 208 | */ |
| 209 | 209 | public static function error(int $api_code, array $lang_args = null, $data = null, int $http_code = null, |
| 210 | - int $encoding_options = null): HttpResponse |
|
| 210 | + int $encoding_options = null): HttpResponse |
|
| 211 | 211 | { |
| 212 | 212 | return static::buildErrorResponse($data, $api_code, $http_code, $lang_args, $encoding_options); |
| 213 | 213 | } |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | * @return HttpResponse |
| 223 | 223 | */ |
| 224 | 224 | public static function errorWithData(int $api_code, $data, array $lang_args = null, |
| 225 | - int $encoding_options = null): HttpResponse |
|
| 225 | + int $encoding_options = null): HttpResponse |
|
| 226 | 226 | { |
| 227 | 227 | return static::buildErrorResponse($data, $api_code, null, $lang_args, $encoding_options); |
| 228 | 228 | } |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | * @throws \InvalidArgumentException if http_code is @null |
| 241 | 241 | */ |
| 242 | 242 | public static function errorWithDataAndHttpCode(int $api_code, $data, int $http_code, array $lang_args = null, |
| 243 | - int $encoding_options = null): HttpResponse |
|
| 243 | + int $encoding_options = null): HttpResponse |
|
| 244 | 244 | { |
| 245 | 245 | return static::buildErrorResponse($data, $api_code, $http_code, $lang_args, $encoding_options); |
| 246 | 246 | } |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | * @return HttpResponse |
| 271 | 271 | */ |
| 272 | 272 | public static function errorWithMessageAndData(int $api_code, string $error_message, $data, |
| 273 | - int $http_code = null, int $encoding_options = null): HttpResponse |
|
| 273 | + int $http_code = null, int $encoding_options = null): HttpResponse |
|
| 274 | 274 | { |
| 275 | 275 | return static::buildErrorResponse($data, $api_code, $http_code, null, |
| 276 | 276 | $error_message, null, $encoding_options); |
@@ -288,8 +288,8 @@ discard block |
||
| 288 | 288 | * @return HttpResponse |
| 289 | 289 | */ |
| 290 | 290 | public static function errorWithMessageAndDataAndDebug(int $api_code, string $error_message, $data, |
| 291 | - int $http_code = null, int $encoding_options = null, |
|
| 292 | - array $debug_data = null): HttpResponse |
|
| 291 | + int $http_code = null, int $encoding_options = null, |
|
| 292 | + array $debug_data = null): HttpResponse |
|
| 293 | 293 | { |
| 294 | 294 | return static::buildErrorResponse($data, $api_code, $http_code, null, |
| 295 | 295 | $error_message, null, $encoding_options, $debug_data); |
@@ -328,8 +328,8 @@ discard block |
||
| 328 | 328 | * @noinspection MoreThanThreeArgumentsInspection |
| 329 | 329 | */ |
| 330 | 330 | protected static function buildErrorResponse($data, int $api_code, int $http_code = null, array $lang_args = null, |
| 331 | - string $message = null, array $headers = null, int $encoding_options = null, |
|
| 332 | - array $debug_data = null): HttpResponse |
|
| 331 | + string $message = null, array $headers = null, int $encoding_options = null, |
|
| 332 | + array $debug_data = null): HttpResponse |
|
| 333 | 333 | { |
| 334 | 334 | $http_code = $http_code ?? static::DEFAULT_HTTP_CODE_ERROR; |
| 335 | 335 | $headers = $headers ?? []; |
@@ -372,8 +372,8 @@ discard block |
||
| 372 | 372 | * @noinspection MoreThanThreeArgumentsInspection |
| 373 | 373 | */ |
| 374 | 374 | protected static function make(bool $success, int $api_code, $message_or_api_code, $data = null, |
| 375 | - int $http_code = null, array $lang_args = null, array $headers = null, |
|
| 376 | - int $encoding_options = null, array $debug_data = null): HttpResponse |
|
| 375 | + int $http_code = null, array $lang_args = null, array $headers = null, |
|
| 376 | + int $encoding_options = null, array $debug_data = null): HttpResponse |
|
| 377 | 377 | { |
| 378 | 378 | $headers = $headers ?? []; |
| 379 | 379 | $http_code = $http_code ?? ($success ? static::DEFAULT_HTTP_CODE_OK : static::DEFAULT_HTTP_CODE_ERROR); |
@@ -429,7 +429,7 @@ discard block |
||
| 429 | 429 | * @throws \RuntimeException in case of missing or invalid "classes" mapping configuration |
| 430 | 430 | */ |
| 431 | 431 | protected static function buildResponse(bool $success, int $api_code, string $message, $data = null, |
| 432 | - array $debug_data = null): array |
|
| 432 | + array $debug_data = null): array |
|
| 433 | 433 | { |
| 434 | 434 | // ensure $data is either @null, array or object of class with configured mapping. |
| 435 | 435 | $converter = new Converter(); |
@@ -109,7 +109,7 @@ |
||
| 109 | 109 | * @return HttpResponse |
| 110 | 110 | */ |
| 111 | 111 | protected static function error(Exception $exception, $exception_config_key, $fallback_api_code, |
| 112 | - $fallback_http_code = ResponseBuilder::DEFAULT_HTTP_CODE_ERROR): HttpResponse |
|
| 112 | + $fallback_http_code = ResponseBuilder::DEFAULT_HTTP_CODE_ERROR): HttpResponse |
|
| 113 | 113 | { |
| 114 | 114 | // common prefix for config key |
| 115 | 115 | $base_config_key = sprintf('%s.exception', ResponseBuilder::CONF_EXCEPTION_HANDLER_KEY); |