When a property of a Model is supposed to be a list of some subtype (for example taxes of the InvoiceEstimate), but the ChargeBee returns 0 items in the list, the list is not becoming an empty array, but an (empty) instance of the list type.
It looks like that this can be fixed by isHash function (inside ChargeBee_Model) returning false not only when not being an array, but also when the array is empy.
private function isHash($array)
{
if (!is_array($array) || count($array) === 0)
return false;
foreach (array_keys($array) as $k) {
if (is_numeric($k))
return false;
}
return true;
}
When a property of a Model is supposed to be a list of some subtype (for example
taxes
of theInvoiceEstimate
), but the ChargeBee returns 0 items in the list, the list is not becoming an empty array, but an (empty) instance of the list type.It looks like that this can be fixed by
isHash
function (insideChargeBee_Model
) returning false not only when not being an array, but also when the array is empy.