@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | { |
| 35 | 35 | // avoid "holes" in the keys of the filtered array, by using array_values on the filtered array |
| 36 | 36 | $responseFileTags = array_values( |
| 37 | - array_filter($tags, function ($tag) { |
|
| 37 | + array_filter($tags, function($tag) { |
|
| 38 | 38 | return $tag instanceof Tag && strtolower($tag->getName()) === 'responsefile'; |
| 39 | 39 | }) |
| 40 | 40 | ); |
@@ -43,11 +43,11 @@ discard block |
||
| 43 | 43 | return; |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - return array_map(function (Tag $responseFileTag) { |
|
| 46 | + return array_map(function(Tag $responseFileTag) { |
|
| 47 | 47 | preg_match('/^(\d{3})?\s?([\S]*[\s]*?)(\{.*\})?$/', $responseFileTag->getContent(), $result); |
| 48 | 48 | $status = $result[1] ?: 200; |
| 49 | 49 | $content = $result[2] ? file_get_contents(storage_path(trim($result[2])), true) : '{}'; |
| 50 | - $json = ! empty($result[3]) ? str_replace("'", '"', $result[3]) : '{}'; |
|
| 50 | + $json = !empty($result[3]) ? str_replace("'", '"', $result[3]) : '{}'; |
|
| 51 | 51 | $merged = array_merge(json_decode($content, true), json_decode($json, true)); |
| 52 | 52 | |
| 53 | 53 | return new JsonResponse($merged, (int) $status); |
@@ -17,17 +17,17 @@ |
||
| 17 | 17 | */ |
| 18 | 18 | 'postman' => true, |
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * Fractal Transformer Config |
|
| 22 | - * |
|
| 23 | - * must install |
|
| 24 | - * composer require league/fractal |
|
| 25 | - * |
|
| 26 | - * Available serializers: |
|
| 27 | - * -ArraySerializer |
|
| 28 | - * -DataArraySerializer |
|
| 29 | - * -JsonApiSerializer |
|
| 30 | - */ |
|
| 20 | + /** |
|
| 21 | + * Fractal Transformer Config |
|
| 22 | + * |
|
| 23 | + * must install |
|
| 24 | + * composer require league/fractal |
|
| 25 | + * |
|
| 26 | + * Available serializers: |
|
| 27 | + * -ArraySerializer |
|
| 28 | + * -DataArraySerializer |
|
| 29 | + * -JsonApiSerializer |
|
| 30 | + */ |
|
| 31 | 31 | 'fractal' => [ |
| 32 | 32 | 'serializer' => League\Fractal\Serializer\ArraySerializer::class, |
| 33 | 33 | ], |