Skip to content

Instantly share code, notes, and snippets.

@thiagorock22
Created May 21, 2013 22:51
Show Gist options
  • Save thiagorock22/5623909 to your computer and use it in GitHub Desktop.
Save thiagorock22/5623909 to your computer and use it in GitHub Desktop.
Implementação de um iterator para listar pastas que são workspace do SVN
class SVN_WorkspaceIterator extends FilterIterator {
protected $ext = ".svn";
public function __construct (DirectoryIterator $iterator) {
parent::__construct($iterator);
}
public function accept() {
return ( ($this->isDir()) && (!$this->isDot()) && file_exists($this->getPathname().'/'.$this->ext));
}
}
$dir = new SVN_WorkspaceIterator(new DirectoryIterator("/var/www"));
foreach ($dir as $v) {
echo $v->getFilename(); echo "\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment