@@ -87,9 +87,9 @@ public function flags(): array
8787 /**
8888 * Get the message's raw headers.
8989 */
90- public function head (bool $ lazy = false ): string
90+ public function head (bool $ fetch = false ): string
9191 {
92- if (! $ this ->head && $ lazy ) {
92+ if (! $ this ->head && $ fetch ) {
9393 $ this ->head = $ this ->fetchHead () ?? '' ;
9494 }
9595
@@ -146,13 +146,13 @@ public function hasBody(): bool
146146 /**
147147 * Get the message's body structure.
148148 */
149- public function bodyStructure (bool $ lazy = false ): ?BodyStructureCollection
149+ public function bodyStructure (bool $ fetch = false ): ?BodyStructureCollection
150150 {
151151 if ($ this ->bodyStructure ) {
152152 return $ this ->bodyStructure ;
153153 }
154154
155- if (! $ this ->bodyStructureData && $ lazy ) {
155+ if (! $ this ->bodyStructureData && $ fetch ) {
156156 $ this ->bodyStructureData = $ this ->fetchBodyStructureData ();
157157 }
158158
@@ -263,10 +263,10 @@ public function move(string $folder, bool $expunge = false): ?int
263263 /**
264264 * Get a header from the message.
265265 */
266- public function header (string $ name , int $ offset = 0 , bool $ lazy = false ): ?IHeader
266+ public function header (string $ name , int $ offset = 0 , bool $ fetch = false ): ?IHeader
267267 {
268- if ($ lazy && ! $ this ->hasHead ()) {
269- $ this ->head (lazy : true );
268+ if ($ fetch && ! $ this ->hasHead ()) {
269+ $ this ->head (fetch : true );
270270 }
271271
272272 if ($ this ->isEmpty ()) {
@@ -279,9 +279,9 @@ public function header(string $name, int $offset = 0, bool $lazy = false): ?IHea
279279 /**
280280 * Get the message date and time.
281281 */
282- public function date (bool $ lazy = false ): ?CarbonInterface
282+ public function date (bool $ fetch = false ): ?CarbonInterface
283283 {
284- if (! $ header = $ this ->header (HeaderConsts::DATE , lazy : $ lazy )) {
284+ if (! $ header = $ this ->header (HeaderConsts::DATE , fetch : $ fetch )) {
285285 return null ;
286286 }
287287
@@ -299,51 +299,51 @@ public function date(bool $lazy = false): ?CarbonInterface
299299 /**
300300 * Get the message's message-id.
301301 */
302- public function messageId (bool $ lazy = false ): ?string
302+ public function messageId (bool $ fetch = false ): ?string
303303 {
304- return $ this ->header (HeaderConsts::MESSAGE_ID , lazy : $ lazy )?->getValue();
304+ return $ this ->header (HeaderConsts::MESSAGE_ID , fetch : $ fetch )?->getValue();
305305 }
306306
307307 /**
308308 * Get the message's subject.
309309 */
310- public function subject (bool $ lazy = false ): ?string
310+ public function subject (bool $ fetch = false ): ?string
311311 {
312- return $ this ->header (HeaderConsts::SUBJECT , lazy : $ lazy )?->getValue();
312+ return $ this ->header (HeaderConsts::SUBJECT , fetch : $ fetch )?->getValue();
313313 }
314314
315315 /**
316316 * Get the FROM address.
317317 */
318- public function from (bool $ lazy = false ): ?Address
318+ public function from (bool $ fetch = false ): ?Address
319319 {
320- return head ($ this ->addresses (HeaderConsts::FROM , lazy : $ lazy )) ?: null ;
320+ return head ($ this ->addresses (HeaderConsts::FROM , fetch : $ fetch )) ?: null ;
321321 }
322322
323323 /**
324324 * Get the SENDER address.
325325 */
326- public function sender (bool $ lazy = false ): ?Address
326+ public function sender (bool $ fetch = false ): ?Address
327327 {
328- return head ($ this ->addresses (HeaderConsts::SENDER , lazy : $ lazy )) ?: null ;
328+ return head ($ this ->addresses (HeaderConsts::SENDER , fetch : $ fetch )) ?: null ;
329329 }
330330
331331 /**
332332 * Get the REPLY-TO address.
333333 */
334- public function replyTo (bool $ lazy = false ): ?Address
334+ public function replyTo (bool $ fetch = false ): ?Address
335335 {
336- return head ($ this ->addresses (HeaderConsts::REPLY_TO , lazy : $ lazy )) ?: null ;
336+ return head ($ this ->addresses (HeaderConsts::REPLY_TO , fetch : $ fetch )) ?: null ;
337337 }
338338
339339 /**
340340 * Get the IN-REPLY-TO message identifier(s).
341341 *
342342 * @return string[]
343343 */
344- public function inReplyTo (bool $ lazy = false ): array
344+ public function inReplyTo (bool $ fetch = false ): array
345345 {
346- $ parts = $ this ->header (HeaderConsts::IN_REPLY_TO , lazy : $ lazy )?->getParts() ?? [];
346+ $ parts = $ this ->header (HeaderConsts::IN_REPLY_TO , fetch : $ fetch )?->getParts() ?? [];
347347
348348 $ values = array_map (fn (IHeaderPart $ part ) => $ part ->getValue (), $ parts );
349349
@@ -355,39 +355,39 @@ public function inReplyTo(bool $lazy = false): array
355355 *
356356 * @return Address[]
357357 */
358- public function to (bool $ lazy = false ): array
358+ public function to (bool $ fetch = false ): array
359359 {
360- return $ this ->addresses (HeaderConsts::TO , lazy : $ lazy );
360+ return $ this ->addresses (HeaderConsts::TO , fetch : $ fetch );
361361 }
362362
363363 /**
364364 * Get the CC addresses.
365365 *
366366 * @return Address[]
367367 */
368- public function cc (bool $ lazy = false ): array
368+ public function cc (bool $ fetch = false ): array
369369 {
370- return $ this ->addresses (HeaderConsts::CC , lazy : $ lazy );
370+ return $ this ->addresses (HeaderConsts::CC , fetch : $ fetch );
371371 }
372372
373373 /**
374374 * Get the BCC addresses.
375375 *
376376 * @return Address[]
377377 */
378- public function bcc (bool $ lazy = false ): array
378+ public function bcc (bool $ fetch = false ): array
379379 {
380- return $ this ->addresses (HeaderConsts::BCC , lazy : $ lazy );
380+ return $ this ->addresses (HeaderConsts::BCC , fetch : $ fetch );
381381 }
382382
383383 /**
384384 * Get addresses from the given header.
385385 *
386386 * @return Address[]
387387 */
388- public function addresses (string $ header , bool $ lazy = false ): array
388+ public function addresses (string $ header , bool $ fetch = false ): array
389389 {
390- $ parts = $ this ->header ($ header , lazy : $ lazy )?->getParts() ?? [];
390+ $ parts = $ this ->header ($ header , fetch : $ fetch )?->getParts() ?? [];
391391
392392 $ addresses = array_map (fn (IHeaderPart $ part ) => match (true ) {
393393 $ part instanceof AddressPart => new Address ($ part ->getEmail (), $ part ->getName ()),
@@ -402,10 +402,10 @@ public function addresses(string $header, bool $lazy = false): array
402402 /**
403403 * Get the message's text content.
404404 */
405- public function text (bool $ lazy = false ): ?string
405+ public function text (bool $ fetch = false ): ?string
406406 {
407- if ($ lazy && ! $ this ->hasBody ()) {
408- if ($ part = $ this ->bodyStructure (lazy : true )?->text()) {
407+ if ($ fetch && ! $ this ->hasBody ()) {
408+ if ($ part = $ this ->bodyStructure (fetch : true )?->text()) {
409409 return Support \BodyPartDecoder::text ($ part , $ this ->bodyPart ($ part ->partNumber ()));
410410 }
411411 }
@@ -420,10 +420,10 @@ public function text(bool $lazy = false): ?string
420420 /**
421421 * Get the message's HTML content.
422422 */
423- public function html (bool $ lazy = false ): ?string
423+ public function html (bool $ fetch = false ): ?string
424424 {
425- if ($ lazy && ! $ this ->hasBody ()) {
426- if ($ part = $ this ->bodyStructure (lazy : true )?->html()) {
425+ if ($ fetch && ! $ this ->hasBody ()) {
426+ if ($ part = $ this ->bodyStructure (fetch : true )?->html()) {
427427 return Support \BodyPartDecoder::text ($ part , $ this ->bodyPart ($ part ->partNumber ()));
428428 }
429429 }
@@ -440,10 +440,10 @@ public function html(bool $lazy = false): ?string
440440 *
441441 * @return Attachment[]
442442 */
443- public function attachments (bool $ lazy = false ): array
443+ public function attachments (bool $ fetch = false ): array
444444 {
445- if ($ lazy && ! $ this ->hasBody ()) {
446- return $ this ->getLazyAttachments ();
445+ if ($ fetch && ! $ this ->hasBody ()) {
446+ return $ this ->getAttachmentsFromBodyStructure ();
447447 }
448448
449449 if ($ this ->isEmpty ()) {
@@ -454,11 +454,11 @@ public function attachments(bool $lazy = false): array
454454 }
455455
456456 /**
457- * Get attachments using lazy loading from body structure.
457+ * Get attachments from the body structure.
458458 *
459459 * @return Attachment[]
460460 */
461- protected function getLazyAttachments (): array
461+ protected function getAttachmentsFromBodyStructure (): array
462462 {
463463 return array_map (
464464 fn (BodyStructurePart $ part ) => new Attachment (
@@ -468,7 +468,7 @@ protected function getLazyAttachments(): array
468468 $ part ->disposition ()?->type()?->value,
469469 new Support \LazyBodyPartStream ($ this , $ part ),
470470 ),
471- $ this ->bodyStructure (lazy : true )?->attachments() ?? []
471+ $ this ->bodyStructure (fetch : true )?->attachments() ?? []
472472 );
473473 }
474474
0 commit comments