public static function filterFiles($args, $allowWildcards = true)
{
$files = array();
foreach ($args as $arg) {
if (file_exists($arg)) {
$files[] = $arg;
} else {
if ($allowWildcards && strpos($arg, '*') !== false) {
$files = array_merge($files, glob($arg));
}
}
}
return $files;
}