Elgg
Version 1.9
|
Public Member Functions | |
__construct (array $elements=array()) | |
Create a new priority list. More... | |
add ($element, $priority=null, $exact=false) | |
Adds an element to the list. More... | |
remove ($element, $strict=false) | |
Removes an element from the list. More... | |
move ($element, $new_priority, $strict=false) | |
Move an existing element to a new priority. More... | |
getElements () | |
Returns the elements. More... | |
sort ($callback=null) | |
Sort the elements optionally by a callback function. More... | |
getNextPriority ($near=0) | |
Returns the next priority available. More... | |
getPriority ($element, $strict=false) | |
Returns the priority of an element if it exists in the list. More... | |
getElement ($priority) | |
Returns the element at $priority. More... | |
contains ($element, $strict=false) | |
Returns if the list contains $element. More... | |
rewind () | |
Iterator. More... | |
current () | |
PHP Iterator Interface. More... | |
key () | |
PHP Iterator Interface. More... | |
next () | |
PHP Iterator Interface. More... | |
valid () | |
PHP Iterator Interface. More... | |
count () | |
Countable interface. More... | |
Definition at line 95 of file ElggPriorityList.php.
ElggPriorityList::__construct | ( | array | $elements = array() | ) |
Create a new priority list.
array | $elements | An optional array of priorities => element |
Definition at line 110 of file ElggPriorityList.php.
ElggPriorityList::add | ( | $element, | |
$priority = null , |
|||
$exact = false |
|||
) |
Adds an element to the list.
mixed | $element | The element to add to the list. |
mixed | $priority | Priority to add the element. In priority collisions, the original element maintains its priority and the new element is to the next available slot, taking into consideration all previously registered elements. Negative elements are accepted. |
bool | $exact | unused |
Definition at line 133 of file ElggPriorityList.php.
ElggPriorityList::contains | ( | $element, | |
$strict = false |
|||
) |
Returns if the list contains $element.
mixed | $element | The element to check. |
bool | $strict | Use strict checking? |
Definition at line 288 of file ElggPriorityList.php.
ElggPriorityList::count | ( | ) |
Countable interface.
Definition at line 363 of file ElggPriorityList.php.
ElggPriorityList::current | ( | ) |
PHP Iterator Interface.
Definition at line 318 of file ElggPriorityList.php.
ElggPriorityList::getElement | ( | $priority | ) |
Returns the element at $priority.
int | $priority | The priority |
Definition at line 277 of file ElggPriorityList.php.
ElggPriorityList::getElements | ( | ) |
ElggPriorityList::getNextPriority | ( | $near = 0 | ) |
Returns the next priority available.
int | $near | Make the priority as close to $near as possible. |
Definition at line 248 of file ElggPriorityList.php.
ElggPriorityList::getPriority | ( | $element, | |
$strict = false |
|||
) |
Returns the priority of an element if it exists in the list.
mixed | $element | The element to check for. |
bool | $strict | Use strict checking? |
Definition at line 267 of file ElggPriorityList.php.
ElggPriorityList::key | ( | ) |
PHP Iterator Interface.
Definition at line 329 of file ElggPriorityList.php.
ElggPriorityList::move | ( | $element, | |
$new_priority, | |||
$strict = false |
|||
) |
Move an existing element to a new priority.
mixed | $element | The element to move |
int | $new_priority | The new priority for the element |
bool | $strict | Whether to check the type of the element match |
Definition at line 173 of file ElggPriorityList.php.
ElggPriorityList::next | ( | ) |
PHP Iterator Interface.
Definition at line 340 of file ElggPriorityList.php.
ElggPriorityList::remove | ( | $element, | |
$strict = false |
|||
) |
Removes an element from the list.
mixed | $element | The element to remove from the list |
bool | $strict | Whether to check the type of the element match |
Definition at line 155 of file ElggPriorityList.php.
ElggPriorityList::rewind | ( | ) |
Iterator.
PHP Iterator Interface
Definition at line 307 of file ElggPriorityList.php.
ElggPriorityList::sort | ( | $callback = null | ) |
Sort the elements optionally by a callback function.
If no user function is provided the elements are sorted by priority registered.
The callback function should accept the array of elements as the first argument and should return a sorted array.
This function can be called multiple times.
callback | $callback | The callback for sorting. Numeric sorting is the default. |
Definition at line 214 of file ElggPriorityList.php.
ElggPriorityList::valid | ( | ) |
PHP Iterator Interface.
Definition at line 351 of file ElggPriorityList.php.