interface SS_Filterable implements SS_List

Additional interface for {@link SS_List} classes that are filterable.

All methods in this interface are immutable - they should return new instances with the filter applied, rather than applying the filter 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
array
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
mixed
each(callable $callback)

Walks the list using the specified callback

from SS_List
bool
canFilterBy(string $by)

Returns TRUE if the list can be filtered by a given field expression.

filter()

Return a new instance of this list that only includes items with these charactaristics

exclude()

Return a new instance of this list that excludes any items with these charactaristics

filterByCallback($callback)

Return a new instance of this list that excludes any items with these charactaristics Filter this List by a callback function. The function will be passed each record of the List in turn, and must return true for the record to be included. Returns the filtered list.

Details

in SS_List at line 15
array toArray()

Returns all the items in the list in an array.

Return Value

array

in SS_List at line 22
array toNestedArray()

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

Return Value

array

in SS_List at line 30
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 37
remove(mixed $item)

Removes an item from the list.

Parameters

mixed $item

in SS_List at line 44
mixed first()

Returns the first item in the list.

Return Value

mixed

in SS_List at line 51
mixed last()

Returns the last item in the list.

Return Value

mixed

in SS_List at line 61
array 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

array

in SS_List at line 71
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 79
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 87
mixed each(callable $callback)

Walks the list using the specified callback

Parameters

callable $callback

Return Value

mixed

at line 21
bool canFilterBy(string $by)

Returns TRUE if the list can be filtered by a given field expression.

Parameters

string $by

Return Value

bool

at line 34
SS_Filterable filter()

Return a new instance of this list that only includes items with these charactaristics

Return Value

SS_Filterable

at line 47
SS_Filterable exclude()

Return a new instance of this list that excludes any items with these charactaristics

Return Value

SS_Filterable

at line 57
SS_Filterable filterByCallback($callback)

Return a new instance of this list that excludes any items with these charactaristics Filter this List by a callback function. The function will be passed each record of the List in turn, and must return true for the record to be included. Returns the filtered list.

Parameters

$callback

Return Value

SS_Filterable