TYPO3  7.6
Iterator.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\Tests\Iterator;
13 
14 class Iterator implements \Iterator
15 {
16  protected $values = array();
17 
18  public function __construct(array $values = array())
19  {
20  foreach ($values as $value) {
21  $this->attach(new \SplFileInfo($value));
22  }
23  $this->rewind();
24  }
25 
26  public function attach(\SplFileInfo $fileinfo)
27  {
28  $this->values[] = $fileinfo;
29  }
30 
31  public function rewind()
32  {
33  reset($this->values);
34  }
35 
36  public function valid()
37  {
38  return false !== $this->current();
39  }
40 
41  public function next()
42  {
43  next($this->values);
44  }
45 
46  public function current()
47  {
48  return current($this->values);
49  }
50 
51  public function key()
52  {
53  return key($this->values);
54  }
55 }