From a4c162ce33ec12248f0a098b35ee1c58b3b45606 Mon Sep 17 00:00:00 2001 From: Song Yeung Date: Mon, 6 Feb 2023 10:43:42 +0800 Subject: [PATCH] Update ResponseFilter.php --- src/Util/ResponseFilter.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Util/ResponseFilter.php b/src/Util/ResponseFilter.php index 5e58c9a..e33a2a2 100644 --- a/src/Util/ResponseFilter.php +++ b/src/Util/ResponseFilter.php @@ -102,10 +102,12 @@ public static function filterData($data, $mapData, $type) } return $newData; } - if (array_key_exists($key, $data)) { - $newData[$key] = self::processVarType($value['type'], $data[$key], $value['example']); - if (array_key_exists('children', $value)) { - $newData[$key] = self::filterData($newData[$key], $value['children'], $value['type']); + if (is_array($data)) { + if (array_key_exists($key, $data)) { + $newData[$key] = self::processVarType($value['type'], $data[$key], $value['example']); + if (array_key_exists('children', $value)) { + $newData[$key] = self::filterData($newData[$key], $value['children'], $value['type']); + } } } }