@@ -147,29 +147,35 @@ public function setPage(int $page): static
147147 }
148148
149149 /**
150- * Set the fetch option flag .
150+ * Determine if the body of messages is being fetched .
151151 */
152- public function setFetchOptions ( int $ fetchOptions ): static
152+ public function isFetchingBody ( ): bool
153153 {
154- $ this ->fetchOptions = $ fetchOptions ;
154+ return $ this ->fetchBody ;
155+ }
155156
156- return $ this ;
157+ /**
158+ * Determine if the flags of messages is being fetched.
159+ */
160+ public function isFetchingFlags (): bool
161+ {
162+ return $ this ->fetchFlags ;
157163 }
158164
159165 /**
160- * Get the fetch option flag .
166+ * Determine if the headers of messages is being fetched .
161167 */
162- public function getFetchOptions (): ? int
168+ public function isFetchingHeaders (): bool
163169 {
164- return $ this ->fetchOptions ;
170+ return $ this ->fetchHeaders ;
165171 }
166172
167173 /**
168- * Determine if the body of messages is being fetched .
174+ * Fetch the body of messages.
169175 */
170- public function isFetchingBody (): bool
176+ public function withFlags (): static
171177 {
172- return $ this ->fetchBody ;
178+ return $ this ->setFetchFlags ( true ) ;
173179 }
174180
175181 /**
@@ -180,6 +186,14 @@ public function withBody(): static
180186 return $ this ->setFetchBody (true );
181187 }
182188
189+ /**
190+ * Fetch the body of messages.
191+ */
192+ public function withHeaders (): static
193+ {
194+ return $ this ->setFetchHeaders (true );
195+ }
196+
183197 /**
184198 * Don't fetch the body of messages.
185199 */
@@ -189,27 +203,45 @@ public function withoutBody(): static
189203 }
190204
191205 /**
192- * Set the fetch body flag .
206+ * Don't fetch the body of messages .
193207 */
194- public function setFetchBody ( bool $ fetchBody ): static
208+ public function withoutHeaders ( ): static
195209 {
196- $ this ->fetchBody = $ fetchBody ;
210+ return $ this ->setFetchHeaders (false );
211+ }
212+
213+ /**
214+ * Don't fetch the body of messages.
215+ */
216+ public function withoutFlags (): static
217+ {
218+ return $ this ->setFetchFlags (false );
219+ }
220+
221+ /**
222+ * Set whether to fetch the flags.
223+ */
224+ protected function setFetchFlags (bool $ fetchFlags ): static
225+ {
226+ $ this ->fetchFlags = $ fetchFlags ;
197227
198228 return $ this ;
199229 }
200230
201231 /**
202- * Get the fetch body flag.
232+ * Set the fetch body flag.
203233 */
204- public function getFetchFlags ( ): bool
234+ protected function setFetchBody ( bool $ fetchBody ): static
205235 {
206- return $ this ->fetchFlags ;
236+ $ this ->fetchBody = $ fetchBody ;
237+
238+ return $ this ;
207239 }
208240
209241 /**
210- * Set the fetch flag .
242+ * Set whether to fetch the headers .
211243 */
212- public function setFetchFlags (bool $ fetchFlags ): static
244+ protected function setFetchHeaders (bool $ fetchFlags ): static
213245 {
214246 $ this ->fetchFlags = $ fetchFlags ;
215247
@@ -259,14 +291,16 @@ public function setFetchOrderDesc(): static
259291 */
260292 public function where (mixed $ criteria , mixed $ value = null ): static
261293 {
262- if (is_array ($ criteria )) {
263- foreach ($ criteria as $ key => $ value ) {
264- is_numeric ($ key )
265- ? $ this ->where ($ value )
266- : $ this ->where ($ key , $ value );
267- }
268- } else {
269- $ this ->addCondition ($ criteria , $ this ->prepareWhereValue ($ value ));
294+ if (! is_array ($ criteria )) {
295+ $ this ->addCondition (
296+ $ criteria , $ this ->prepareWhereValue ($ value )
297+ );
298+
299+ return $ this ;
300+ }
301+
302+ foreach ($ criteria as $ key => $ value ) {
303+ $ this ->where ($ key , $ value );
270304 }
271305
272306 return $ this ;
0 commit comments