Sha256: e3e95986449fc7ca20e20cf82fcac1767b91deb915e82b8d1de2bf083c50ad65

Contents?: true

Size: 1.21 KB

Versions: 40

Compression:

Stored size: 1.21 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;

/**
 * DepthRangeFilterIterator limits the directory depth.
 *
 * @author Fabien Potencier <fabien@symfony.com>
 */
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, int $minDepth = 0, int $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;
    }
}

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
dependabot-composer-0.112.1 helpers/vendor/symfony/finder/Iterator/DepthRangeFilterIterator.php
dependabot-composer-0.111.57 helpers/vendor/symfony/finder/Iterator/DepthRangeFilterIterator.php
dependabot-composer-0.111.56 helpers/vendor/symfony/finder/Iterator/DepthRangeFilterIterator.php
dependabot-composer-0.111.52 helpers/vendor/symfony/finder/Iterator/DepthRangeFilterIterator.php
dependabot-composer-0.111.50 helpers/vendor/symfony/finder/Iterator/DepthRangeFilterIterator.php
dependabot-composer-0.111.25 helpers/vendor/symfony/finder/Iterator/DepthRangeFilterIterator.php
dependabot-composer-0.111.17 helpers/vendor/symfony/finder/Iterator/DepthRangeFilterIterator.php
dependabot-composer-0.111.15 helpers/vendor/symfony/finder/Iterator/DepthRangeFilterIterator.php
dependabot-composer-0.110.13 helpers/vendor/symfony/finder/Iterator/DepthRangeFilterIterator.php
dependabot-composer-0.108.11 helpers/vendor/symfony/finder/Iterator/DepthRangeFilterIterator.php
dependabot-composer-0.108.8 helpers/vendor/symfony/finder/Iterator/DepthRangeFilterIterator.php
dependabot-composer-0.107.47 helpers/vendor/symfony/finder/Iterator/DepthRangeFilterIterator.php
dependabot-composer-0.107.39 helpers/vendor/symfony/finder/Iterator/DepthRangeFilterIterator.php
dependabot-composer-0.107.36 helpers/vendor/symfony/finder/Iterator/DepthRangeFilterIterator.php
dependabot-composer-0.107.28 helpers/vendor/symfony/finder/Iterator/DepthRangeFilterIterator.php
dependabot-composer-0.107.14 helpers/vendor/symfony/finder/Iterator/DepthRangeFilterIterator.php
dependabot-composer-0.106.12 helpers/vendor/symfony/finder/Iterator/DepthRangeFilterIterator.php
dependabot-composer-0.106.11 helpers/vendor/symfony/finder/Iterator/DepthRangeFilterIterator.php
dependabot-composer-0.106.5 helpers/vendor/symfony/finder/Iterator/DepthRangeFilterIterator.php
dependabot-composer-0.100.2 helpers/vendor/symfony/finder/Iterator/DepthRangeFilterIterator.php