PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.11.0
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.11.0
4.0.8 4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.2 3.1.3 3.10.0 3.10.1 3.10.10 3.10.11 3.10.12 3.10.13 3.10.14 3.10.15 3.10.2 3.10.3 All 149 releases
visualizer / vendor / phpoffice / phpspreadsheet / src / PhpSpreadsheet / Worksheet / Iterator.php

Iterator.php in Visualizer – Tables & Charts Manager with Built-in AI Generator 3.11.0, at vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Iterator.php

88 lines 1.4 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 class Iterator implements \Iterator
8 {
9 /**
10 * Spreadsheet to iterate.
11 *
12 * @var Spreadsheet
13 */
14 private $subject;
15
16 /**
17 * Current iterator position.
18 *
19 * @var int
20 */
21 private $position = 0;
22
23 /**
24 * Create a new worksheet iterator.
25 *
26 * @param Spreadsheet $subject
27 */
28 public function __construct(Spreadsheet $subject)
29 {
30 // Set subject
31 $this->subject = $subject;
32 }
33
34 /**
35 * Destructor.
36 */
37 public function __destruct()
38 {
39 unset($this->subject);
40 }
41
42 /**
43 * Rewind iterator.
44 */
45 public function rewind()
46 {
47 $this->position = 0;
48 }
49
50 /**
51 * Current Worksheet.
52 *
53 * @return Worksheet
54 */
55 public function current()
56 {
57 return $this->subject->getSheet($this->position);
58 }
59
60 /**
61 * Current key.
62 *
63 * @return int
64 */
65 public function key()
66 {
67 return $this->position;
68 }
69
70 /**
71 * Next value.
72 */
73 public function next()
74 {
75 ++$this->position;
76 }
77
78 /**
79 * Are there more Worksheet instances available?
80 *
81 * @return bool
82 */
83 public function valid()
84 {
85 return $this->position < $this->subject->getSheetCount() && $this->position >= 0;
86 }
87 }
88