Cells
Table of Contents
- MAX_COLUMN_ID = 16384
- $cache : CacheInterface
- $cachePrefix : string
- Prefix used to uniquely identify cache data for this worksheet.
- $currentCell : null|Cell
- The currently active Cell.
- $currentCellIsDirty : bool
- Flag indicating whether the currently active Cell requires saving.
- $currentCoordinate : null|string
- Coordinate of the currently active Cell.
- $index : array<string|int, int>
- An index of existing cells. int pointer to the coordinate (0-base-indexed row * 16,384 + 1-base indexed column) indexed by their coordinate.
- $parent : null|Worksheet
- Parent worksheet.
- __construct() : mixed
- Initialise this new cell collection.
- __destruct() : mixed
- Destroy this cell collection.
- add() : Cell
- Add or update a cell identified by its coordinate into the collection.
- cloneCellCollection() : self
- Clone the cell collection.
- delete() : void
- Delete a cell in cache identified by coordinate.
- get() : null|Cell
- Get cell at a specific coordinate.
- getCoordinates() : array<string|int, string>
- Get a list of all cell coordinates currently held in the collection.
- getCurrentColumn() : string
- Return the column coordinate of the currently active cell object.
- getCurrentCoordinate() : null|string
- Return the cell coordinate of the currently active cell object.
- getCurrentRow() : int
- Return the row coordinate of the currently active cell object.
- getHighestColumn() : string
- Get highest worksheet column.
- getHighestRow() : int
- Get highest worksheet row.
- getHighestRowAndColumn() : array<string|int, mixed>
- Get highest worksheet column and highest row that have cell records.
- getParent() : null|Worksheet
- Return the parent worksheet for this cell collection.
- getSortedCoordinates() : array<string|int, string>
- Get a sorted list of all cell coordinates currently held in the collection by row and column.
- has() : bool
- Whether the collection holds a cell for the given coordinate.
- removeColumn() : void
- Remove a column, deleting all cells in that column.
- removeRow() : void
- Remove a row, deleting all cells in that row.
- unsetWorksheetCells() : void
- Clear the cell collection and disconnect from our parent.
- update() : Cell
- Add or update a cell in the collection.
- destructIfNeeded() : void
- getAllCacheKeys() : Generator|array<string|int, string>
- Returns all known cache keys.
- getUniqueID() : string
- Generate a unique ID for cache referencing.
- storeCurrentCell() : void
- Store cell data in cache for the current cell object if it's "dirty", and the 'nullify' the current cell object.
Constants
MAX_COLUMN_ID
protected
mixed
MAX_COLUMN_ID
= 16384
Properties
$cache
private
CacheInterface
$cache
$cachePrefix
Prefix used to uniquely identify cache data for this worksheet.
private
string
$cachePrefix
$currentCell
The currently active Cell.
private
null|Cell
$currentCell
$currentCellIsDirty
Flag indicating whether the currently active Cell requires saving.
private
bool
$currentCellIsDirty
= false
$currentCoordinate
Coordinate of the currently active Cell.
private
null|string
$currentCoordinate
$index
An index of existing cells. int pointer to the coordinate (0-base-indexed row * 16,384 + 1-base indexed column) indexed by their coordinate.
private
array<string|int, int>
$index
= []
$parent
Parent worksheet.
private
null|Worksheet
$parent
Methods
__construct()
Initialise this new cell collection.
public
__construct(Worksheet $parent, CacheInterface $cache) : mixed
Parameters
- $parent : Worksheet
-
The worksheet for this cell collection
- $cache : CacheInterface
Return values
mixed —__destruct()
Destroy this cell collection.
public
__destruct() : mixed
Return values
mixed —add()
Add or update a cell identified by its coordinate into the collection.
public
add(string $cellCoordinate, Cell $cell) : Cell
Parameters
- $cellCoordinate : string
-
Coordinate of the cell to update
- $cell : Cell
-
Cell to update
Return values
Cell —cloneCellCollection()
Clone the cell collection.
public
cloneCellCollection(Worksheet $worksheet) : self
Parameters
- $worksheet : Worksheet
Return values
self —delete()
Delete a cell in cache identified by coordinate.
public
delete(string $cellCoordinate) : void
Parameters
- $cellCoordinate : string
-
Coordinate of the cell to delete
Return values
void —get()
Get cell at a specific coordinate.
public
get(string $cellCoordinate) : null|Cell
Parameters
- $cellCoordinate : string
-
Coordinate of the cell
Return values
null|Cell —Cell that was found, or null if not found
getCoordinates()
Get a list of all cell coordinates currently held in the collection.
public
getCoordinates() : array<string|int, string>
Return values
array<string|int, string> —getCurrentColumn()
Return the column coordinate of the currently active cell object.
public
getCurrentColumn() : string
Return values
string —getCurrentCoordinate()
Return the cell coordinate of the currently active cell object.
public
getCurrentCoordinate() : null|string
Return values
null|string —getCurrentRow()
Return the row coordinate of the currently active cell object.
public
getCurrentRow() : int
Return values
int —getHighestColumn()
Get highest worksheet column.
public
getHighestColumn([null|int|string $row = null ]) : string
Parameters
- $row : null|int|string = null
-
Return the highest column for the specified row, or the highest column of any row if no row number is passed
Return values
string —Highest column name
getHighestRow()
Get highest worksheet row.
public
getHighestRow([null|string $column = null ]) : int
Parameters
- $column : null|string = null
-
Return the highest row for the specified column, or the highest row of any column if no column letter is passed
Return values
int —Highest row number
getHighestRowAndColumn()
Get highest worksheet column and highest row that have cell records.
public
getHighestRowAndColumn() : array<string|int, mixed>
Return values
array<string|int, mixed> —Highest column name and highest row number
getParent()
Return the parent worksheet for this cell collection.
public
getParent() : null|Worksheet
Return values
null|Worksheet —getSortedCoordinates()
Get a sorted list of all cell coordinates currently held in the collection by row and column.
public
getSortedCoordinates() : array<string|int, string>
Return values
array<string|int, string> —has()
Whether the collection holds a cell for the given coordinate.
public
has(string $cellCoordinate) : bool
Parameters
- $cellCoordinate : string
-
Coordinate of the cell to check
Return values
bool —removeColumn()
Remove a column, deleting all cells in that column.
public
removeColumn(string $column) : void
Parameters
- $column : string
-
Column ID to remove
Return values
void —removeRow()
Remove a row, deleting all cells in that row.
public
removeRow(int|string $row) : void
Parameters
- $row : int|string
-
Row number to remove
Return values
void —unsetWorksheetCells()
Clear the cell collection and disconnect from our parent.
public
unsetWorksheetCells() : void
Return values
void —update()
Add or update a cell in the collection.
public
update(Cell $cell) : Cell
Parameters
- $cell : Cell
-
Cell to update
Return values
Cell —destructIfNeeded()
private
destructIfNeeded(self $cells, string $message) : void
Parameters
- $cells : self
- $message : string
Return values
void —getAllCacheKeys()
Returns all known cache keys.
private
getAllCacheKeys() : Generator|array<string|int, string>
Return values
Generator|array<string|int, string> —getUniqueID()
Generate a unique ID for cache referencing.
private
getUniqueID() : string
Return values
string —Unique Reference
storeCurrentCell()
Store cell data in cache for the current cell object if it's "dirty", and the 'nullify' the current cell object.
private
storeCurrentCell() : void