protected function handleOptionals($element, &$optionals)
{
if (!\is_array($element)) {
$element = [$element];
}
$switch_context = false;
$attributes = [];
foreach ($optionals as $opt) {
if (\is_array($opt)) {
$attributes = $opt;
continue;
}
if (\is_bool($opt)) {
$switch_context = $opt;
continue;
}
if (\is_string($opt) || \is_numeric($opt)) {
$e = \array_pop($element);
$element[$e] = $opt;
continue;
}
}
return [$element, $attributes, $switch_context];
}