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
Afficher le fichier Open project: horde/horde Class Usage Examples

Méthodes publiques

Свойство Type Description
$objects array The array containing the Turba_Objects represented in this list.

Protected Properties

Свойство Type Description
$_usortCriteria string The field to compare objects by.

Méthodes publiques

Méthode 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.

Méthodes protégées

Méthode Description
_cmp ( Turba_Object $a, Turba_Object $b ) : integer Usort helper function.

Method Details

__construct() public méthode

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

_cmp() protected méthode

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.
Résultat integer Comparison of the two field values.

count() public méthode

* Countable methods.
public count ( )

filter() public méthode

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.
Résultat Turba_List The filtered list object.

insert() public méthode

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

next() public méthode

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

reset() public méthode

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
Résultat Turba_Object The next object in the list.

sort() public méthode

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
Résultat string

$objects public_oe property

The array containing the Turba_Objects represented in this list.
public array $objects
Résultat array