@@ -71,7 +71,7 @@ |
||
71 | 71 | return $this->attributes[$name]; |
72 | 72 | } |
73 | 73 | |
74 | - }elseif (strtolower(substr($method, 0, 3)) === 'set') { |
|
74 | + } elseif (strtolower(substr($method, 0, 3)) === 'set') { |
|
75 | 75 | $name = Str::snake(substr($method, 3)); |
76 | 76 | |
77 | 77 | if(isset($this->attributes[$name])) { |
@@ -50,7 +50,9 @@ discard block |
||
50 | 50 | */ |
51 | 51 | public function getCustomHTMLBody($callback = false) { |
52 | 52 | $body = $this->getHtmlBody(); |
53 | - if($body === null) return null; |
|
53 | + if($body === null) { |
|
54 | + return null; |
|
55 | + } |
|
54 | 56 | |
55 | 57 | if ($callback !== false) { |
56 | 58 | $aAttachment = $this->parent->getAttachments(); |
@@ -58,7 +60,7 @@ discard block |
||
58 | 60 | /** @var Attachment $oAttachment */ |
59 | 61 | if(is_callable($callback)) { |
60 | 62 | $body = $callback($body, $oAttachment); |
61 | - }elseif(is_string($callback)) { |
|
63 | + } elseif(is_string($callback)) { |
|
62 | 64 | call_user_func($callback, [$body, $oAttachment]); |
63 | 65 | } |
64 | 66 | }); |
@@ -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); |
@@ -250,15 +254,15 @@ discard block |
||
250 | 254 | protected function make($uid, $msglist, $header, $content, $flags){ |
251 | 255 | try { |
252 | 256 | return Message::make($uid, $msglist, $this->getClient(), $header, $content, $flags, $this->getFetchOptions(), $this->sequence); |
253 | - }catch (MessageNotFoundException $e) { |
|
257 | + } catch (MessageNotFoundException $e) { |
|
254 | 258 | $this->setError($uid, $e); |
255 | - }catch (RuntimeException $e) { |
|
259 | + } catch (RuntimeException $e) { |
|
256 | 260 | $this->setError($uid, $e); |
257 | - }catch (MessageFlagException $e) { |
|
261 | + } catch (MessageFlagException $e) { |
|
258 | 262 | $this->setError($uid, $e); |
259 | - }catch (InvalidMessageDateException $e) { |
|
263 | + } catch (InvalidMessageDateException $e) { |
|
260 | 264 | $this->setError($uid, $e); |
261 | - }catch (MessageContentFetchingException $e) { |
|
265 | + } catch (MessageContentFetchingException $e) { |
|
262 | 266 | $this->setError($uid, $e); |
263 | 267 | } |
264 | 268 | |
@@ -511,7 +515,9 @@ discard block |
||
511 | 515 | * @return $this |
512 | 516 | */ |
513 | 517 | public function limit($limit, $page = 1) { |
514 | - if ($page >= 1) $this->page = $page; |
|
518 | + if ($page >= 1) { |
|
519 | + $this->page = $page; |
|
520 | + } |
|
515 | 521 | $this->limit = $limit; |
516 | 522 | |
517 | 523 | return $this; |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | foreach ($criteria as $key => $value) { |
139 | 139 | if (is_numeric($key)) { |
140 | 140 | $this->where($value); |
141 | - }else{ |
|
141 | + } else{ |
|
142 | 142 | $this->where($key, $value); |
143 | 143 | } |
144 | 144 | } |
@@ -174,7 +174,9 @@ discard block |
||
174 | 174 | */ |
175 | 175 | public function orWhere(Closure $closure = null) { |
176 | 176 | $this->query->push(['OR']); |
177 | - if ($closure !== null) $closure($this); |
|
177 | + if ($closure !== null) { |
|
178 | + $closure($this); |
|
179 | + } |
|
178 | 180 | |
179 | 181 | return $this; |
180 | 182 | } |
@@ -186,7 +188,9 @@ discard block |
||
186 | 188 | */ |
187 | 189 | public function andWhere(Closure $closure = null) { |
188 | 190 | $this->query->push(['AND']); |
189 | - if ($closure !== null) $closure($this); |
|
191 | + if ($closure !== null) { |
|
192 | + $closure($this); |
|
193 | + } |
|
190 | 194 | |
191 | 195 | return $this; |
192 | 196 | } |
@@ -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 | } |
@@ -162,7 +162,7 @@ |
||
162 | 162 | protected function parse(){ |
163 | 163 | if ($this->header === null) { |
164 | 164 | $body = $this->findHeaders(); |
165 | - }else{ |
|
165 | + } else{ |
|
166 | 166 | $body = $this->raw; |
167 | 167 | } |
168 | 168 |
@@ -80,13 +80,13 @@ discard block |
||
80 | 80 | if($value === null) { |
81 | 81 | if(isset(self::$config[$part])) { |
82 | 82 | $value = self::$config[$part]; |
83 | - }else{ |
|
83 | + } else{ |
|
84 | 84 | break; |
85 | 85 | } |
86 | - }else{ |
|
86 | + } else{ |
|
87 | 87 | if(isset($value[$part])) { |
88 | 88 | $value = $value[$part]; |
89 | - }else{ |
|
89 | + } else{ |
|
90 | 90 | break; |
91 | 91 | } |
92 | 92 | } |
@@ -232,11 +232,15 @@ discard block |
||
232 | 232 | $arrays = func_get_args(); |
233 | 233 | $base = array_shift($arrays); |
234 | 234 | |
235 | - if(!is_array($base)) $base = empty($base) ? array() : array($base); |
|
235 | + if(!is_array($base)) { |
|
236 | + $base = empty($base) ? array() : array($base); |
|
237 | + } |
|
236 | 238 | |
237 | 239 | foreach($arrays as $append) { |
238 | 240 | |
239 | - if(!is_array($append)) $append = array($append); |
|
241 | + if(!is_array($append)) { |
|
242 | + $append = array($append); |
|
243 | + } |
|
240 | 244 | |
241 | 245 | foreach($append as $key => $value) { |
242 | 246 | |
@@ -248,7 +252,9 @@ discard block |
||
248 | 252 | if(is_array($value) or is_array($base[$key])) { |
249 | 253 | $base[$key] = $this->array_merge_recursive_distinct($base[$key], $append[$key]); |
250 | 254 | } else if(is_numeric($key)) { |
251 | - if(!in_array($value, $base)) $base[] = $value; |
|
255 | + if(!in_array($value, $base)) { |
|
256 | + $base[] = $value; |
|
257 | + } |
|
252 | 258 | } else { |
253 | 259 | $base[$key] = $value; |
254 | 260 | } |
@@ -130,20 +130,20 @@ discard block |
||
130 | 130 | if(isset($this->attributes[$name]) && $strict === false) { |
131 | 131 | if ($this->attributize) { |
132 | 132 | $this->attributes[$name]->add($value, true); |
133 | - }else{ |
|
133 | + } else{ |
|
134 | 134 | if(isset($this->attributes[$name])) { |
135 | 135 | if (is_array($this->attributes[$name]) == false) { |
136 | 136 | $this->attributes[$name] = [$this->attributes[$name], $value]; |
137 | - }else{ |
|
137 | + } else{ |
|
138 | 138 | $this->attributes[$name][] = $value; |
139 | 139 | } |
140 | - }else{ |
|
140 | + } else{ |
|
141 | 141 | $this->attributes[$name] = $value; |
142 | 142 | } |
143 | 143 | } |
144 | - }elseif($this->attributize == false){ |
|
144 | + } elseif($this->attributize == false){ |
|
145 | 145 | $this->attributes[$name] = $value; |
146 | - }else{ |
|
146 | + } else{ |
|
147 | 147 | $this->attributes[$name] = new Attribute($name, $value); |
148 | 148 | } |
149 | 149 | |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | if ($prev_header !== null) { |
255 | 255 | $headers[$prev_header][] = $line; |
256 | 256 | } |
257 | - }elseif (substr($line, 0, 1) === " ") { |
|
257 | + } elseif (substr($line, 0, 1) === " ") { |
|
258 | 258 | $line = substr($line, 1); |
259 | 259 | $line = trim(rtrim($line)); |
260 | 260 | if ($prev_header !== null) { |
@@ -263,11 +263,11 @@ discard block |
||
263 | 263 | } |
264 | 264 | if (is_array($headers[$prev_header])) { |
265 | 265 | $headers[$prev_header][] = $line; |
266 | - }else{ |
|
266 | + } else{ |
|
267 | 267 | $headers[$prev_header] .= $line; |
268 | 268 | } |
269 | 269 | } |
270 | - }else{ |
|
270 | + } else{ |
|
271 | 271 | if (($pos = strpos($line, ":")) > 0) { |
272 | 272 | $key = trim(rtrim(strtolower(substr($line, 0, $pos)))); |
273 | 273 | $key = str_replace("-", "_", $key); |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | $value = trim(rtrim(substr($line, $pos + 1))); |
276 | 276 | if (isset($headers[$key])) { |
277 | 277 | $headers[$key][] = $value; |
278 | - }else{ |
|
278 | + } else{ |
|
279 | 279 | $headers[$key] = [$value]; |
280 | 280 | } |
281 | 281 | $prev_header = $key; |
@@ -284,7 +284,9 @@ discard block |
||
284 | 284 | } |
285 | 285 | |
286 | 286 | foreach($headers as $key => $values) { |
287 | - if (isset($imap_headers[$key])) continue; |
|
287 | + if (isset($imap_headers[$key])) { |
|
288 | + continue; |
|
289 | + } |
|
288 | 290 | $value = null; |
289 | 291 | switch($key){ |
290 | 292 | case 'from': |
@@ -421,9 +423,9 @@ discard block |
||
421 | 423 | return EncodingAliases::get($parameter->value, $this->fallback_encoding); |
422 | 424 | } |
423 | 425 | } |
424 | - }elseif (property_exists($structure, 'charset')) { |
|
426 | + } elseif (property_exists($structure, 'charset')) { |
|
425 | 427 | return EncodingAliases::get($structure->charset, $this->fallback_encoding); |
426 | - }elseif (is_string($structure) === true){ |
|
428 | + } elseif (is_string($structure) === true){ |
|
427 | 429 | return mb_detect_encoding($structure); |
428 | 430 | } |
429 | 431 | |
@@ -470,9 +472,9 @@ discard block |
||
470 | 472 | } |
471 | 473 | } |
472 | 474 | } |
473 | - }elseif($decoder === 'iconv' && $is_utf8_base) { |
|
475 | + } elseif($decoder === 'iconv' && $is_utf8_base) { |
|
474 | 476 | $value = iconv_mime_decode($value); |
475 | - }elseif($is_utf8_base){ |
|
477 | + } elseif($is_utf8_base){ |
|
476 | 478 | $value = mb_decode_mimeheader($value); |
477 | 479 | } |
478 | 480 | |
@@ -505,7 +507,9 @@ discard block |
||
505 | 507 | * Try to extract the priority from a given raw header string |
506 | 508 | */ |
507 | 509 | private function findPriority() { |
508 | - if(($priority = $this->get("x_priority")) === null) return; |
|
510 | + if(($priority = $this->get("x_priority")) === null) { |
|
511 | + return; |
|
512 | + } |
|
509 | 513 | switch((int)"$priority"){ |
510 | 514 | case IMAP::MESSAGE_PRIORITY_HIGHEST; |
511 | 515 | $priority = IMAP::MESSAGE_PRIORITY_HIGHEST; |
@@ -652,7 +656,7 @@ discard block |
||
652 | 656 | foreach ($this->attributes as $key => $value) { |
653 | 657 | if (is_array($value)) { |
654 | 658 | $value = implode(", ", $value); |
655 | - }else{ |
|
659 | + } else{ |
|
656 | 660 | $value = (string)$value; |
657 | 661 | } |
658 | 662 | // Only parse strings and don't parse any attributes like the user-agent |
@@ -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 | |
@@ -964,7 +966,9 @@ discard block |
||
964 | 966 | */ |
965 | 967 | public function delete($expunge = true) { |
966 | 968 | $status = $this->setFlag("Deleted"); |
967 | - if($expunge) $this->client->expunge(); |
|
969 | + if($expunge) { |
|
970 | + $this->client->expunge(); |
|
971 | + } |
|
968 | 972 | |
969 | 973 | $event = $this->getEvent("message", "deleted"); |
970 | 974 | $event::dispatch($this); |
@@ -984,7 +988,9 @@ discard block |
||
984 | 988 | */ |
985 | 989 | public function restore($expunge = true) { |
986 | 990 | $status = $this->unsetFlag("Deleted"); |
987 | - if($expunge) $this->client->expunge(); |
|
991 | + if($expunge) { |
|
992 | + $this->client->expunge(); |
|
993 | + } |
|
988 | 994 | |
989 | 995 | $event = $this->getEvent("message", "restored"); |
990 | 996 | $event::dispatch($this); |
@@ -1412,7 +1418,7 @@ discard block |
||
1412 | 1418 | if ($this->getSequence() === IMAP::ST_UID) { |
1413 | 1419 | $this->setUid($uid); |
1414 | 1420 | $this->setMsglist($msglist); |
1415 | - }else{ |
|
1421 | + } else{ |
|
1416 | 1422 | $this->setMsgn($uid, $msglist); |
1417 | 1423 | } |
1418 | 1424 | } |