Array manipulation in FileViewFinder::getPossibleViewFiles() should be a separate method

This commit is contained in:
QWp6t
2016-12-10 06:11:11 -08:00
parent 354c32e0de
commit fb6f01bac8

View File

@@ -7,7 +7,7 @@ class FileViewFinder extends \Illuminate\View\FileViewFinder
const FALLBACK_PARTS_DELIMITER = '-';
/**
* Get an array of possible view files.
* Get an array of possible view files from a single file name.
*
* @param string $name
* @return array
@@ -20,6 +20,17 @@ class FileViewFinder extends \Illuminate\View\FileViewFinder
$templates[] = $templates[$i].self::FALLBACK_PARTS_DELIMITER.$part;
}
rsort($templates);
return $this->getPossibleViewFilesFromTemplates($templates);
}
/**
* Get an array of possible view files from an array of templates
*
* @param array $templates
* @return array
*/
public function getPossibleViewFilesFromTemplates($templates)
{
return call_user_func_array('array_merge', array_map(function ($template) {
return array_map(function ($extension) use ($template) {
return str_replace('.', '/', $template).'.'.$extension;