PHP Class Turba_List, horde

Copyright 2000-2016 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.
Author: Chuck Hagenbuch ([email protected])
Author: Jon Parise ([email protected])
Inheritance: implements Countable
Datei anzeigen Open project: horde/horde Class Usage Examples

Public Properties

Property Type Description
$objects array The array containing the Turba_Objects represented in this list.

Protected Properties

Property Type Description
$_usortCriteria string The field to compare objects by.

Public Methods

Method Description
__construct ( array $ids = [] ) Constructor.
count ( ) * Countable methods.
filter ( string $field, array $values ) : Turba_List Returns a filtered list of objects.
insert ( Turba_Object $object ) Inserts a new object into the list.
next ( ) : Turba_Object Returns the next Turba_Object in the list. Use this to hide internal implementation details from client objects.
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.
sort ( array $order = null ) Filters/Sorts the list based on the specified sort routine.

Protected Methods

Method Description
_cmp ( Turba_Object $a, Turba_Object $b ) : integer Usort helper function.

Method Details

__construct() public method

Constructor.
public __construct ( array $ids = [] )
$ids array

_cmp() protected method

Compares two Turba_Objects based on the member variable $_usortCriteria, taking care to sort numerically if it is an integer field.
protected _cmp ( Turba_Object $a, Turba_Object $b ) : integer
$a Turba_Object The first Turba_Object to compare.
$b Turba_Object The second Turba_Object to compare.
return integer Comparison of the two field values.

count() public method

* Countable methods.
public count ( )

filter() public method

Returns a filtered list of objects.
public filter ( string $field, array $values ) : Turba_List
$field string The field to filter on.
$values array An array of values that $field must be equal to in order to be returned in the filtered list.
return Turba_List The filtered list object.

insert() public method

Inserts a new object into the list.
public insert ( Turba_Object $object )
$object Turba_Object The object to insert.

next() public method

Returns the next Turba_Object in the list. Use this to hide internal implementation details from client objects.
public next ( ) : Turba_Object
return Turba_Object The next object in the list.

reset() public method

Resets our internal pointer to the beginning of the list. Use this to hide the internal storage (array, list, etc.) from client objects.
public reset ( ) : Turba_Object
return Turba_Object The next object in the list.

sort() public method

The default sort order is by last name, ascending.
public sort ( array $order = null )
$order array Array of hashes describing sort fields. Each hash has the following fields:
ascending - (boolean) Sort direction.
field - (string) Sort field.

Property Details

$_usortCriteria protected_oe property

The field to compare objects by.
protected string $_usortCriteria
return string

$objects public_oe property

The array containing the Turba_Objects represented in this list.
public array $objects
return array