← All changes
|
libraries/vendor/PhpSpreadsheet/Worksheet/RowCellIterator.php
+38
-4
3.3.4
→
3.4
View file →
| @@ -141,9 +141,17 @@ | ||
| 141 | 141 | public function next(): void |
| 142 | 142 | { |
| 143 | 143 | do { |
| 144 | 144 | ++$this->currentColumnIndex; |
| 145 | - } while (($this->onlyExistingCells) && (!$this->cellCollection->has(Coordinate::stringFromColumnIndex($this->currentColumnIndex) . $this->rowIndex)) && ($this->currentColumnIndex <= $this->endColumnIndex)); | |
| 145 | + } while ( | |
| 146 | + $this->onlyExistingCells | |
| 147 | + && $this->currentColumnIndex <= $this->endColumnIndex | |
| 148 | + && !$this->cellCollection->has( | |
| 149 | + Coordinate::stringFromColumnIndex( | |
| 150 | + $this->currentColumnIndex | |
| 151 | + ) . $this->rowIndex | |
| 152 | + ) | |
| 153 | + ); | |
| 146 | 154 | } |
| 147 | 155 | |
| 148 | 156 | /** |
| 149 | 157 | * Set the iterator to its previous value. |
| @@ -151,9 +159,17 @@ | ||
| 151 | 159 | public function prev(): void |
| 152 | 160 | { |
| 153 | 161 | do { |
| 154 | 162 | --$this->currentColumnIndex; |
| 155 | - } while (($this->onlyExistingCells) && (!$this->cellCollection->has(Coordinate::stringFromColumnIndex($this->currentColumnIndex) . $this->rowIndex)) && ($this->currentColumnIndex >= $this->startColumnIndex)); | |
| 163 | + } while ( | |
| 164 | + $this->onlyExistingCells | |
| 165 | + && $this->currentColumnIndex >= $this->startColumnIndex | |
| 166 | + && !$this->cellCollection->has( | |
| 167 | + Coordinate::stringFromColumnIndex( | |
| 168 | + $this->currentColumnIndex | |
| 169 | + ) . $this->rowIndex | |
| 170 | + ) | |
| 171 | + ); | |
| 156 | 172 | } |
| 157 | 173 | |
| 158 | 174 | /** |
| 159 | 175 | * Indicate if more columns exist in the worksheet range of columns that we're iterating. |
| @@ -176,12 +192,30 @@ | ||
| 176 | 192 | */ |
| 177 | 193 | protected function adjustForExistingOnlyRange(): void |
| 178 | 194 | { |
| 179 | 195 | if ($this->onlyExistingCells) { |
| 180 | - while ((!$this->cellCollection->has(Coordinate::stringFromColumnIndex($this->startColumnIndex) . $this->rowIndex)) && ($this->startColumnIndex <= $this->endColumnIndex)) { | |
| 196 | + while ( | |
| 197 | + $this->startColumnIndex <= $this->endColumnIndex | |
| 198 | + && ( | |
| 199 | + !$this->cellCollection->has( | |
| 200 | + Coordinate::stringFromColumnIndex( | |
| 201 | + $this->startColumnIndex | |
| 202 | + ) . $this->rowIndex | |
| 203 | + ) | |
| 204 | + ) | |
| 205 | + ) { | |
| 181 | 206 | ++$this->startColumnIndex; |
| 182 | 207 | } |
| 183 | - while ((!$this->cellCollection->has(Coordinate::stringFromColumnIndex($this->endColumnIndex) . $this->rowIndex)) && ($this->endColumnIndex >= $this->startColumnIndex)) { | |
| 208 | + while ( | |
| 209 | + $this->endColumnIndex >= $this->startColumnIndex | |
| 210 | + && ( | |
| 211 | + !$this->cellCollection->has( | |
| 212 | + Coordinate::stringFromColumnIndex( | |
| 213 | + $this->endColumnIndex | |
| 214 | + ) . $this->rowIndex | |
| 215 | + ) | |
| 216 | + ) | |
| 217 | + ) { | |
| 184 | 218 | --$this->endColumnIndex; |
| 185 | 219 | } |
| 186 | 220 | } |
| 187 | 221 | } |