1 | <?php |
||||||
2 | /* |
||||||
3 | * File: custom_message_mask.php |
||||||
4 | * Category: Example |
||||||
5 | * Author: M.Goldenbaum |
||||||
6 | * Created: 14.03.19 18:47 |
||||||
7 | * Updated: - |
||||||
8 | * |
||||||
9 | * Description: |
||||||
10 | * - |
||||||
11 | */ |
||||||
12 | |||||||
13 | class CustomMessageMask extends \Webklex\PHPIMAP\Support\Masks\MessageMask { |
||||||
14 | |||||||
15 | /** |
||||||
16 | * New custom method which can be called through a mask |
||||||
17 | * @return string |
||||||
18 | */ |
||||||
19 | public function my_token(){ |
||||||
20 | return implode('-', [$this->message_id, $this->uid, $this->message_no]); |
||||||
0 ignored issues
–
show
Bug
Best Practice
introduced
by
![]() The property
message_id does not exist on CustomMessageMask . Since you implemented __get , consider adding a @property annotation.
![]() The property
uid does not exist on CustomMessageMask . Since you implemented __get , consider adding a @property annotation.
![]() |
|||||||
21 | } |
||||||
22 | |||||||
23 | /** |
||||||
24 | * Get number of message attachments |
||||||
25 | * @return integer |
||||||
26 | */ |
||||||
27 | public function getAttachmentCount() { |
||||||
28 | return $this->getAttachments()->count(); |
||||||
0 ignored issues
–
show
The method
getAttachments() does not exist on CustomMessageMask . Since you implemented __call , consider adding a @method annotation.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
29 | } |
||||||
30 | |||||||
31 | } |
||||||
32 | |||||||
33 | /** @var \Webklex\PHPIMAP\Client $oClient */ |
||||||
34 | $oClient = \Webklex\IMAP\Facades\Client::account('default'); |
||||||
0 ignored issues
–
show
The method
Webklex\IMAP\Facades\Client::account() is not static, but was called statically.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
35 | $oClient->connect(); |
||||||
36 | |||||||
37 | /** @var \Webklex\PHPIMAP\Folder $folder */ |
||||||
38 | $folder = $oClient->getFolder('INBOX'); |
||||||
39 | |||||||
40 | /** @var \Webklex\PHPIMAP\Message $message */ |
||||||
41 | $message = $folder->query()->limit(1)->get()->first(); |
||||||
42 | |||||||
43 | /** @var CustomMessageMask $masked_message */ |
||||||
44 | $masked_message = $message->mask(CustomMessageMask::class); |
||||||
45 | |||||||
46 | echo 'Token for uid ['.$masked_message->uid.']: '.$masked_message->my_token().' @atms:'.$masked_message->getAttachmentCount(); |
||||||
0 ignored issues
–
show
The property
uid does not exist on CustomMessageMask . Since you implemented __get , consider adding a @property annotation.
![]() |
|||||||
47 | |||||||
48 | $masked_message->setFlag('seen'); |
||||||
0 ignored issues
–
show
The method
setFlag() does not exist on CustomMessageMask . Since you implemented __call , consider adding a @method annotation.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
49 | |||||||
50 |