| @@ 122-126 (lines=5) @@ | ||
| 119 | * @return $this |
|
| 120 | */ |
|
| 121 | public function sortByValue($order = 'ASC') { |
|
| 122 | if ('ASC' == $order) { |
|
| 123 | $this->sortWith(function ($itemA, $itemB) { |
|
| 124 | return $this->get($itemA)->get()->getValue() > $this->get($itemB)->get()->getValue(); |
|
| 125 | }); |
|
| 126 | } |
|
| 127 | ||
| 128 | if ('DESC' == $order) { |
|
| 129 | $this->sortWith(function ($itemA, $itemB) { |
|
| @@ 128-132 (lines=5) @@ | ||
| 125 | }); |
|
| 126 | } |
|
| 127 | ||
| 128 | if ('DESC' == $order) { |
|
| 129 | $this->sortWith(function ($itemA, $itemB) { |
|
| 130 | return $this->get($itemA)->get()->getValue() < $this->get($itemB)->get()->getValue(); |
|
| 131 | }); |
|
| 132 | } |
|
| 133 | ||
| 134 | return $this; |
|
| 135 | } |
|