Passed
Push — dev ( 8ee32c...bd1c58 )
by Marcin
02:49
created
src/ResponseBuilder.php 1 patch
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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);
@@ -416,10 +416,10 @@  discard block
 block discarded – undo
416 416
 	}
417 417
 
418 418
 	/**
419
-     * Creates standardised API response array. This is final method called in the whole pipeline before we
420
-     * return final JSON back to client. If you want to manipulate your response, this is the place to do that.
421
-     * If you set APP_DEBUG to true, 'code_hex' field will be additionally added to reported JSON for easier
422
-     * manual debugging.
419
+	 * Creates standardised API response array. This is final method called in the whole pipeline before we
420
+	 * return final JSON back to client. If you want to manipulate your response, this is the place to do that.
421
+	 * If you set APP_DEBUG to true, 'code_hex' field will be additionally added to reported JSON for easier
422
+	 * manual debugging.
423 423
 	 *
424 424
 	 * @param boolean           $success    @true if response indicates success, @false otherwise
425 425
 	 * @param integer           $api_code   response code
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
 	 * @throws \RuntimeException in case of missing or invalid "classes" mapping configuration
433 433
 	 */
434 434
 	protected static function buildResponse(bool $success, int $api_code, string $message, $data = null,
435
-	                                        array $debug_data = null): array
435
+											array $debug_data = null): array
436 436
 	{
437 437
 		// ensure $data is either @null, array or object of class with configured mapping.
438 438
 		$converter = new Converter();
Please login to merge, or discard this patch.