ColumnCellIterator
extends CellIterator
in package
Tags
Table of Contents
Constants
- IF_NOT_EXISTS_CREATE_NEW = true
- IF_NOT_EXISTS_RETURN_NULL = false
- TREAT_EMPTY_STRING_AS_EMPTY_CELL = 2
- TREAT_NULL_VALUE_AS_EMPTY_CELL = 1
Properties
- $cellCollection : Cells
- Cell Collection to iterate.
- $ifNotExists : bool
- If iterating all cells, and a cell doesn't exist, identifies whether a new cell should be created, or if the iterator should return a null value.
- $onlyExistingCells : bool
- Iterate only existing cells.
- $worksheet : Worksheet
- Worksheet to iterate.
- $columnIndex : int
- Column index.
- $currentRow : int
- Current iterator position.
- $endRow : int
- End position.
- $startRow : int
- Start position.
Methods
- __construct() : mixed
- Create a new row iterator.
- __destruct() : mixed
- Destructor.
- current() : Cell|null
- Return the current cell in this worksheet column.
- getIfNotExists() : bool
- getIterateOnlyExistingCells() : bool
- Get loop only existing cells.
- key() : int
- Return the current iterator key.
- next() : void
- Set the iterator to its next value.
- prev() : void
- Set the iterator to its previous value.
- resetEnd() : $this
- (Re)Set the end row.
- resetStart() : $this
- (Re)Set the start row and the current row pointer.
- rewind() : void
- Rewind the iterator to the starting row.
- seek() : $this
- Set the row pointer to the selected row.
- setIfNotExists() : void
- setIterateOnlyExistingCells() : void
- Set the iterator to loop only existing cells.
- valid() : bool
- Indicate if more rows exist in the worksheet range of rows that we're iterating.
- adjustForExistingOnlyRange() : void
- Validate start/end values for "IterateOnlyExistingCells" mode, and adjust if necessary.
Constants
IF_NOT_EXISTS_CREATE_NEW
public
mixed
IF_NOT_EXISTS_CREATE_NEW
= true
IF_NOT_EXISTS_RETURN_NULL
public
mixed
IF_NOT_EXISTS_RETURN_NULL
= false
TREAT_EMPTY_STRING_AS_EMPTY_CELL
public
mixed
TREAT_EMPTY_STRING_AS_EMPTY_CELL
= 2
TREAT_NULL_VALUE_AS_EMPTY_CELL
public
mixed
TREAT_NULL_VALUE_AS_EMPTY_CELL
= 1
Properties
$cellCollection
Cell Collection to iterate.
protected
Cells
$cellCollection
$ifNotExists
If iterating all cells, and a cell doesn't exist, identifies whether a new cell should be created, or if the iterator should return a null value.
protected
bool
$ifNotExists
= self::IF_NOT_EXISTS_CREATE_NEW
$onlyExistingCells
Iterate only existing cells.
protected
bool
$onlyExistingCells
= false
$worksheet
Worksheet to iterate.
protected
Worksheet
$worksheet
$columnIndex
Column index.
private
int
$columnIndex
$currentRow
Current iterator position.
private
int
$currentRow
$endRow
End position.
private
int
$endRow
= 1
$startRow
Start position.
private
int
$startRow
= 1
Methods
__construct()
Create a new row iterator.
public
__construct(Worksheet $worksheet[, string $columnIndex = 'A' ][, int $startRow = 1 ][, int|null $endRow = null ][, bool $iterateOnlyExistingCells = false ]) : mixed
Parameters
- $worksheet : Worksheet
-
The worksheet to iterate over
- $columnIndex : string = 'A'
-
The column that we want to iterate
- $startRow : int = 1
-
The row number at which to start iterating
- $endRow : int|null = null
-
Optionally, the row number at which to stop iterating
- $iterateOnlyExistingCells : bool = false
__destruct()
Destructor.
public
__destruct() : mixed
current()
Return the current cell in this worksheet column.
public
current() : Cell|null
Return values
Cell|nullgetIfNotExists()
public
getIfNotExists() : bool
Return values
boolgetIterateOnlyExistingCells()
Get loop only existing cells.
public
getIterateOnlyExistingCells() : bool
Return values
boolkey()
Return the current iterator key.
public
key() : int
Return values
intnext()
Set the iterator to its next value.
public
next() : void
prev()
Set the iterator to its previous value.
public
prev() : void
resetEnd()
(Re)Set the end row.
public
resetEnd([int|null $endRow = null ]) : $this
Parameters
- $endRow : int|null = null
-
The row number at which to stop iterating
Return values
$thisresetStart()
(Re)Set the start row and the current row pointer.
public
resetStart([int $startRow = 1 ]) : $this
Parameters
- $startRow : int = 1
-
The row number at which to start iterating
Return values
$thisrewind()
Rewind the iterator to the starting row.
public
rewind() : void
seek()
Set the row pointer to the selected row.
public
seek([int $row = 1 ]) : $this
Parameters
- $row : int = 1
-
The row number to set the current pointer at
Return values
$thissetIfNotExists()
public
setIfNotExists([bool $ifNotExists = self::IF_NOT_EXISTS_CREATE_NEW ]) : void
Parameters
- $ifNotExists : bool = self::IF_NOT_EXISTS_CREATE_NEW
setIterateOnlyExistingCells()
Set the iterator to loop only existing cells.
public
setIterateOnlyExistingCells(bool $value) : void
Parameters
- $value : bool
valid()
Indicate if more rows exist in the worksheet range of rows that we're iterating.
public
valid() : bool
Return values
booladjustForExistingOnlyRange()
Validate start/end values for "IterateOnlyExistingCells" mode, and adjust if necessary.
protected
adjustForExistingOnlyRange() : void