interface Limitable implements SS_List

Additional interface for {@link SS_List} classes that are limitable - able to have a subset of the list extracted.

All methods in this interface are immutable - they should return new instances with the limit applied, rather than applying the limit in place

Methods

array
toArray()

Returns all the items in the list in an array.

from SS_List
array
toNestedArray()

Returns the contents of the list as an array of maps.

from SS_List
add(mixed $item)

Adds an item to the list, making no guarantees about where it will appear.

from SS_List
remove(mixed $item)

Removes an item from the list.

from SS_List
mixed
first()

Returns the first item in the list.

from SS_List
mixed
last()

Returns the last item in the list.

from SS_List
Map
map(string $keyfield = 'ID', string $titlefield = 'Title')

Returns a map of a key field to a value field of all the items in the list.

from SS_List
mixed
find(string $key, mixed $value)

Returns the first item in the list where the key field is equal to the value.

from SS_List
array
column(string $colName = "ID")

Returns an array of a single field value for all items in the list.

from SS_List
$this
each(callable $callback)

Walks the list using the specified callback

from SS_List
limit(int $limit, int $offset)

Returns a new instance of this list where no more than $limit records are included.

Details

in SS_List at line 20
array toArray()

Returns all the items in the list in an array.

Return Value

array

in SS_List at line 27
array toNestedArray()

Returns the contents of the list as an array of maps.

Return Value

array

in SS_List at line 35
add(mixed $item)

Adds an item to the list, making no guarantees about where it will appear.

Parameters

mixed $item

in SS_List at line 42
remove(mixed $item)

Removes an item from the list.

Parameters

mixed $item

in SS_List at line 49
mixed first()

Returns the first item in the list.

Return Value

mixed

in SS_List at line 56
mixed last()

Returns the last item in the list.

Return Value

mixed

in SS_List at line 66
Map map(string $keyfield = 'ID', string $titlefield = 'Title')

Returns a map of a key field to a value field of all the items in the list.

Parameters

string $keyfield
string $titlefield

Return Value

Map

in SS_List at line 76
mixed find(string $key, mixed $value)

Returns the first item in the list where the key field is equal to the value.

Parameters

string $key
mixed $value

Return Value

mixed

in SS_List at line 84
array column(string $colName = "ID")

Returns an array of a single field value for all items in the list.

Parameters

string $colName

Return Value

array

in SS_List at line 92
$this each(callable $callback)

Walks the list using the specified callback

Parameters

callable $callback

Return Value

$this

at line 25
Limitable limit(int $limit, int $offset)

Returns a new instance of this list where no more than $limit records are included.

If $offset is specified, then that many records at the beginning of the list will be skipped. This matches the behaviour of the SQL LIMIT clause.

Parameters

int $limit
int $offset

Return Value

Limitable