ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Iterator.php
Go to the documentation of this file.
1 <?php
2 
4 
6 
7 class Iterator implements \Iterator
8 {
14  private $subject;
15 
21  private $position = 0;
22 
26  public function __construct(Spreadsheet $subject)
27  {
28  // Set subject
29  $this->subject = $subject;
30  }
31 
35  public function rewind(): void
36  {
37  $this->position = 0;
38  }
39 
43  public function current(): Worksheet
44  {
45  return $this->subject->getSheet($this->position);
46  }
47 
51  public function key(): int
52  {
53  return $this->position;
54  }
55 
59  public function next(): void
60  {
62  }
63 
69  public function valid()
70  {
71  return $this->position < $this->subject->getSheetCount() && $this->position >= 0;
72  }
73 }
__construct(Spreadsheet $subject)
Create a new worksheet iterator.
Definition: Iterator.php:26
valid()
Are there more Worksheet instances available?
Definition: Iterator.php:69