PluginProbe
wpDataTables – WordPress Data Table, Dynamic Tables & Table Charts Plugin / 6.5.1.7
wpDataTables – WordPress Data Table, Dynamic Tables & Table Charts Plugin v6.5.1.7
6.5.1.7 6.5.1.6 6.5.1.5 6.5.1.4 6.5.1.3 6.5.1.2 6.5.1.1 6.5.0.9 6.5.0.8 6.5.0.7 6.5.0.6 trunk 3.4.2.40 3.4.2.41 3.4.2.42 3.4.2.43 3.4.2.44 3.4.2.45 3.4.2.46 3.4.2.47 3.4.2.48 3.4.2.49 3.4.2.50 6.3.2 6.3.3.1 All 47 releases
wpdatatables / lib / phpoffice / phpspreadsheet / src / PhpSpreadsheet / Worksheet / Iterator.php

Iterator.php in wpDataTables – WordPress Data Table, Dynamic Tables & Table Charts Plugin 6.5.1.7, at lib/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Iterator.php

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