| @@ 143-147 (lines=5) @@ | ||
| 140 | * @return $this |
|
| 141 | */ |
|
| 142 | public function sortByValue($order = 'ASC') { |
|
| 143 | if ('ASC' == $order) { |
|
| 144 | $this->sortWith(function ($itemA, $itemB) { |
|
| 145 | return $this->get($itemA)->get()->getValue() > $this->get($itemB)->get()->getValue(); |
|
| 146 | }); |
|
| 147 | } |
|
| 148 | ||
| 149 | if ('DESC' == $order) { |
|
| 150 | $this->sortWith(function ($itemA, $itemB) { |
|
| @@ 149-153 (lines=5) @@ | ||
| 146 | }); |
|
| 147 | } |
|
| 148 | ||
| 149 | if ('DESC' == $order) { |
|
| 150 | $this->sortWith(function ($itemA, $itemB) { |
|
| 151 | return $this->get($itemA)->get()->getValue() < $this->get($itemB)->get()->getValue(); |
|
| 152 | }); |
|
| 153 | } |
|
| 154 | ||
| 155 | return $this; |
|
| 156 | } |
|