Add recursive array conversion in RpcResponse::convertToArray

This commit is contained in:
netkas 2025-01-03 18:30:27 -05:00
parent b60b12f9ae
commit a3976742d6

View file

@ -55,6 +55,26 @@
return $data->toArray(); return $data->toArray();
} }
// If the data is an array, recursively call this function on each element
if(is_array($data))
{
foreach($data as $key => $value)
{
if(is_array($value))
{
$data[$key] = $this->convertToArray($value);
}
elseif($value instanceof SerializableInterface)
{
$data[$key] = $value->toArray();
}
else
{
$data[$key] = $value;
}
}
}
return $data; return $data;
} }