public function render($count, $fixed = false, $preserveKeys = false)
{
$subject = $this->getArgumentFromArgumentsOrTagContentAndConvertToArray('subject');
$output = [];
if (0 >= $count) {
return $output;
}
if (true === (bool) $fixed) {
$subjectSize = count($subject);
if (0 < $subjectSize) {
$chunkSize = ceil($subjectSize / $count);
$output = array_chunk($subject, $chunkSize, $preserveKeys);
}
// Fill the resulting array with empty items to get the desired element count
$elementCount = count($output);
if ($elementCount < $count) {
$output += array_fill($elementCount, $count - $elementCount, null);
}
} else {
$output = array_chunk($subject, $count, $preserveKeys);
}
return $this->renderChildrenWithVariableOrReturnInput($output);
}