\Turba_List

The Turba_List:: class provides an interface for dealing with a list of Turba_Objects.

Copyright 2000-2017 Horde LLC (http://www.horde.org/)

See the enclosed file LICENSE for license information (ASL). If you did did not receive this file, see http://www.horde.org/licenses/apache.

Summary

Methods
Properties
Constants
__construct()
insert()
filter()
reset()
next()
sort()
count()
$objects
No constants found
_cmp()
$_usortCriteria
N/A
No private methods found
No private properties found
N/A

Properties

$objects

$objects : array

The array containing the Turba_Objects represented in this list.

Type

array

$_usortCriteria

$_usortCriteria : string

The field to compare objects by.

Type

string

Methods

__construct()

__construct(array  $ids = array()) 

Constructor.

Parameters

array $ids

insert()

insert(\Turba_Object  $object) 

Inserts a new object into the list.

Parameters

\Turba_Object $object

The object to insert.

filter()

filter(string  $field, array  $values) : \Turba_List

Returns a filtered list of objects.

Parameters

string $field

The field to filter on.

array $values

An array of values that $field must be equal to in order to be returned in the filtered list.

Returns

\Turba_List

The filtered list object.

reset()

reset() : \Turba_Object

Resets our internal pointer to the beginning of the list. Use this to hide the internal storage (array, list, etc.) from client objects.

Returns

\Turba_Object

The next object in the list.

next()

next() : \Turba_Object

Returns the next Turba_Object in the list. Use this to hide internal implementation details from client objects.

Returns

\Turba_Object

The next object in the list.

sort()

sort(array  $order = null) 

Filters/Sorts the list based on the specified sort routine.

The default sort order is by last name, ascending.

Parameters

array $order

Array of hashes describing sort fields. Each hash has the following fields:

ascending - (boolean) Sort direction.
field - (string) Sort field.

count()

count() 

_cmp()

_cmp(\Turba_Object  $a, \Turba_Object  $b) : integer

Usort helper function.

Compares two Turba_Objects based on the member variable $_usortCriteria, taking care to sort numerically if it is an integer field.

Parameters

\Turba_Object $a

The first Turba_Object to compare.

\Turba_Object $b

The second Turba_Object to compare.

Returns

integer —

Comparison of the two field values.