if (\
array_key_exists($property,
$struct->
getVars())) { $object =
$struct->
getVars()[$property];
} if ($object instanceof Struct
) { $data[$property] =
$this->
loop($object,
$fields,
$value);
continue;
} // simple array of structs case
if ($this->
isStructArray($object)) { $array =
[];
foreach ($object as $key =>
$item) { $array[$key] =
$this->
encodeStruct($item,
$fields,
$value[$key]);
} $data[$property] =
$array;
continue;
} $data[$property] =
$this->
encodeNestedArray($struct->
getApiAlias(),
(string) $property,
$value,
$fields);
}