File tree Expand file tree Collapse file tree 2 files changed +14
-8
lines changed
Expand file tree Collapse file tree 2 files changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -258,23 +258,29 @@ protected function populate(Collection $uids): MessageCollection
258258 */
259259 protected function fetch (Collection $ messages ): array
260260 {
261- if ($ this ->fetchOrder === 'desc ' ) {
262- $ messages = $ messages ->reverse ();
263- }
261+ $ messages = match ($ this ->fetchOrder ) {
262+ 'asc ' => $ messages ->sort (SORT_NUMERIC ),
263+ 'desc ' => $ messages ->sortDesc (SORT_NUMERIC ),
264+ };
264265
265- $ uids = $ messages ->forPage ($ this ->page , $ this ->limit )->toArray ();
266+ $ uids = $ messages ->forPage ($ this ->page , $ this ->limit )
267+ ->values ()
268+ ->all ();
266269
267270 $ flags = $ this ->fetchFlags ? $ this ->connection ()
268271 ->flags ($ uids )
269- ->mapWithKeys (MessageResponseParser::getFlags (...))->all () : [];
272+ ->mapWithKeys (MessageResponseParser::getFlags (...))
273+ ->all () : [];
270274
271275 $ headers = $ this ->fetchHeaders ? $ this ->connection ()
272276 ->bodyHeader ($ uids , $ this ->fetchAsUnread )
273- ->mapWithKeys (MessageResponseParser::getBodyHeader (...))->all () : [];
277+ ->mapWithKeys (MessageResponseParser::getBodyHeader (...))
278+ ->all () : [];
274279
275280 $ contents = $ this ->fetchBody ? $ this ->connection ()
276281 ->bodyText ($ uids , $ this ->fetchAsUnread )
277- ->mapWithKeys (MessageResponseParser::getBodyText (...))->all () : [];
282+ ->mapWithKeys (MessageResponseParser::getBodyText (...))
283+ ->all () : [];
278284
279285 return [
280286 'uids ' => $ uids ,
Original file line number Diff line number Diff line change 1717test ('capabilities ' , function () {
1818 $ mailbox = mailbox ();
1919
20- expect ($ mailbox ->capabilities ())-> toBe ([
20+ expect (array_flip ( $ mailbox ->capabilities ()))-> toHaveKeys ([
2121 'IMAP4rev1 ' ,
2222 'LITERAL+ ' ,
2323 'UIDPLUS ' ,
You can’t perform that action at this time.
0 commit comments