Skip to content

Commit 89f5af6

Browse files
committed
Masking section extended
1 parent 4433eb2 commit 89f5af6

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

README.md

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -468,20 +468,24 @@ $aMessage = $oFolder->query()->whereAll()
468468
#### Masking
469469
Laravel-IMAP already comes with two default masks [MessageMask::class](#messagemaskclass) and [AttachmentMask::class](#attachmentmaskclass).
470470

471-
In order to save some resources, the mask has to be applied manually:
471+
The masked instance has to be called manually and is designed to add custom functionality.
472+
473+
You can call the default mask by calling the mask method without any arguments.
472474
``` php
473475
/** @var \Webklex\IMAP\Message $oMessage */
474476
$mask = $oMessage->mask();
475477
```
476-
In this case the default mask gets called.
478+
477479
There are several methods available to set the default mask:
478480
``` php
479481
/** @var \Webklex\IMAP\Client $oClient */
480482
/** @var \Webklex\IMAP\Message $oMessage */
481483

482-
$oClient->setDefaultMessageMask(\Webklex\IMAP\Support\Masks\MessageMask::class);
483-
$oMessage->setMask(\Webklex\IMAP\Support\Masks\MessageMask::class);
484-
$mask = $oMessage->mask(\Webklex\IMAP\Support\Masks\MessageMask::class);
484+
$message_mask = \Webklex\IMAP\Support\Masks\MessageMask::class;
485+
486+
$oClient->setDefaultMessageMask($message_mask);
487+
$oMessage->setMask($message_mask);
488+
$mask = $oMessage->mask($message_mask);
485489
```
486490
The last one wont set the mask but generate a masked instance using the provided mask.
487491

@@ -491,14 +495,15 @@ You can also apply a mask on [attachments](#attachmentclass):
491495
``` php
492496
/** @var \Webklex\IMAP\Client $oClient */
493497
/** @var \Webklex\IMAP\Attachment $oAttachment */
498+
$attachment_mask = \Webklex\IMAP\Support\Masks\AttachmentMask::class;
494499

495-
$oClient->setDefaultAttachmentMask(\Webklex\IMAP\Support\Masks\AttachmentMask::class);
496-
$oAttachment->setMask(\Webklex\IMAP\Support\Masks\AttachmentMask::class);
497-
$mask = $oAttachment->mask(\Webklex\IMAP\Support\Masks\AttachmentMask::class);
500+
$oClient->setDefaultAttachmentMask($attachment_mask);
501+
$oAttachment->setMask($attachment_mask);
502+
$mask = $oAttachment->mask($attachment_mask);
498503
```
499504

500-
If you want to implement your own shortcuts using a mask just extend [MessageMask::class](#messagemaskclass), [AttachmentMask::class](#attachmentmaskclass)
501-
or [Mask::class](#maskclass) and implement your required logic:
505+
If you want to implement your own mask just extend [MessageMask::class](#messagemaskclass), [AttachmentMask::class](#attachmentmaskclass)
506+
or [Mask::class](#maskclass) and implement your desired logic:
502507

503508
``` php
504509
/** @var \Webklex\IMAP\Message $oMessage */
@@ -732,7 +737,7 @@ if you're just wishing a feature ;)
732737
| Method | Arguments | Return | Description |
733738
| -------------- | ------------------------------ | :------------: | ------------------------------------------------------ |
734739
| getParent | | Masked parent | Get the masked parent object |
735-
| getAttributes | | array | Get the cloned attachments |
740+
| getAttributes | | array | Get all cloned attributes |
736741
| __get | | mixed | Access any cloned parent attribute |
737742
| __set | | mixed | Set any cloned parent attribute |
738743
| __inherit | | mixed | All public methods of the given parent are callable |

0 commit comments

Comments
 (0)