PluginProbe
TablePress – Tables in WordPress made easy / 3.4
TablePress – Tables in WordPress made easy v3.4
3.4 3.3.4 3.3.3 3.3.2 3.3.1 trunk 1.12 1.14 1.9.2 2.0.4 2.1.7 2.1.8 2.2 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.3 2.3.1 2.3.2 2.4 2.4.1 2.4.2 2.4.3 All 45 releases
tablepress / libraries / vendor / PhpSpreadsheet / Worksheet / Iterator.php

Iterator.php in TablePress – Tables in WordPress made easy 3.4, at libraries/vendor/PhpSpreadsheet/Worksheet/Iterator.php

71 lines 1.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace TablePress\PhpOffice\PhpSpreadsheet\Worksheet;
4
5 use TablePress\PhpOffice\PhpSpreadsheet\Spreadsheet;
6
7 /**
8 * @implements \Iterator<int, Worksheet>
9 */
10 class Iterator implements \Iterator
11 {
12 /**
13 * Spreadsheet to iterate.
14 */
15 private Spreadsheet $subject;
16
17 /**
18 * Current iterator position.
19 */
20 private int $position = 0;
21
22 /**
23 * Create a new worksheet iterator.
24 */
25 public function __construct(Spreadsheet $subject)
26 {
27 // Set subject
28 $this->subject = $subject;
29 }
30
31 /**
32 * Rewind iterator.
33 */
34 public function rewind(): void
35 {
36 $this->position = 0;
37 }
38
39 /**
40 * Current Worksheet.
41 */
42 public function current(): Worksheet
43 {
44 return $this->subject->getSheet($this->position);
45 }
46
47 /**
48 * Current key.
49 */
50 public function key(): int
51 {
52 return $this->position;
53 }
54
55 /**
56 * Next value.
57 */
58 public function next(): void
59 {
60 ++$this->position;
61 }
62
63 /**
64 * Are there more Worksheet instances available?
65 */
66 public function valid(): bool
67 {
68 return $this->position < $this->subject->getSheetCount() && $this->position >= 0;
69 }
70 }
71