class Response implements ResponseInterface (View source)

CNR Response

Properties

protected string[] $command

The API Command used within this request

protected string $raw

plain API response

protected array<string, mixed> $hash

hash representation of plain API response

protected non-empty-string $paginationkeys

Regex for pagination related column keys

protected string[] $columnkeys

Column names available in this response

protected Column[] $columns

Container of Column Instances

protected int $recordIndex

Record Index we currently point to in record list

protected Record[] $records

Record List (List of rows)

protected array<string, mixed> $context

Context data for the response

protected string $requestUrl

API request url

Methods

__construct(string $raw, array $cmd = [], array $ph = [], array $context = [])

Constructor

array
getContext()

Get context data for the response

string
getRequestURL()

Get Request URL

int
getCode()

Get API response code

string
getDescription()

Get API response description

string
getPlain()

Get Plain API response

float
getQueuetime()

Get Queuetime of API response

array
getHash()

Get API response as Hash

float
getRuntime()

Get Runtime of API response

bool
isError()

Check if current API response represents an error case API response code is an 5xx code

bool
isSuccess()

Check if current API response represents a success case API response code is an 2xx code

bool
isTmpError()

Check if current API response represents a temporary error case API response code is an 4xx code

bool
isPending()

Check if current operation is returned as pending

addColumn(string $key, array $data)

Add a column to the column list

addRecord(array $h)

Add a record to the record list

getColumn(string $key)

Get column by column name

mixed
getColumnIndex(string $colkey, int $index)

Get Data by Column Name and Index

array
getColumnKeys(bool $filterPaginationKeys = false)

Get Column Names

array
getColumns()

Get List of Columns

array
getCommand()

Get Command used in this request

string
getCommandPlain()

Get Command used in this request in plain text format

int|null
getCurrentPageNumber()

Get Page Number of current List Query

getCurrentRecord()

Get Record of current record index

int|null
getFirstRecordIndex()

Get Index of first row in this response

int|null
getLastRecordIndex()

Get last record index of the current list query

array
getListHash()

Get Response as List Hash including useful meta data for tables

getNextRecord()

Get next record in record list

int|null
getNextPageNumber()

Get Page Number of next list query

int
getNumberOfPages()

Get the number of pages available for this list query

array
getPagination()

Get object containing all paging data

int|null
getPreviousPageNumber()

Get Page Number of previous list query

getPreviousRecord()

Get previous record in record list

getRecord(int $idx)

Get Record at given index

array
getRecords()

Get all Records

int
getRecordsCount()

Get count of rows in this response

int
getRecordsTotalCount()

Get total count of records available for the list query

int
getRecordsLimitation()

Get limit(ation) setting of the current list query This is the count of requested rows

bool
hasNextPage()

Check if this list query has a next page

bool
hasPreviousPage()

Check if this list query has a previous page

rewindRecordList()

Reset index in record list back to zero

Details

__construct(string $raw, array $cmd = [], array $ph = [], array $context = [])

Constructor

Parameters

string $raw

API plain response

array $cmd

API command used within this request

array $ph

placeholder array to get vars in response description dynamically replaced

array $context

context data for the response (for use in custom loggers etc., optional, has no impact on SDK behaviour)

array getContext()

Get context data for the response

Return Value

array

string getRequestURL()

Get Request URL

Return Value

string

Request URL

int getCode()

Get API response code

Return Value

int

API response code

string getDescription()

Get API response description

Return Value

string

API response description

string getPlain()

Get Plain API response

Return Value

string

Plain API response

float getQueuetime()

Get Queuetime of API response

Return Value

float

Queuetime of API response

array getHash()

Get API response as Hash

Return Value

array

API response hash

float getRuntime()

Get Runtime of API response

Return Value

float

Runtime of API response

bool isError()

Check if current API response represents an error case API response code is an 5xx code

Return Value

bool

boolean result

bool isSuccess()

Check if current API response represents a success case API response code is an 2xx code

Return Value

bool

boolean result

bool isTmpError()

Check if current API response represents a temporary error case API response code is an 4xx code

Return Value

bool result

bool isPending()

Check if current operation is returned as pending

Return Value

bool result

ResponseInterface addColumn(string $key, array $data)

Add a column to the column list

Parameters

string $key

column name

array $data

array of column data

Return Value

ResponseInterface

ResponseInterface addRecord(array $h)

Add a record to the record list

Parameters

array $h

row hash data

Return Value

ResponseInterface

ColumnInterface|null getColumn(string $key)

Get column by column name

Parameters

string $key

column name

Return Value

ColumnInterface|null

column instance or null if column does not exist

mixed getColumnIndex(string $colkey, int $index)

Get Data by Column Name and Index

Parameters

string $colkey

column name

int $index

column data index

Return Value

mixed

column data at index or null if not found

array getColumnKeys(bool $filterPaginationKeys = false)

Get Column Names

Parameters

bool $filterPaginationKeys

strip pagination columns

Return Value

array

Array of Column Names

array getColumns()

Get List of Columns

Return Value

array

Array of Columns

array getCommand()

Get Command used in this request

Return Value

array command

string getCommandPlain()

Get Command used in this request in plain text format

Return Value

string command

int|null getCurrentPageNumber()

Get Page Number of current List Query

Return Value

int|null

page number or null in case of a non-list response

RecordInterface|null getCurrentRecord()

Get Record of current record index

Return Value

RecordInterface|null

Record or null in case of a non-list response

int|null getFirstRecordIndex()

Get Index of first row in this response

Return Value

int|null

first row index

int|null getLastRecordIndex()

Get last record index of the current list query

Return Value

int|null

record index or null for a non-list response

array getListHash()

Get Response as List Hash including useful meta data for tables

Return Value

array

hash including list meta data and array of rows in hash notation

RecordInterface|null getNextRecord()

Get next record in record list

Return Value

RecordInterface|null

Record or null in case there's no further record

int|null getNextPageNumber()

Get Page Number of next list query

Return Value

int|null

page number or null if there's no next page

int getNumberOfPages()

Get the number of pages available for this list query

Return Value

int

number of pages

array getPagination()

Get object containing all paging data

Return Value

array

paginator data

int|null getPreviousPageNumber()

Get Page Number of previous list query

Return Value

int|null

page number or null if there's no previous page

RecordInterface|null getPreviousRecord()

Get previous record in record list

Return Value

RecordInterface|null

Record or null if there's no previous record

RecordInterface|null getRecord(int $idx)

Get Record at given index

Parameters

int $idx

record index

Return Value

RecordInterface|null

Record or null if index does not exist

array getRecords()

Get all Records

Return Value

array

array of records

int getRecordsCount()

Get count of rows in this response

Return Value

int

count of rows

int getRecordsTotalCount()

Get total count of records available for the list query

Return Value

int

total count of records or count of records for a non-list response

int getRecordsLimitation()

Get limit(ation) setting of the current list query This is the count of requested rows

Return Value

int

limit setting or count requested rows

bool hasNextPage()

Check if this list query has a next page

Return Value

bool

boolean result

bool hasPreviousPage()

Check if this list query has a previous page

Return Value

bool

boolean result

ResponseInterface rewindRecordList()

Reset index in record list back to zero

Return Value

ResponseInterface