SortableCollectionInterface

Interface for collection class being sortable

This interface allows you to either define a callback implementing your own sorting method and explicitly move an item from one position to another.

This assumes that entries are sortable and therefore an index can be assigned

Table of Contents

Methods

moveItemAt()  : mixed
Moves the item within the collection
usort()  : mixed
Sorts collection via given callBackFunction

Methods

moveItemAt()

Moves the item within the collection

public moveItemAt(int $currentPosition[, int $newPosition = 0 ]) : mixed

The item at $currentPosition will be moved to $newPosition. Omitting $newPosition will move to top.

Parameters
$currentPosition : int
$newPosition : int = 0

usort()

Sorts collection via given callBackFunction

public usort(callable $callbackFunction) : mixed

The comparison function given as must return an integer less than, equal to, or greater than zero if the first argument is considered to be respectively less than, equal to, or greater than the second.

Parameters
$callbackFunction : callable
Tags
see
http://www.php.net/manual/en/function.usort.php

        
On this page

Search results