if ($value instanceof \Traversable
) { $value =
iterator_to_array($value);
} if (\
is_array($value)) { $intValues = \
count($value) === \
count(array_filter($value, 'is_int'
));
// check that the keys are 0-indexed and ascending
$intKeys =
array_is_list($value);
if ($intValues &&
$intKeys) { $this->
writeIntVector($file,
$value,
$indentation);
return;
} if ($intKeys) { $this->
writeArray($file,
$value,
$indentation);
return;
} $this->
writeTable($file,
$value,
$indentation);