1
0
Fork 0

Use a FilterIterator rather than a modified IteratorIterator, simpler

pull/1567/head
Nils Adermann 2013-03-26 13:09:37 +01:00
parent 75d1759e77
commit ecf4f42885
1 changed files with 3 additions and 15 deletions

View File

@ -25,7 +25,7 @@ use Symfony\Component\Finder;
*
* @author Nils Adermann <naderman@naderman.de>
*/
class ArchivableFilesFinder extends \IteratorIterator
class ArchivableFilesFinder extends \FilterIterator
{
/**
* @var Symfony\Component\Finder\Finder
@ -70,20 +70,8 @@ class ArchivableFilesFinder extends \IteratorIterator
parent::__construct($this->finder->getIterator());
}
public function next()
public function accept()
{
do {
$this->getInnerIterator()->next();
} while ($this->getInnerIterator()->valid() && $this->getInnerIterator()->current()->isDir());
}
public function current()
{
return $this->getInnerIterator()->current();
}
public function valid()
{
return $this->getInnerIterator()->valid();
return !$this->getInnerIterator()->current()->isDir();
}
}