in src/filesystem/FileFinder.php [119:189]
public function validateFile($file) {
if ($this->name) {
$matches = false;
foreach ($this->name as $curr_name) {
if (basename($file) === $curr_name) {
$matches = true;
break;
}
}
if (!$matches) {
return false;
}
}
if ($this->nameGlobs) {
$name = basename($file);
$matches = false;
foreach ($this->nameGlobs as $glob) {
$glob = addcslashes($glob, '\\');
if (fnmatch($glob, $name)) {
$matches = true;
break;
}
}
if (!$matches) {
return false;
}
}
if ($this->suffix) {
$matches = false;
foreach ($this->suffix as $suffix) {
$suffix = addcslashes($suffix, '\\?*');
$suffix = '*.'.$suffix;
if (fnmatch($suffix, $file)) {
$matches = true;
break;
}
}
if (!$matches) {
return false;
}
}
if ($this->paths) {
$matches = false;
foreach ($this->paths as $path) {
if (fnmatch($path, $this->root.'/'.$file)) {
$matches = true;
break;
}
}
if (!$matches) {
return false;
}
}
$fullpath = $this->root.'/'.ltrim($file, '/');
if (($this->type == 'f' && is_dir($fullpath))
|| ($this->type == 'd' && !is_dir($fullpath))) {
return false;
}
return true;
}