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 / CellIterator.php

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

95 lines 2.1 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 Iterator as NativeIterator;
6 use PhpOffice\PhpSpreadsheet\Cell\Cell;
7 use PhpOffice\PhpSpreadsheet\Collection\Cells;
8
9 /**
10 * @template TKey
11 *
12 * @implements NativeIterator<TKey, Cell>
13 */
14 abstract class CellIterator implements NativeIterator
15 {
16 public const TREAT_NULL_VALUE_AS_EMPTY_CELL = 1;
17
18 public const TREAT_EMPTY_STRING_AS_EMPTY_CELL = 2;
19
20 public const IF_NOT_EXISTS_RETURN_NULL = false;
21
22 public const IF_NOT_EXISTS_CREATE_NEW = true;
23
24 /**
25 * Worksheet to iterate.
26 *
27 * @var Worksheet
28 */
29 protected $worksheet;
30
31 /**
32 * Cell Collection to iterate.
33 *
34 * @var Cells
35 */
36 protected $cellCollection;
37
38 /**
39 * Iterate only existing cells.
40 *
41 * @var bool
42 */
43 protected $onlyExistingCells = false;
44
45 /**
46 * If iterating all cells, and a cell doesn't exist, identifies whether a new cell should be created,
47 * or if the iterator should return a null value.
48 *
49 * @var bool
50 */
51 protected $ifNotExists = self::IF_NOT_EXISTS_CREATE_NEW;
52
53 /**
54 * Destructor.
55 */
56 public function __destruct()
57 {
58 // @phpstan-ignore-next-line
59 $this->worksheet = $this->cellCollection = null;
60 }
61
62 public function getIfNotExists(): bool
63 {
64 return $this->ifNotExists;
65 }
66
67 public function setIfNotExists(bool $ifNotExists = self::IF_NOT_EXISTS_CREATE_NEW): void
68 {
69 $this->ifNotExists = $ifNotExists;
70 }
71
72 /**
73 * Get loop only existing cells.
74 */
75 public function getIterateOnlyExistingCells(): bool
76 {
77 return $this->onlyExistingCells;
78 }
79
80 /**
81 * Validate start/end values for 'IterateOnlyExistingCells' mode, and adjust if necessary.
82 */
83 abstract protected function adjustForExistingOnlyRange(): void;
84
85 /**
86 * Set the iterator to loop only existing cells.
87 */
88 public function setIterateOnlyExistingCells(bool $value): void
89 {
90 $this->onlyExistingCells = (bool) $value;
91
92 $this->adjustForExistingOnlyRange();
93 }
94 }
95