1 | <?php |
||
18 | class EmailReceiveCheck extends AbstractEmailCheck |
||
19 | { |
||
20 | const CHECK = 'email-receive-check'; |
||
21 | const RECEIVE_MAX_TIME = 300; |
||
22 | |||
23 | /** |
||
24 | * @var bool |
||
25 | */ |
||
26 | private $firstFailSkip = true; |
||
27 | |||
28 | /** |
||
29 | * @var int |
||
30 | */ |
||
31 | private $receiveMaxTime; |
||
32 | |||
33 | /** |
||
34 | * @var Mailbox; |
||
35 | */ |
||
36 | private $mailbox; |
||
37 | |||
38 | |||
39 | /** |
||
40 | * @var PersistCollectionInterface |
||
41 | */ |
||
42 | private $persistCollection; |
||
43 | |||
44 | /** |
||
45 | * @var EmailSendReceiveCollection |
||
46 | */ |
||
47 | private $emailSendReceiveCollection; |
||
48 | |||
49 | /** |
||
50 | * @param string $checkNode |
||
51 | * @param Mailbox $mailbox |
||
52 | * @param PersistCollectionInterface $persistCollection |
||
53 | * @param int $receiveMaxTime |
||
54 | */ |
||
55 | 8 | public function __construct( |
|
67 | |||
68 | /** |
||
69 | * Check email can send and receive messages |
||
70 | * @return bool|void |
||
71 | * @throws EmailReceiveCheckException |
||
72 | */ |
||
73 | 7 | public function check() |
|
82 | |||
83 | /** |
||
84 | * @return Mailbox |
||
85 | */ |
||
86 | 7 | public function getMailbox() |
|
90 | |||
91 | /** |
||
92 | * @return PersistCollectionInterface |
||
93 | */ |
||
94 | 7 | public function getPersistCollection() |
|
98 | |||
99 | /** |
||
100 | * @return int |
||
101 | */ |
||
102 | 4 | public function getReceiveMaxTime() |
|
106 | |||
107 | /** |
||
108 | * @return EmailSendReceiveCollection |
||
109 | */ |
||
110 | 7 | public function getEmailSendReceiveColl() |
|
114 | |||
115 | /** |
||
116 | * @return boolean |
||
117 | */ |
||
118 | 4 | public function isFirstFailSkip() |
|
122 | |||
123 | /** |
||
124 | * @param Mailbox $mailbox |
||
125 | */ |
||
126 | 8 | protected function setMailbox(Mailbox $mailbox) |
|
130 | |||
131 | /** |
||
132 | * @param PersistCollectionInterface $persistCollection |
||
133 | */ |
||
134 | 8 | protected function setPersistCollection(PersistCollectionInterface $persistCollection) |
|
138 | |||
139 | /** |
||
140 | * @param int $receiveMaxTime |
||
141 | */ |
||
142 | 8 | protected function setReceiveMaxTime($receiveMaxTime) |
|
146 | |||
147 | /** |
||
148 | * @param boolean $firstFailSkip |
||
149 | */ |
||
150 | 4 | protected function setFirstFailSkip($firstFailSkip) |
|
154 | |||
155 | /** |
||
156 | * @param EmailSendReceiveCollection $emailSendReceiveC |
||
157 | */ |
||
158 | 7 | protected function setEmailSendReceiveColl(EmailSendReceiveCollection $emailSendReceiveC) |
|
162 | |||
163 | /** |
||
164 | * @param EmailSendReceive $emailSendCheckI |
||
165 | * @throws EmailReceiveCheckException |
||
166 | */ |
||
167 | 4 | protected function timeReceiveCheck(EmailSendReceive $emailSendCheckI) |
|
190 | |||
191 | /** |
||
192 | * @param $mails |
||
193 | * @param EmailSendReceive $emailSendCheckI |
||
194 | */ |
||
195 | 4 | private function deleteReceivedEmails($mails, EmailSendReceive $emailSendCheckI) |
|
206 | |||
207 | /** |
||
208 | * @param EmailSendReceive $emailSendCheckI |
||
209 | * @throws EmailReceiveCheckException |
||
210 | */ |
||
211 | 7 | private function performReceive(EmailSendReceive $emailSendCheckI) |
|
233 | |||
234 | /** |
||
235 | * @param EmailSendReceive $emailSendCheckI |
||
236 | * @return \Closure |
||
237 | */ |
||
238 | private function findSameItemCallback(EmailSendReceive $emailSendCheckI) |
||
244 | } |
||
245 |