@@ -90,7 +90,7 @@ |
||
90 | 90 | $content_type = (is_array($content_type)) ? implode(' ', $content_type) : $content_type; |
91 | 91 | if(stripos($content_type, 'multipart') === 0) { |
92 | 92 | $this->type = IMAP::MESSAGE_TYPE_MULTIPART; |
93 | - }else{ |
|
93 | + } else{ |
|
94 | 94 | $this->type = IMAP::MESSAGE_TYPE_TEXT; |
95 | 95 | } |
96 | 96 | } |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | } |
129 | 129 | |
130 | 130 | return null; |
131 | - }elseif (strtolower(substr($method, 0, 3)) === 'set') { |
|
131 | + } elseif (strtolower(substr($method, 0, 3)) === 'set') { |
|
132 | 132 | $name = Str::snake(substr($method, 3)); |
133 | 133 | |
134 | 134 | $this->attributes[$name] = array_pop($arguments); |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | $this->setName($filename); |
223 | 223 | } elseif (($name = $this->part->name) !== null) { |
224 | 224 | $this->setName($name); |
225 | - }else { |
|
225 | + } else { |
|
226 | 226 | $this->setName("undefined"); |
227 | 227 | } |
228 | 228 | |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | if ($name !== null) { |
258 | 258 | if($decoder === 'utf-8' && extension_loaded('imap')) { |
259 | 259 | $this->name = \imap_utf8($name); |
260 | - }else{ |
|
260 | + } else{ |
|
261 | 261 | $this->name = mb_decode_mimeheader($name); |
262 | 262 | } |
263 | 263 | } |
@@ -86,7 +86,9 @@ discard block |
||
86 | 86 | */ |
87 | 87 | public function toDate(){ |
88 | 88 | $date = $this->first(); |
89 | - if ($date instanceof Carbon) return $date; |
|
89 | + if ($date instanceof Carbon) { |
|
90 | + return $date; |
|
91 | + } |
|
90 | 92 | |
91 | 93 | return Carbon::parse($date); |
92 | 94 | } |
@@ -146,7 +148,7 @@ discard block |
||
146 | 148 | public function add($value, $strict = false) { |
147 | 149 | if (is_array($value)) { |
148 | 150 | return $this->merge($value, $strict); |
149 | - }elseif ($value !== null) { |
|
151 | + } elseif ($value !== null) { |
|
150 | 152 | $this->attach($value, $strict); |
151 | 153 | } |
152 | 154 | |
@@ -195,7 +197,7 @@ discard block |
||
195 | 197 | if ($this->contains($value) === false) { |
196 | 198 | $this->values[] = $value; |
197 | 199 | } |
198 | - }else{ |
|
200 | + } else{ |
|
199 | 201 | $this->values[] = $value; |
200 | 202 | } |
201 | 203 | } |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | $value = $this->default_account_config[$key]; |
208 | 208 | if(isset($config[$key])) { |
209 | 209 | $value = $config[$key]; |
210 | - }elseif(isset($default_config[$key])) { |
|
210 | + } elseif(isset($default_config[$key])) { |
|
211 | 211 | $value = $default_config[$key]; |
212 | 212 | } |
213 | 213 | $this->$key = $value; |
@@ -239,39 +239,39 @@ discard block |
||
239 | 239 | if(isset($config['masks']['message'])) { |
240 | 240 | if(class_exists($config['masks']['message'])) { |
241 | 241 | $this->default_message_mask = $config['masks']['message']; |
242 | - }else{ |
|
242 | + } else{ |
|
243 | 243 | throw new MaskNotFoundException("Unknown mask provided: ".$config['masks']['message']); |
244 | 244 | } |
245 | - }else{ |
|
245 | + } else{ |
|
246 | 246 | if(class_exists($default_config['message'])) { |
247 | 247 | $this->default_message_mask = $default_config['message']; |
248 | - }else{ |
|
248 | + } else{ |
|
249 | 249 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['message']); |
250 | 250 | } |
251 | 251 | } |
252 | 252 | if(isset($config['masks']['attachment'])) { |
253 | 253 | if(class_exists($config['masks']['attachment'])) { |
254 | 254 | $this->default_attachment_mask = $config['masks']['attachment']; |
255 | - }else{ |
|
255 | + } else{ |
|
256 | 256 | throw new MaskNotFoundException("Unknown mask provided: ".$config['masks']['attachment']); |
257 | 257 | } |
258 | - }else{ |
|
258 | + } else{ |
|
259 | 259 | if(class_exists($default_config['attachment'])) { |
260 | 260 | $this->default_attachment_mask = $default_config['attachment']; |
261 | - }else{ |
|
261 | + } else{ |
|
262 | 262 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['attachment']); |
263 | 263 | } |
264 | 264 | } |
265 | - }else{ |
|
265 | + } else{ |
|
266 | 266 | if(class_exists($default_config['message'])) { |
267 | 267 | $this->default_message_mask = $default_config['message']; |
268 | - }else{ |
|
268 | + } else{ |
|
269 | 269 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['message']); |
270 | 270 | } |
271 | 271 | |
272 | 272 | if(class_exists($default_config['attachment'])) { |
273 | 273 | $this->default_attachment_mask = $default_config['attachment']; |
274 | - }else{ |
|
274 | + } else{ |
|
275 | 275 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['attachment']); |
276 | 276 | } |
277 | 277 | } |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | $this->connection = new ImapProtocol($this->validate_cert, $this->encryption); |
336 | 336 | $this->connection->setConnectionTimeout($this->timeout); |
337 | 337 | $this->connection->setProxy($this->proxy); |
338 | - }else{ |
|
338 | + } else{ |
|
339 | 339 | if (extension_loaded('imap') === false) { |
340 | 340 | throw new ConnectionFailedException("connection setup failed", 0, new ProtocolNotSupportedException($protocol." is an unsupported protocol")); |
341 | 341 | } |
@@ -475,7 +475,7 @@ discard block |
||
475 | 475 | } |
476 | 476 | |
477 | 477 | return $folders; |
478 | - }else{ |
|
478 | + } else{ |
|
479 | 479 | throw new FolderFetchingException("failed to fetch any folders"); |
480 | 480 | } |
481 | 481 | } |
@@ -513,7 +513,9 @@ discard block |
||
513 | 513 | $this->checkConnection(); |
514 | 514 | $status = $this->connection->createFolder($folder); |
515 | 515 | |
516 | - if($expunge) $this->expunge(); |
|
516 | + if($expunge) { |
|
517 | + $this->expunge(); |
|
518 | + } |
|
517 | 519 | |
518 | 520 | $folder = $this->getFolder($folder); |
519 | 521 | if($status && $folder) { |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | $name = $this->decodeFolderName($item->name); |
324 | 324 | $result[$name] = ['delimiter' => $item->delimiter, 'flags' => []]; |
325 | 325 | } |
326 | - }else{ |
|
326 | + } else{ |
|
327 | 327 | throw new RuntimeException(\imap_last_error()); |
328 | 328 | } |
329 | 329 | |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | |
348 | 348 | if ($mode == "+"){ |
349 | 349 | $status = \imap_setflag_full($this->stream, $from, $flag, $uid ? IMAP::ST_UID : IMAP::NIL); |
350 | - }else{ |
|
350 | + } else{ |
|
351 | 351 | $status = \imap_clearflag_full($this->stream, $from, $flag, $uid ? IMAP::ST_UID : IMAP::NIL); |
352 | 352 | } |
353 | 353 |
@@ -91,7 +91,9 @@ discard block |
||
91 | 91 | $this->setClient($client); |
92 | 92 | |
93 | 93 | $this->sequence = ClientManager::get('options.sequence', IMAP::ST_MSGN); |
94 | - if (ClientManager::get('options.fetch') === IMAP::FT_PEEK) $this->leaveUnread(); |
|
94 | + if (ClientManager::get('options.fetch') === IMAP::FT_PEEK) { |
|
95 | + $this->leaveUnread(); |
|
96 | + } |
|
95 | 97 | |
96 | 98 | if (ClientManager::get('options.fetch_order') === 'desc') { |
97 | 99 | $this->fetch_order = 'desc'; |
@@ -137,7 +139,9 @@ discard block |
||
137 | 139 | * @throws MessageSearchValidationException |
138 | 140 | */ |
139 | 141 | protected function parse_date($date) { |
140 | - if ($date instanceof Carbon) return $date; |
|
142 | + if ($date instanceof Carbon) { |
|
143 | + return $date; |
|
144 | + } |
|
141 | 145 | |
142 | 146 | try { |
143 | 147 | $date = Carbon::parse($date); |
@@ -533,7 +537,9 @@ discard block |
||
533 | 537 | * @return $this |
534 | 538 | */ |
535 | 539 | public function limit($limit, $page = 1) { |
536 | - if ($page >= 1) $this->page = $page; |
|
540 | + if ($page >= 1) { |
|
541 | + $this->page = $page; |
|
542 | + } |
|
537 | 543 | $this->limit = $limit; |
538 | 544 | |
539 | 545 | return $this; |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | if(strtolower(substr($method, 0, 3)) === 'get') { |
301 | 301 | $name = Str::snake(substr($method, 3)); |
302 | 302 | return $this->get($name); |
303 | - }elseif (strtolower(substr($method, 0, 3)) === 'set') { |
|
303 | + } elseif (strtolower(substr($method, 0, 3)) === 'set') { |
|
304 | 304 | $name = Str::snake(substr($method, 3)); |
305 | 305 | |
306 | 306 | if(in_array($name, array_keys($this->attributes))) { |
@@ -506,7 +506,7 @@ discard block |
||
506 | 506 | if ($this->getFlags()->get("seen") == null) { |
507 | 507 | $this->unsetFlag("Seen"); |
508 | 508 | } |
509 | - }elseif ($this->getFlags()->get("seen") != null) { |
|
509 | + } elseif ($this->getFlags()->get("seen") != null) { |
|
510 | 510 | $this->setFlag("Seen"); |
511 | 511 | } |
512 | 512 | } |
@@ -550,7 +550,7 @@ discard block |
||
550 | 550 | private function fetchPart(Part $part) { |
551 | 551 | if ($part->isAttachment()) { |
552 | 552 | $this->fetchAttachment($part); |
553 | - }else{ |
|
553 | + } else{ |
|
554 | 554 | $encoding = $this->getEncoding($part); |
555 | 555 | |
556 | 556 | $content = $this->decodeString($part->content, $part->encoding); |
@@ -575,7 +575,7 @@ discard block |
||
575 | 575 | |
576 | 576 | if (isset($this->bodies[$subtype])) { |
577 | 577 | $this->bodies[$subtype] .= "\n".$content; |
578 | - }else{ |
|
578 | + } else{ |
|
579 | 579 | $this->bodies[$subtype] = $content; |
580 | 580 | } |
581 | 581 | } |
@@ -746,9 +746,9 @@ discard block |
||
746 | 746 | return EncodingAliases::get($parameter->value); |
747 | 747 | } |
748 | 748 | } |
749 | - }elseif (property_exists($structure, 'charset')){ |
|
749 | + } elseif (property_exists($structure, 'charset')){ |
|
750 | 750 | return EncodingAliases::get($structure->charset); |
751 | - }elseif (is_string($structure) === true){ |
|
751 | + } elseif (is_string($structure) === true){ |
|
752 | 752 | return mb_detect_encoding($structure); |
753 | 753 | } |
754 | 754 | |
@@ -935,13 +935,15 @@ discard block |
||
935 | 935 | * @throws MessageHeaderFetchingException |
936 | 936 | */ |
937 | 937 | protected function fetchNewMail($folder, $next_uid, $event, $expunge){ |
938 | - if($expunge) $this->client->expunge(); |
|
938 | + if($expunge) { |
|
939 | + $this->client->expunge(); |
|
940 | + } |
|
939 | 941 | |
940 | 942 | $this->client->openFolder($folder->path); |
941 | 943 | |
942 | 944 | if ($this->sequence === IMAP::ST_UID) { |
943 | 945 | $sequence_id = $next_uid; |
944 | - }else{ |
|
946 | + } else{ |
|
945 | 947 | $sequence_id = $this->client->getConnection()->getMessageNumber($next_uid); |
946 | 948 | } |
947 | 949 | |
@@ -970,7 +972,9 @@ discard block |
||
970 | 972 | $trash_path = $trash_path === null ? $this->config["common_folders"]["trash"]: $trash_path; |
971 | 973 | $status = $this->move($trash_path); |
972 | 974 | } |
973 | - if($expunge) $this->client->expunge(); |
|
975 | + if($expunge) { |
|
976 | + $this->client->expunge(); |
|
977 | + } |
|
974 | 978 | |
975 | 979 | $event = $this->getEvent("message", "deleted"); |
976 | 980 | $event::dispatch($this); |
@@ -990,7 +994,9 @@ discard block |
||
990 | 994 | */ |
991 | 995 | public function restore($expunge = true) { |
992 | 996 | $status = $this->unsetFlag("Deleted"); |
993 | - if($expunge) $this->client->expunge(); |
|
997 | + if($expunge) { |
|
998 | + $this->client->expunge(); |
|
999 | + } |
|
994 | 1000 | |
995 | 1001 | $event = $this->getEvent("message", "restored"); |
996 | 1002 | $event::dispatch($this); |
@@ -1418,7 +1424,7 @@ discard block |
||
1418 | 1424 | if ($this->getSequence() === IMAP::ST_UID) { |
1419 | 1425 | $this->setUid($uid); |
1420 | 1426 | $this->setMsglist($msglist); |
1421 | - }else{ |
|
1427 | + } else{ |
|
1422 | 1428 | $this->setMsgn($uid, $msglist); |
1423 | 1429 | } |
1424 | 1430 | } |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | foreach ($criteria as $key => $value) { |
138 | 138 | if (is_numeric($key)) { |
139 | 139 | $this->where($value); |
140 | - }else{ |
|
140 | + } else{ |
|
141 | 141 | $this->where($key, $value); |
142 | 142 | } |
143 | 143 | } |
@@ -173,7 +173,9 @@ discard block |
||
173 | 173 | */ |
174 | 174 | public function orWhere(Closure $closure = null) { |
175 | 175 | $this->query->push(['OR']); |
176 | - if ($closure !== null) $closure($this); |
|
176 | + if ($closure !== null) { |
|
177 | + $closure($this); |
|
178 | + } |
|
177 | 179 | |
178 | 180 | return $this; |
179 | 181 | } |
@@ -185,7 +187,9 @@ discard block |
||
185 | 187 | */ |
186 | 188 | public function andWhere(Closure $closure = null) { |
187 | 189 | $this->query->push(['AND']); |
188 | - if ($closure !== null) $closure($this); |
|
190 | + if ($closure !== null) { |
|
191 | + $closure($this); |
|
192 | + } |
|
189 | 193 | |
190 | 194 | return $this; |
191 | 195 | } |