@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * @return HttpResponse |
138 | 138 | */ |
139 | 139 | public static function success($data = null, $api_code = null, array $lang_args = null, |
140 | - int $http_code = null, int $encoding_options = null): HttpResponse |
|
140 | + int $http_code = null, int $encoding_options = null): HttpResponse |
|
141 | 141 | { |
142 | 142 | return static::buildSuccessResponse($data, $api_code, $lang_args, $http_code, $encoding_options); |
143 | 143 | } |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | * @throws \InvalidArgumentException Thrown when provided arguments are invalid. |
183 | 183 | */ |
184 | 184 | protected static function buildSuccessResponse($data = null, int $api_code = null, array $lang_args = null, |
185 | - int $http_code = null, int $encoding_options = null): HttpResponse |
|
185 | + int $http_code = null, int $encoding_options = null): HttpResponse |
|
186 | 186 | { |
187 | 187 | $http_code = $http_code ?? static::DEFAULT_HTTP_CODE_OK; |
188 | 188 | $api_code = $api_code ?? BaseApiCodes::OK(); |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | * @return HttpResponse |
209 | 209 | */ |
210 | 210 | public static function error(int $api_code, array $lang_args = null, $data = null, int $http_code = null, |
211 | - int $encoding_options = null): HttpResponse |
|
211 | + int $encoding_options = null): HttpResponse |
|
212 | 212 | { |
213 | 213 | return static::buildErrorResponse($data, $api_code, $http_code, $lang_args, $encoding_options); |
214 | 214 | } |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | * @return HttpResponse |
224 | 224 | */ |
225 | 225 | public static function errorWithData(int $api_code, $data, array $lang_args = null, |
226 | - int $encoding_options = null): HttpResponse |
|
226 | + int $encoding_options = null): HttpResponse |
|
227 | 227 | { |
228 | 228 | return static::buildErrorResponse($data, $api_code, null, $lang_args, $encoding_options); |
229 | 229 | } |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | * @throws \InvalidArgumentException if http_code is @null |
242 | 242 | */ |
243 | 243 | public static function errorWithDataAndHttpCode(int $api_code, $data, int $http_code, array $lang_args = null, |
244 | - int $encoding_options = null): HttpResponse |
|
244 | + int $encoding_options = null): HttpResponse |
|
245 | 245 | { |
246 | 246 | return static::buildErrorResponse($data, $api_code, $http_code, $lang_args, $encoding_options); |
247 | 247 | } |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | * @return HttpResponse |
272 | 272 | */ |
273 | 273 | public static function errorWithMessageAndData(int $api_code, string $error_message, $data, |
274 | - int $http_code = null, int $encoding_options = null): HttpResponse |
|
274 | + int $http_code = null, int $encoding_options = null): HttpResponse |
|
275 | 275 | { |
276 | 276 | return static::buildErrorResponse($data, $api_code, $http_code, null, |
277 | 277 | $error_message, null, $encoding_options); |
@@ -289,8 +289,8 @@ discard block |
||
289 | 289 | * @return HttpResponse |
290 | 290 | */ |
291 | 291 | public static function errorWithMessageAndDataAndDebug(int $api_code, string $error_message, $data, |
292 | - int $http_code = null, int $encoding_options = null, |
|
293 | - array $debug_data = null): HttpResponse |
|
292 | + int $http_code = null, int $encoding_options = null, |
|
293 | + array $debug_data = null): HttpResponse |
|
294 | 294 | { |
295 | 295 | return static::buildErrorResponse($data, $api_code, $http_code, null, |
296 | 296 | $error_message, null, $encoding_options, $debug_data); |
@@ -329,8 +329,8 @@ discard block |
||
329 | 329 | * @noinspection MoreThanThreeArgumentsInspection |
330 | 330 | */ |
331 | 331 | protected static function buildErrorResponse($data, int $api_code, int $http_code = null, array $lang_args = null, |
332 | - string $message = null, array $headers = null, int $encoding_options = null, |
|
333 | - array $debug_data = null): HttpResponse |
|
332 | + string $message = null, array $headers = null, int $encoding_options = null, |
|
333 | + array $debug_data = null): HttpResponse |
|
334 | 334 | { |
335 | 335 | $http_code = $http_code ?? static::DEFAULT_HTTP_CODE_ERROR; |
336 | 336 | $headers = $headers ?? []; |
@@ -373,8 +373,8 @@ discard block |
||
373 | 373 | * @noinspection MoreThanThreeArgumentsInspection |
374 | 374 | */ |
375 | 375 | protected static function make(bool $success, int $api_code, $message_or_api_code, $data = null, |
376 | - int $http_code = null, array $lang_args = null, array $headers = null, |
|
377 | - int $encoding_options = null, array $debug_data = null): HttpResponse |
|
376 | + int $http_code = null, array $lang_args = null, array $headers = null, |
|
377 | + int $encoding_options = null, array $debug_data = null): HttpResponse |
|
378 | 378 | { |
379 | 379 | $headers = $headers ?? []; |
380 | 380 | $http_code = $http_code ?? ($success ? static::DEFAULT_HTTP_CODE_OK : static::DEFAULT_HTTP_CODE_ERROR); |
@@ -441,8 +441,8 @@ discard block |
||
441 | 441 | * @throws \RuntimeException in case of missing or invalid "classes" mapping configuration |
442 | 442 | */ |
443 | 443 | protected static function buildResponse(bool $success, int $api_code, |
444 | - $message_or_api_code, array $lang_args = null, |
|
445 | - $data = null, array $debug_data = null): array |
|
444 | + $message_or_api_code, array $lang_args = null, |
|
445 | + $data = null, array $debug_data = null): array |
|
446 | 446 | { |
447 | 447 | // ensure $data is either @null, array or object of class with configured mapping. |
448 | 448 | $converter = new Converter(); |
@@ -450,7 +450,7 @@ discard block |
||
450 | 450 | $data = $converter->convert($data); |
451 | 451 | if ($data !== null && !is_object($data)) { |
452 | 452 | // ensure we get object in final JSON structure in data node |
453 | - $data = (object)$data; |
|
453 | + $data = (object) $data; |
|
454 | 454 | } |
455 | 455 | |
456 | 456 | $lang_args = $lang_args ?? []; |
@@ -474,7 +474,7 @@ discard block |
||
474 | 474 | |
475 | 475 | if ($debug_data !== null) { |
476 | 476 | $debug_key = Config::get(static::CONF_KEY_DEBUG_DEBUG_KEY, self::KEY_DEBUG); |
477 | - $response[ $debug_key ] = $debug_data; |
|
477 | + $response[$debug_key] = $debug_data; |
|
478 | 478 | } |
479 | 479 | |
480 | 480 | return $response; |