[CLEANUP] Code cleanup in ext:core/Collection
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Classes / Collection / SortableCollectionInterface.php
1 <?php
2 namespace TYPO3\CMS\Core\Collection;
3
4 /**
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16
17 /**
18 * Interface for collection class being sortable
19 *
20 * This interface allows you to either define a callback implementing
21 * your own sorting method and explicitly move an item from one position
22 * to another.
23 *
24 * This assumes that entries are sortable and therefore a index can be assigned
25 *
26 * @author Steffen Ritter <typo3steffen-ritter.net>
27 */
28 interface SortableCollectionInterface {
29
30 /**
31 * Sorts collection via given callBackFunction
32 *
33 * The comparison function given as must return an integer less than, equal to, or greater than
34 * zero if the first argument is considered to be respectively less than, equal to, or greater than the second.
35 *
36 * @param $callbackFunction
37 * @see http://www.php.net/manual/en/function.usort.php
38 * @return void
39 */
40 public function usort($callbackFunction);
41
42 /**
43 * Moves the item within the collection
44 *
45 * The item at $currentPosition will be moved to
46 * $newPosition. Omiting $newPosition will move to top.
47 *
48 * @param int $currentPosition
49 * @param int $newPosition
50 * @return void
51 */
52 public function moveItemAt($currentPosition, $newPosition = 0);
53
54 }