TYPO3  7.6
FilterIterator.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the Symfony package.
5  *
6  * (c) Fabien Potencier <fabien@symfony.com>
7  *
8  * For the full copyright and license information, please view the LICENSE
9  * file that was distributed with this source code.
10  */
11 
12 namespace Symfony\Component\Finder\Iterator;
13 
21 abstract class FilterIterator extends \FilterIterator
22 {
29  public function rewind()
30  {
31  $iterator = $this;
32  while ($iterator instanceof \OuterIterator) {
33  $innerIterator = $iterator->getInnerIterator();
34 
35  if ($innerIterator instanceof RecursiveDirectoryIterator) {
36  if ($innerIterator->isRewindable()) {
37  $innerIterator->next();
38  $innerIterator->rewind();
39  }
40  } elseif ($iterator->getInnerIterator() instanceof \FilesystemIterator) {
41  $iterator->getInnerIterator()->next();
42  $iterator->getInnerIterator()->rewind();
43  }
44  $iterator = $iterator->getInnerIterator();
45  }
46 
47  parent::rewind();
48  }
49 }