Cells
in package
Table of Contents
Constants
- MAX_COLUMN_ID = 16384
Properties
- $cache : CacheInterface
- $cachePrefix : string
- Prefix used to uniquely identify cache data for this worksheet.
- $currentCell : Cell|null
- The currently active Cell.
- $currentCellIsDirty : bool
- Flag indicating whether the currently active Cell requires saving.
- $currentCoordinate : string|null
- 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 : Worksheet|null
- Parent worksheet.
Methods
- __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() : static
- 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() : string|null
- 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() : Worksheet|null
- 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.
- getSortedCoordinatesInt() : array<string|int, int>
- Get a sorted list of all cell coordinates currently held in the collection by index (16384*row+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() : iterable<string|int, string>
- Returns all known cache keys.
- getCache() : Cell
- 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
Cell|null
$currentCell
= null
$currentCellIsDirty
Flag indicating whether the currently active Cell requires saving.
private
bool
$currentCellIsDirty
= false
$currentCoordinate
Coordinate of the currently active Cell.
private
string|null
$currentCoordinate
= null
$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
Worksheet|null
$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
__destruct()
Destroy this cell collection.
public
__destruct() : 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
CellcloneCellCollection()
Clone the cell collection.
public
cloneCellCollection(Worksheet $worksheet) : static
Parameters
- $worksheet : Worksheet
Return values
staticdelete()
Delete a cell in cache identified by coordinate.
public
delete(string $cellCoordinate) : void
Parameters
- $cellCoordinate : string
-
Coordinate of the cell to delete
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
stringgetCurrentCoordinate()
Return the cell coordinate of the currently active cell object.
public
getCurrentCoordinate() : string|null
Return values
string|nullgetCurrentRow()
Return the row coordinate of the currently active cell object.
public
getCurrentRow() : int
Return values
intgetHighestColumn()
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() : Worksheet|null
Return values
Worksheet|nullgetSortedCoordinates()
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>getSortedCoordinatesInt()
Get a sorted list of all cell coordinates currently held in the collection by index (16384*row+column).
public
getSortedCoordinatesInt() : array<string|int, int>
Return values
array<string|int, int>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
boolremoveColumn()
Remove a column, deleting all cells in that column.
public
removeColumn(string $column) : void
Parameters
- $column : string
-
Column ID to remove
removeRow()
Remove a row, deleting all cells in that row.
public
removeRow(int|string $row) : void
Parameters
- $row : int|string
-
Row number to remove
unsetWorksheetCells()
Clear the cell collection and disconnect from our parent.
public
unsetWorksheetCells() : void
update()
Add or update a cell in the collection.
public
update(Cell $cell) : Cell
Parameters
- $cell : Cell
-
Cell to update
Return values
CelldestructIfNeeded()
private
destructIfNeeded(self $cells, string $message) : void
Parameters
- $cells : self
- $message : string
getAllCacheKeys()
Returns all known cache keys.
private
getAllCacheKeys() : iterable<string|int, string>
Return values
iterable<string|int, string>getCache()
private
getCache(string $cellCoordinate) : Cell
Parameters
- $cellCoordinate : string
Return values
CellgetUniqueID()
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