Skip to content

Instantly share code, notes, and snippets.

@olekhy
Created May 23, 2012 12:52
Show Gist options
  • Save olekhy/2775083 to your computer and use it in GitHub Desktop.
Save olekhy/2775083 to your computer and use it in GitHub Desktop.
<?php
/**
* (non-PHPdoc)
* @see FilterIterator::accept()
*/
public function accept()
{
/* @var $file SplFileInfo */
$file = $this->current();
if ($this->isHidden($file->getFilename())) {
return false;
}
if ($file->isDir()) {
return false;
} else if ($file->isFile()) {
if (empty($this->fileExtensions)) {
return true;
} else {
$extension = pathinfo($file->getPathname(), PATHINFO_EXTENSION);
return in_array($extension, $this->fileExtensions);
}
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment