@@ -90,7 +90,7 @@ public function messages(): MessageQuery
9090 */
9191 public function idle (callable $ callback , int $ timeout = 300 ): void
9292 {
93- if (! $ this ->hasIdleSupport ( )) {
93+ if (! $ this ->hasCapability ( ' IDLE ' )) {
9494 throw new RuntimeException ('IMAP server does not support IDLE ' );
9595 }
9696
@@ -123,33 +123,27 @@ function (int $msgn) use ($callback, $fetch) {
123123 /**
124124 * Move or rename the current folder.
125125 */
126- public function move (string $ newPath , bool $ expunge = true ): array
126+ public function move (string $ newPath , bool $ expunge = true ): void
127127 {
128- $ status = $ this ->mailbox ->connection ()
129- ->renameFolder ($ this ->path , $ newPath )
130- ->getValidatedData ();
128+ $ this ->mailbox ->connection ()->renameFolder ($ this ->path , $ newPath );
131129
132130 if ($ expunge ) {
133131 $ this ->expunge ();
134132 }
135133
136134 $ this ->path = $ newPath ;
137-
138- return $ status ;
139135 }
140136
141137 /**
142138 * Delete the current folder.
143139 */
144- public function delete (bool $ expunge = true ): array
140+ public function delete (bool $ expunge = true ): void
145141 {
146142 $ this ->mailbox ->connection ()->deleteFolder ($ this ->path );
147143
148144 if ($ expunge ) {
149- return $ this ->expunge ();
145+ $ this ->expunge ();
150146 }
151-
152- return [];
153147 }
154148
155149 /**
@@ -186,7 +180,7 @@ public function examine(): array
186180 {
187181 return $ this ->mailbox ->connection ()->examineFolder ($ this ->path )->map (
188182 fn (UntaggedResponse $ response ) => $ response ->toArray ()
189- );
183+ )-> all () ;
190184 }
191185
192186 /**
@@ -196,15 +190,15 @@ public function expunge(): array
196190 {
197191 return $ this ->mailbox ->connection ()->expunge ()->map (
198192 fn (UntaggedResponse $ response ) => $ response ->tokenAt (1 )->value
199- );
193+ )-> all () ;
200194 }
201195
202196 /**
203- * Determine if the mailbox has IDLE support .
197+ * Determine if the mailbox has the given capability .
204198 */
205- protected function hasIdleSupport ( ): bool
199+ public function hasCapability ( string $ capability ): bool
206200 {
207- return in_array (' IDLE ' , $ this ->capabilities ());
201+ return in_array ($ capability , $ this ->capabilities ());
208202 }
209203
210204 /**
0 commit comments