class Record implements RecordInterface (View source)

Shared Record implementation

Brand-neutral record (row) of a list response. Record data has one shape across brands (array<string,mixed>) and no brand has ever needed to read a row differently, so there is exactly one Record and every Response's newRecord() factory hook returns it. The hook itself stays a per-brand declaration: a brand that genuinely needs different row behaviour implements RecordInterface and returns that from its own newRecord() instead.

Methods

__construct(array $data)

Constructor e.g.

array
getData()

get row data

mixed
getDataByKey(string $columnName)

get row data for given column

getDateTimeByKey(string $columnName)

Get row data for given column, parsed as a date/time value.

Details

__construct(array $data)

Constructor e.g.

$data = [
  "DOMAIN" => "mydomain.com",
  "USER"   => "test.user",
  // ... further column data ...
];

Parameters

array $data

row data

array getData()

get row data

Return Value

array

row data

mixed getDataByKey(string $columnName)

get row data for given column

Parameters

string $columnName

Return Value

mixed

ApiDateTime|null getDateTimeByKey(string $columnName)

Get row data for given column, parsed as a date/time value.

Opt-in narrowing over {\CNIC\self::getDataByKey()}: returns null for a missing key, a non-string value, or a string {\CNIC\ApiDateTime::tryFrom()} cannot parse. There is no throwing variant here — use ApiDateTime::from($rec->getDataByKey($columnName)) directly if an unparsable value should be a loud failure instead.

Parameters

string $columnName

Return Value

ApiDateTime|null