protected function parseView($view)
{
// Views passed as strings are treated as the HTML view
if (is_string($view)) {
return ['html' => $view];
}
// Numeric arrays are treated as [html, text]
if (is_array($view) && isset($view[0])) {
return ['html' => $view[0], 'text' => $view[1]];
}
// Non-numeric arrays are assumed to have named keys
if (is_array($view)) {
// Strip out empty views
return array_filter(['html' => Arr::get($view, 'html'), 'text' => Arr::get($view, 'text'), 'raw' => Arr::get($view, 'raw')]);
}
throw new InvalidArgumentException('Invalid view.');
}