class DepthRangeFilterIterator in Database Sanitize 7
DepthRangeFilterIterator limits the directory depth.
@author Fabien Potencier <fabien@symfony.com>
Hierarchy
- class \Symfony\Component\Finder\Iterator\FilterIterator
- class \Symfony\Component\Finder\Iterator\FilterIterator
- class \Symfony\Component\Finder\Iterator\DepthRangeFilterIterator
- class \Symfony\Component\Finder\Iterator\FilterIterator
Expanded class hierarchy of DepthRangeFilterIterator
2 files declare their use of DepthRangeFilterIterator
- DepthRangeFilterIteratorTest.php in vendor/
symfony/ finder/ Tests/ Iterator/ DepthRangeFilterIteratorTest.php - Finder.php in vendor/
symfony/ finder/ Finder.php
File
- vendor/
symfony/ finder/ Iterator/ DepthRangeFilterIterator.php, line 19
Namespace
Symfony\Component\Finder\IteratorView source
class DepthRangeFilterIterator extends FilterIterator {
private $minDepth = 0;
/**
* @param \RecursiveIteratorIterator $iterator The Iterator to filter
* @param int $minDepth The min depth
* @param int $maxDepth The max depth
*/
public function __construct(\RecursiveIteratorIterator $iterator, $minDepth = 0, $maxDepth = PHP_INT_MAX) {
$this->minDepth = $minDepth;
$iterator
->setMaxDepth(PHP_INT_MAX === $maxDepth ? -1 : $maxDepth);
parent::__construct($iterator);
}
/**
* Filters the iterator values.
*
* @return bool true if the value should be kept, false otherwise
*/
public function accept() {
return $this
->getInnerIterator()
->getDepth() >= $this->minDepth;
}
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DepthRangeFilterIterator:: |
private | property | ||
DepthRangeFilterIterator:: |
public | function | Filters the iterator values. | |
DepthRangeFilterIterator:: |
public | function | ||
FilterIterator:: |
public | function |
This is a workaround for the problem with \FilterIterator leaving inner \FilesystemIterator in wrong state after
rewind in some cases. Overrides FilterIterator:: |
1 |