|
@@ -34,7 +34,7 @@ discard block |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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); |
Please login to merge, or discard this patch.