| Total Complexity | 3 |
| Total Lines | 43 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 12 | trait SortingTrait |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * Define the next step via a callback that returns an array or Traversable object. |
||
| 16 | * |
||
| 17 | * @param callable $callback |
||
| 18 | * @param mixed ...$args |
||
| 19 | * @return static |
||
| 20 | */ |
||
| 21 | abstract public function then(callable $callback, ...$args); |
||
| 22 | |||
| 23 | |||
| 24 | /** |
||
| 25 | * Sort all elements of an iterator. |
||
| 26 | * |
||
| 27 | * @param callable|int $compare SORT_* flags as binary set or callback comparator function |
||
| 28 | * @param bool $preserveKeys |
||
| 29 | * @return static |
||
| 30 | */ |
||
| 31 | 4 | public function sort($compare, bool $preserveKeys = true) |
|
| 34 | } |
||
| 35 | |||
| 36 | /** |
||
| 37 | * Sort all elements of an iterator based on the key. |
||
| 38 | * |
||
| 39 | * @param callable|int $compare SORT_* flags as binary set or callback comparator function |
||
| 40 | * @return static |
||
| 41 | */ |
||
| 42 | 2 | public function sortKeys($compare) |
|
| 43 | { |
||
| 44 | 2 | return $this->then(i\iterable_sort_keys, $compare); |
|
| 45 | } |
||
| 46 | |||
| 47 | /** |
||
| 48 | * Reverse order of elements of an iterable. |
||
| 49 | * |
||
| 50 | * @return static |
||
| 51 | */ |
||
| 52 | 1 | public function reverse() |
|
| 55 | } |
||
| 56 | } |
||
| 57 |