interface ColumnInterface (View source)

Common Column Interface

Declares what a column can be asked, not how it is built. Do not re-add a __construct() declaration: nothing constructs through this type (columns come from a brand's addColumn(), which names its concrete class), and PHP does enforce a constructor declared on an interface — unlike one inherited from a parent class — so the declaration constrained every implementer without giving a caller anything. Guarded by tests/RecordColumnSeamTest.php; rationale in docs/agents/architecture.md.

Methods

string
getKey()

Get column name

int
getLength()

Get the number of data entries this column holds

array
getData()

Get column data

mixed
getDataByIndex(int $recordIndex)

Get column data at given index

string|null
getStringByIndex(int $recordIndex)

Get column data at given index, narrowed to a string.

getDateTimeByIndex(int $recordIndex)

Get column data at given index, parsed as a date/time value.

Details

string getKey()

Get column name

Return Value

string

int getLength()

Get the number of data entries this column holds

Declared here rather than left as the public readonly int $length property it was until RSRMID-2971: a PHP 8.3 interface cannot declare a property, so that property was reachable only by narrowing to {\CNIC\Column} — the one thing this project tells consumers not to do.

Return Value

int

array getData()

Get column data

Return Value

array

mixed getDataByIndex(int $recordIndex)

Get column data at given index

Parameters

int $recordIndex

Return Value

mixed

string|null getStringByIndex(int $recordIndex)

Get column data at given index, narrowed to a string.

Returns null for an out-of-range index or a non-string value. CNR cells are always strings; IBS/Moniker JSON cells may be nested arrays or objects, which yield null here — use {\CNIC\self::getDataByIndex()} for the raw value in that case.

Parameters

int $recordIndex

Return Value

string|null

ApiDateTime|null getDateTimeByIndex(int $recordIndex)

Get column data at given index, parsed as a date/time value.

Returns null for an out-of-range index, a non-string value, or a string that cannot be parsed — see {\CNIC\ApiDateTime::tryFrom()}.

Parameters

int $recordIndex

Return Value

ApiDateTime|null