Skip to content

Commit

Permalink
fix map, object sub value was null
Browse files Browse the repository at this point in the history
  • Loading branch information
netyum committed Aug 9, 2022
1 parent 67982fd commit 4cffb7d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Util/ResponseFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ public static function filterArrayData($data, $mapData)
if (array_key_exists($key, $v)) {
$newV[$key] = self::processVarType($value['type'], $v[$key], $value['example']);
if (array_key_exists('children', $value)) {
$newV[$key] = self::filterData($newV[$key], $value['children'], $value['type']);
if (!is_null($newV[$key])) {
$newV[$key] = self::filterData($newV[$key], $value['children'], $value['type']);
}
}
}
}
Expand Down Expand Up @@ -113,7 +115,9 @@ public static function filterData($data, $mapData, $type)
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_null($newData[$key])) {
$newData[$key] = self::filterData($newData[$key], $value['children'], $value['type']);
}
}
}
}
Expand Down

0 comments on commit 4cffb7d

Please sign in to comment.