Class MOXMAN_Util_ResultSet

InheritanceMOXMAN_Util_ResultSet

This class handles tabular resultsets like a database table.

Public Methods

Hide inherited methods

MethodDescriptionDefined By
__construct() Constructs a new result set instance. MOXMAN_Util_ResultSet
add() Adds a new row to the result set the number of arguments to this function must match the number of columns used in the instance creation. MOXMAN_Util_ResultSet
fromJson() Fills the result set with the specified array data. MOXMAN_Util_ResultSet
getCols() Returns the current column names. MOXMAN_Util_ResultSet
getHeader() Get the header as an name/value array. MOXMAN_Util_ResultSet
getRow() Returns the specified row by index or null if it wasn't found. MOXMAN_Util_ResultSet
getRowCount() Returns the current number of rows added to the result set. MOXMAN_Util_ResultSet
getRows() Returns an indexed array with name/value items of the internal structure. MOXMAN_Util_ResultSet
setHeaderItem() Sets a header item by name and value. MOXMAN_Util_ResultSet
toJson() Converts the internal structure to an array. This can then be serialized using JSON. MOXMAN_Util_ResultSet

Method Details

__construct() public method

Constructs a new result set instance.

public void __construct ( $cols, $header = [] )
$cols string

Comma separated list of columns.

$header Array

Name/value header array to attach to result set.

add() public method

Adds a new row to the result set the number of arguments to this function must match the number of columns used in the instance creation.

public void add ( )
fromJson() public static method

Fills the result set with the specified array data.

public static MOXMAN_Util_ResultSet fromJson ( $json )
$json Object

Json object to populate the ResultSet with.

return MOXMAN_Util_ResultSet

Result set instance based on the data.

getCols() public method

Returns the current column names.

public Array getCols ( )
return Array

Current columns as an array.

getHeader() public method

Get the header as an name/value array.

public Array getHeader ( )
return Array

Name/value array with header items.

getRow() public method

Returns the specified row by index or null if it wasn't found.

public Array getRow ( $index )
$index int

Index of item to retrive.

return Array

Name/value array with values.

getRowCount() public method

Returns the current number of rows added to the result set.

public int getRowCount ( )
return int

Number of rows added to result set.

getRows() public method

Returns an indexed array with name/value items of the internal structure.

public void getRows ( )
setHeaderItem() public method

Sets a header item by name and value.

public void setHeaderItem ( $name, $value )
$name string

Name to set in header.

$value Mixed

Value to set in header.

toJson() public method

Converts the internal structure to an array. This can then be serialized using JSON.

public Object toJson ( )
return Object

Name/value array with header, columns and data.