Sha256: b9760c5d27a24e0e3166d4321b5e50b1033f73657d41dba56a09f8bb03d85fbe
Contents?: true
Size: 1.38 KB
Versions: 16
Compression:
Stored size: 1.38 KB
Contents
<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Finder\Iterator; use Symfony\Component\Finder\Comparator\NumberComparator; /** * SizeRangeFilterIterator filters out files that are not in the given size range. * * @author Fabien Potencier <fabien@symfony.com> */ class SizeRangeFilterIterator extends \FilterIterator { private $comparators = []; /** * @param \Iterator $iterator The Iterator to filter * @param NumberComparator[] $comparators An array of NumberComparator instances */ public function __construct(\Iterator $iterator, array $comparators) { $this->comparators = $comparators; parent::__construct($iterator); } /** * Filters the iterator values. * * @return bool true if the value should be kept, false otherwise */ public function accept() { $fileinfo = $this->current(); if (!$fileinfo->isFile()) { return true; } $filesize = $fileinfo->getSize(); foreach ($this->comparators as $compare) { if (!$compare->test($filesize)) { return false; } } return true; } }
Version data entries
16 entries across 16 versions & 1 rubygems