ColumnInterface
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
Get column name
Get the number of data entries this column holds
Get column data
Get column data at given index
Get column data at given index, narrowed to a string.
Get column data at given index, parsed as a date/time value.
Details
string
getKey()
Get column name
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.
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.
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.
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()}.