| 1 | <?php |
||
| 11 | class SheetIterator implements IteratorInterface |
||
| 12 | { |
||
| 13 | /** @var \Box\Spout\Reader\CSV\Sheet The CSV unique "sheet" */ |
||
| 14 | protected $sheet; |
||
| 15 | |||
| 16 | /** @var bool Whether the unique "sheet" has already been read */ |
||
| 17 | protected $hasReadUniqueSheet = false; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * @param Sheet $sheet Corresponding unique sheet |
||
| 21 | */ |
||
| 22 | 27 | public function __construct($sheet) |
|
| 23 | { |
||
| 24 | 27 | $this->sheet = $sheet; |
|
| 25 | 27 | } |
|
| 26 | |||
| 27 | /** |
||
| 28 | * Rewind the Iterator to the first element |
||
| 29 | * @see http://php.net/manual/en/iterator.rewind.php |
||
| 30 | * |
||
| 31 | * @return void |
||
| 32 | */ |
||
| 33 | 26 | public function rewind() |
|
| 37 | |||
| 38 | /** |
||
| 39 | * Checks if current position is valid |
||
| 40 | * @see http://php.net/manual/en/iterator.valid.php |
||
| 41 | * |
||
| 42 | * @return bool |
||
| 43 | */ |
||
| 44 | 26 | public function valid() |
|
| 48 | |||
| 49 | /** |
||
| 50 | * Move forward to next element |
||
| 51 | * @see http://php.net/manual/en/iterator.next.php |
||
| 52 | * |
||
| 53 | * @return void |
||
| 54 | */ |
||
| 55 | 26 | public function next() |
|
| 59 | |||
| 60 | /** |
||
| 61 | * Return the current element |
||
| 62 | * @see http://php.net/manual/en/iterator.current.php |
||
| 63 | * |
||
| 64 | * @return \Box\Spout\Reader\CSV\Sheet |
||
| 65 | */ |
||
| 66 | 27 | public function current() |
|
| 70 | |||
| 71 | /** |
||
| 72 | * Return the key of the current element |
||
| 73 | * @see http://php.net/manual/en/iterator.key.php |
||
| 74 | * |
||
| 75 | * @return int |
||
| 76 | */ |
||
| 77 | 20 | public function key() |
|
| 81 | |||
| 82 | /** |
||
| 83 | * Cleans up what was created to iterate over the object. |
||
| 84 | * |
||
| 85 | * @return void |
||
| 86 | */ |
||
| 87 | 27 | public function end() |
|
| 91 | } |
||
| 92 |