public static function filterPath($path, $options)
{
if (isset($options['filter'])) {
$result = call_user_func($options['filter'], $path);
if (is_bool($result)) {
return $result;
}
}
if (empty($options['except']) && empty($options['only'])) {
return true;
}
$path = str_replace('\\', '/', $path);
if (!empty($options['except'])) {
if (($except = self::lastExcludeMatchingFromList($options['basePath'], $path, $options['except'])) !== null) {
return $except['flags'] & self::PATTERN_NEGATIVE;
}
}
if (!empty($options['only']) && !is_dir($path)) {
if (($except = self::lastExcludeMatchingFromList($options['basePath'], $path, $options['only'])) !== null) {
// don't check PATTERN_NEGATIVE since those entries are not prefixed with !
return true;
}
return false;
}
return true;
}