@@ -80,7 +80,9 @@ discard block |
||
80 | 80 | $this->setClient($client); |
81 | 81 | |
82 | 82 | $this->sequence = ClientManager::get('options.sequence', IMAP::ST_MSGN); |
83 | - if(ClientManager::get('options.fetch') === IMAP::FT_PEEK) $this->leaveUnread(); |
|
83 | + if(ClientManager::get('options.fetch') === IMAP::FT_PEEK) { |
|
84 | + $this->leaveUnread(); |
|
85 | + } |
|
84 | 86 | |
85 | 87 | if (ClientManager::get('options.fetch_order') === 'desc') { |
86 | 88 | $this->fetch_order = 'desc'; |
@@ -124,7 +126,9 @@ discard block |
||
124 | 126 | * @throws MessageSearchValidationException |
125 | 127 | */ |
126 | 128 | protected function parse_date($date) { |
127 | - if($date instanceof \Carbon\Carbon) return $date; |
|
129 | + if($date instanceof \Carbon\Carbon) { |
|
130 | + return $date; |
|
131 | + } |
|
128 | 132 | |
129 | 133 | try { |
130 | 134 | $date = Carbon::parse($date); |
@@ -322,7 +326,7 @@ discard block |
||
322 | 326 | } else { |
323 | 327 | if($statement[1] === null){ |
324 | 328 | $query .= $statement[0]; |
325 | - }else{ |
|
329 | + } else{ |
|
326 | 330 | $query .= $statement[0].' "'.$statement[1].'"'; |
327 | 331 | } |
328 | 332 | } |
@@ -352,7 +356,9 @@ discard block |
||
352 | 356 | * @return $this |
353 | 357 | */ |
354 | 358 | public function limit($limit, $page = 1) { |
355 | - if($page >= 1) $this->page = $page; |
|
359 | + if($page >= 1) { |
|
360 | + $this->page = $page; |
|
361 | + } |
|
356 | 362 | $this->limit = $limit; |
357 | 363 | |
358 | 364 | return $this; |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | if ($this->sequence === IMAP::ST_UID) { |
225 | 225 | $this->uid = $uid; |
226 | 226 | $this->msgn = $this->client->getConnection()->getMessageNumber($this->uid); |
227 | - }else{ |
|
227 | + } else{ |
|
228 | 228 | $this->msgn = $uid; |
229 | 229 | $this->uid = $this->client->getConnection()->getUid($this->msgn); |
230 | 230 | } |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | if ($instance->getSequence() === IMAP::ST_UID) { |
290 | 290 | $instance->setUid($uid); |
291 | 291 | $instance->setMsglist($msglist); |
292 | - }else{ |
|
292 | + } else{ |
|
293 | 293 | $instance->setMsgn($uid, $msglist); |
294 | 294 | } |
295 | 295 | |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | if(strtolower(substr($method, 0, 3)) === 'get') { |
321 | 321 | $name = Str::snake(substr($method, 3)); |
322 | 322 | return $this->get($name); |
323 | - }elseif (strtolower(substr($method, 0, 3)) === 'set') { |
|
323 | + } elseif (strtolower(substr($method, 0, 3)) === 'set') { |
|
324 | 324 | $name = Str::snake(substr($method, 3)); |
325 | 325 | |
326 | 326 | if(in_array($name, array_keys($this->attributes))) { |
@@ -505,7 +505,7 @@ discard block |
||
505 | 505 | if ($this->getFlags()->get("seen") == null) { |
506 | 506 | $this->unsetFlag("Seen"); |
507 | 507 | } |
508 | - }elseif ($this->getFlags()->get("seen") != null) { |
|
508 | + } elseif ($this->getFlags()->get("seen") != null) { |
|
509 | 509 | $this->setFlag("Seen"); |
510 | 510 | } |
511 | 511 | |
@@ -553,7 +553,7 @@ discard block |
||
553 | 553 | |
554 | 554 | if ($part->isAttachment()) { |
555 | 555 | $this->fetchAttachment($part); |
556 | - }else{ |
|
556 | + } else{ |
|
557 | 557 | $encoding = $this->getEncoding($part); |
558 | 558 | |
559 | 559 | $content = $this->decodeString($part->content, $part->encoding); |
@@ -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 | |
@@ -849,13 +849,15 @@ discard block |
||
849 | 849 | |
850 | 850 | $this->client->openFolder($this->folder_path); |
851 | 851 | if ($this->client->getConnection()->copyMessage($folder->path, $this->getSequenceId(), null, $this->sequence === IMAP::ST_UID) == true) { |
852 | - if($expunge) $this->client->expunge(); |
|
852 | + if($expunge) { |
|
853 | + $this->client->expunge(); |
|
854 | + } |
|
853 | 855 | |
854 | 856 | $this->client->openFolder($folder->path); |
855 | 857 | |
856 | 858 | if ($this->sequence === IMAP::ST_UID) { |
857 | 859 | $sequence_id = $next_uid; |
858 | - }else{ |
|
860 | + } else{ |
|
859 | 861 | $sequence_id = $this->client->getConnection()->getMessageNumber($next_uid); |
860 | 862 | } |
861 | 863 | |
@@ -896,13 +898,15 @@ discard block |
||
896 | 898 | |
897 | 899 | $this->client->openFolder($this->folder_path); |
898 | 900 | if ($this->client->getConnection()->moveMessage($folder->path, $this->getSequenceId(), null, $this->sequence === IMAP::ST_UID) == true) { |
899 | - if($expunge) $this->client->expunge(); |
|
901 | + if($expunge) { |
|
902 | + $this->client->expunge(); |
|
903 | + } |
|
900 | 904 | |
901 | 905 | $this->client->openFolder($folder->path); |
902 | 906 | |
903 | 907 | if ($this->sequence === IMAP::ST_UID) { |
904 | 908 | $sequence_id = $next_uid; |
905 | - }else{ |
|
909 | + } else{ |
|
906 | 910 | $sequence_id = $this->client->getConnection()->getMessageNumber($next_uid); |
907 | 911 | } |
908 | 912 | |
@@ -928,7 +932,9 @@ discard block |
||
928 | 932 | */ |
929 | 933 | public function delete($expunge = true) { |
930 | 934 | $status = $this->setFlag("Deleted"); |
931 | - if($expunge) $this->client->expunge(); |
|
935 | + if($expunge) { |
|
936 | + $this->client->expunge(); |
|
937 | + } |
|
932 | 938 | |
933 | 939 | $event = $this->getEvent("message", "deleted"); |
934 | 940 | $event::dispatch($this); |
@@ -947,7 +953,9 @@ discard block |
||
947 | 953 | */ |
948 | 954 | public function restore($expunge = true) { |
949 | 955 | $status = $this->unsetFlag("Deleted"); |
950 | - if($expunge) $this->client->expunge(); |
|
956 | + if($expunge) { |
|
957 | + $this->client->expunge(); |
|
958 | + } |
|
951 | 959 | |
952 | 960 | $event = $this->getEvent("message", "restored"); |
953 | 961 | $event::dispatch($this); |
@@ -258,9 +258,13 @@ discard block |
||
258 | 258 | $tokens = [substr($tokens, 0, 2)]; |
259 | 259 | } |
260 | 260 | if (is_array($lines)){ |
261 | - if ($this->debug) echo "<< ".json_encode($lines)."\n"; |
|
262 | - }else{ |
|
263 | - if ($this->debug) echo "<< ".$lines."\n"; |
|
261 | + if ($this->debug) { |
|
262 | + echo "<< ".json_encode($lines)."\n"; |
|
263 | + } |
|
264 | + } else{ |
|
265 | + if ($this->debug) { |
|
266 | + echo "<< ".$lines."\n"; |
|
267 | + } |
|
264 | 268 | } |
265 | 269 | |
266 | 270 | // last line has response code |
@@ -302,7 +306,9 @@ discard block |
||
302 | 306 | $line .= ' ' . $token; |
303 | 307 | } |
304 | 308 | } |
305 | - if ($this->debug) echo ">> ".$line."\n"; |
|
309 | + if ($this->debug) { |
|
310 | + echo ">> ".$line."\n"; |
|
311 | + } |
|
306 | 312 | |
307 | 313 | if (fwrite($this->stream, $line . "\r\n") === false) { |
308 | 314 | throw new RuntimeException('failed to write - connection closed?'); |
@@ -452,7 +458,9 @@ discard block |
||
452 | 458 | public function getCapabilities() { |
453 | 459 | $response = $this->requestAndResponse('CAPABILITY'); |
454 | 460 | |
455 | - if (!$response) return []; |
|
461 | + if (!$response) { |
|
462 | + return []; |
|
463 | + } |
|
456 | 464 | |
457 | 465 | $capabilities = []; |
458 | 466 | foreach ($response as $line) { |
@@ -609,13 +617,14 @@ discard block |
||
609 | 617 | // if we want only one message we can ignore everything else and just return |
610 | 618 | if ($to === null && !is_array($from) && ($uid ? $tokens[2][$uidKey] == $from : $tokens[0] == $from)) { |
611 | 619 | // we still need to read all lines |
612 | - while (!$this->readLine($tokens, $tag)) |
|
613 | - |
|
620 | + while (!$this->readLine($tokens, $tag)) { |
|
621 | + |
|
614 | 622 | return $data; |
623 | + } |
|
615 | 624 | } |
616 | 625 | if ($uid) { |
617 | 626 | $result[$tokens[2][$uidKey]] = $data; |
618 | - }else{ |
|
627 | + } else{ |
|
619 | 628 | $result[$tokens[0]] = $data; |
620 | 629 | } |
621 | 630 | } |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | $name = $this->decodeFolderName($item->name); |
311 | 311 | $result[$name] = ['delimiter' => $item->delimiter, 'flags' => []]; |
312 | 312 | } |
313 | - }else{ |
|
313 | + } else{ |
|
314 | 314 | throw new RuntimeException(\imap_last_error()); |
315 | 315 | } |
316 | 316 | |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | |
335 | 335 | if ($mode == "+"){ |
336 | 336 | $status = \imap_setflag_full($this->stream, $from, $flag, $uid ? IMAP::FT_UID : IMAP::NIL); |
337 | - }else{ |
|
337 | + } else{ |
|
338 | 338 | $status = \imap_clearflag_full($this->stream, $from, $flag, $uid ? IMAP::FT_UID : IMAP::NIL); |
339 | 339 | } |
340 | 340 |