class Column extends Column (View source)

CNR Column

CNR responses are plaintext, so every column value is a string. This subclass exists purely to say so: it binds the shared column's TValue to string and narrows getDataByIndex() from mixed to ?string for callers holding a CNR-typed column. All behaviour is inherited — see {\CNIC\Column}.

Properties

int $length

count of column data entries

from  Column

Methods

__construct(string $columnName, array $data)

Constructor

from  Column
string
getKey()

Get column name

from  Column
array
getData()

Get column data

from  Column
mixed
getDataByIndex(int $recordIndex)

Get column data at given index

getDateTimeByIndex(int $recordIndex)

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

from  Column

Details

__construct(string $columnName, array $data)

Constructor

Parameters

string $columnName
array $data

Column Data

string getKey()

Get column name

Return Value

string

array getData()

Get column data

Return Value

array

mixed getDataByIndex(int $recordIndex)

Get column data at given index

Parameters

int $recordIndex

Return Value

mixed

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.

Parameters

int $recordIndex

Return Value

ApiDateTime|null