Column
class Column implements ColumnInterface (View source)
Shared Column implementation
Brand-neutral, immutable column of response data. Every brand stores the same
thing — a key plus an ordered bag of values — so all behaviour lives here and
is instantiated directly by each Response's addColumn(). What differs between
brands is only the value type: CNR responses are plaintext and carry strings,
IBS/Moniker responses are JSON and carry arbitrary values (nested arrays and
objects included). That difference is expressed by the TValue template
parameter, so CNR\Column extends Column<string> gains the narrower
getDataByIndex(): ?string without re-implementing anything.
Properties
| int | $length | count of column data entries |
Methods
Constructor
Get column name
Get column data
Get column data at given index
Get column data at given index, parsed as a date/time value.
Details
__construct(string $columnName, array $data)
Constructor
string
getKey()
Get column name
array
getData()
Get column data
mixed
getDataByIndex(int $recordIndex)
Get column data at given index
ApiDateTime|null
getDateTimeByIndex(int $recordIndex)
Get column data at given index, parsed as a date/time value.
Opt-in narrowing over {\CNIC\self::getDataByIndex()}: returns null for
an out-of-range index, a non-string value, or a string
{\CNIC\ApiDateTime::tryFrom()} cannot parse. There is no throwing variant
here — use ApiDateTime::from($col->getDataByIndex($recordIndex)) directly
if an unparsable value should be a loud failure instead.