Use a FilterIterator rather than a modified IteratorIterator, simpler
parent
75d1759e77
commit
ecf4f42885
|
@ -25,7 +25,7 @@ use Symfony\Component\Finder;
|
||||||
*
|
*
|
||||||
* @author Nils Adermann <naderman@naderman.de>
|
* @author Nils Adermann <naderman@naderman.de>
|
||||||
*/
|
*/
|
||||||
class ArchivableFilesFinder extends \IteratorIterator
|
class ArchivableFilesFinder extends \FilterIterator
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var Symfony\Component\Finder\Finder
|
* @var Symfony\Component\Finder\Finder
|
||||||
|
@ -70,20 +70,8 @@ class ArchivableFilesFinder extends \IteratorIterator
|
||||||
parent::__construct($this->finder->getIterator());
|
parent::__construct($this->finder->getIterator());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function next()
|
public function accept()
|
||||||
{
|
{
|
||||||
do {
|
return !$this->getInnerIterator()->current()->isDir();
|
||||||
$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();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue