| Total Complexity | 8 |
| Total Lines | 77 |
| Duplicated Lines | 0 % |
| Coverage | 33.33% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 9 | trait SortingTrait |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * @return mixed |
||
| 13 | */ |
||
| 14 | 1 | public function end() |
|
| 15 | { |
||
| 16 | 1 | $this->index = count($this->items); |
|
|
|
|||
| 17 | 1 | return end($this->items); |
|
| 18 | } |
||
| 19 | |||
| 20 | /** |
||
| 21 | * @return mixed |
||
| 22 | */ |
||
| 23 | public function current() |
||
| 24 | { |
||
| 25 | return current($this->items); |
||
| 26 | } |
||
| 27 | |||
| 28 | /** |
||
| 29 | * @return mixed |
||
| 30 | */ |
||
| 31 | 1 | public function next() |
|
| 32 | { |
||
| 33 | 1 | $this->index++; |
|
| 34 | 1 | return next($this->items); |
|
| 35 | } |
||
| 36 | /** |
||
| 37 | * @return mixed |
||
| 38 | */ |
||
| 39 | 2 | public function rewind() |
|
| 40 | { |
||
| 41 | 2 | $this->index = 0; |
|
| 42 | |||
| 43 | 2 | return reset($this->items); |
|
| 44 | } |
||
| 45 | |||
| 46 | /** |
||
| 47 | * @return $this |
||
| 48 | */ |
||
| 49 | public function ksort() |
||
| 50 | { |
||
| 51 | ksort($this->items); |
||
| 52 | $this->rewind(); |
||
| 53 | return $this; |
||
| 54 | } |
||
| 55 | |||
| 56 | /** |
||
| 57 | * @param $callback |
||
| 58 | * @return $this |
||
| 59 | */ |
||
| 60 | public function usort($callback) |
||
| 61 | { |
||
| 62 | usort($this->items, $callback); |
||
| 63 | $this->rewind(); |
||
| 64 | return $this; |
||
| 65 | } |
||
| 66 | |||
| 67 | /** |
||
| 68 | * @param $callback |
||
| 69 | * @return $this |
||
| 70 | */ |
||
| 71 | public function uasort($callback) |
||
| 76 | } |
||
| 77 | |||
| 78 | /** |
||
| 79 | * @return $this |
||
| 80 | */ |
||
| 81 | public function shuffle() |
||
| 86 | } |
||
| 87 | } |
||
| 88 |