protected function fileSearch($art, $pattern)
{
foreach ($this->art_dirs as $dir) {
$directory_iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($dir));
$paths = [];
$regex = '~' . preg_quote($art) . $pattern . '~';
foreach ($directory_iterator as $file) {
if ($file->isDir()) {
continue;
}
// Look for anything that has the $art filename
if (preg_match($regex, $file)) {
$paths[] = $file->getPathname();
}
}
asort($paths);
// If we've got one, no need to look any further
if (!empty($paths)) {
return $paths;
}
}
return [];
}