protected function arrayFromArrayOrTraversableOrCSVStatic($candidate, $useKeys = true)
{
if (true === $candidate instanceof \Traversable) {
return iterator_to_array($candidate, $useKeys);
} elseif (true === $candidate instanceof QueryResultInterface) {
/** @var QueryResultInterface $candidate */
return $candidate->toArray();
}
if (true === is_string($candidate)) {
return GeneralUtility::trimExplode(',', $candidate, true);
} elseif (true === is_array($candidate)) {
return $candidate;
}
throw new Exception('Unsupported input type; cannot convert to array!');
}