private function select($masks, $type)
{
$this->cursor =& $this->groups[];
$pattern = self::buildPattern($masks);
if ($type || $pattern) {
$this->filter(function (RecursiveDirectoryIterator $file) use($type, $pattern) {
return !$file->isDot() && (!$type || $file->{$type}()) && (!$pattern || preg_match($pattern, '/' . strtr($file->getSubPathName(), '\\', '/')));
});
}
return $this;
}