@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | protected function parse(): void { |
160 | 160 | if ($this->header === null) { |
161 | 161 | $body = $this->findHeaders(); |
162 | - }else{ |
|
162 | + }else { |
|
163 | 163 | $body = $this->raw; |
164 | 164 | } |
165 | 165 | |
@@ -171,11 +171,11 @@ discard block |
||
171 | 171 | $this->name = $this->header->get("name"); |
172 | 172 | $this->filename = $this->header->get("filename"); |
173 | 173 | |
174 | - if(!empty($this->header->get("id"))) { |
|
174 | + if (!empty($this->header->get("id"))) { |
|
175 | 175 | $this->id = $this->header->get("id"); |
176 | - } else if(!empty($this->header->get("x_attachment_id"))){ |
|
176 | + }else if (!empty($this->header->get("x_attachment_id"))) { |
|
177 | 177 | $this->id = $this->header->get("x_attachment_id"); |
178 | - } else if(!empty($this->header->get("content_id"))){ |
|
178 | + }else if (!empty($this->header->get("content_id"))) { |
|
179 | 179 | $this->id = strtr($this->header->get("content_id"), [ |
180 | 180 | '<' => '', |
181 | 181 | '>' => '' |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | } |
184 | 184 | |
185 | 185 | $content_types = $this->header->get("content_type"); |
186 | - if(!empty($content_types)){ |
|
186 | + if (!empty($content_types)) { |
|
187 | 187 | $this->subtype = $this->parseSubtype($content_types); |
188 | 188 | $content_type = $content_types; |
189 | 189 | if (is_array($content_types)) { |
@@ -223,16 +223,16 @@ discard block |
||
223 | 223 | * |
224 | 224 | * @return string |
225 | 225 | */ |
226 | - private function parseSubtype($content_type){ |
|
226 | + private function parseSubtype($content_type) { |
|
227 | 227 | if (is_array($content_type)) { |
228 | - foreach ($content_type as $part){ |
|
229 | - if ((strpos($part, "/")) !== false){ |
|
228 | + foreach ($content_type as $part) { |
|
229 | + if ((strpos($part, "/")) !== false) { |
|
230 | 230 | return $this->parseSubtype($part); |
231 | 231 | } |
232 | 232 | } |
233 | 233 | return null; |
234 | 234 | } |
235 | - if (($pos = strpos($content_type, "/")) !== false){ |
|
235 | + if (($pos = strpos($content_type, "/")) !== false) { |
|
236 | 236 | return substr($content_type, $pos + 1); |
237 | 237 | } |
238 | 238 | return null; |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | */ |
244 | 244 | private function parseDisposition(): void { |
245 | 245 | $content_disposition = $this->header->get("content_disposition"); |
246 | - if($content_disposition !== null) { |
|
246 | + if ($content_disposition !== null) { |
|
247 | 247 | $this->ifdisposition = true; |
248 | 248 | $this->disposition = (is_array($content_disposition)) ? implode(' ', $content_disposition) : $content_disposition; |
249 | 249 | } |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | */ |
255 | 255 | private function parseDescription(): void { |
256 | 256 | $content_description = $this->header->get("content_description"); |
257 | - if($content_description !== null) { |
|
257 | + if ($content_description !== null) { |
|
258 | 258 | $this->ifdescription = true; |
259 | 259 | $this->description = $content_description; |
260 | 260 | } |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | */ |
266 | 266 | private function parseEncoding(): void { |
267 | 267 | $encoding = $this->header->get("content_transfer_encoding"); |
268 | - if($encoding !== null) { |
|
268 | + if ($encoding !== null) { |
|
269 | 269 | switch (strtolower($encoding)) { |
270 | 270 | case "quoted-printable": |
271 | 271 | $this->encoding = IMAP::MESSAGE_ENC_QUOTED_PRINTABLE; |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | $this->boot(); |
169 | 169 | |
170 | 170 | $default_mask = $client->getDefaultMessageMask(); |
171 | - if($default_mask != null) { |
|
171 | + if ($default_mask != null) { |
|
172 | 172 | $this->mask = $default_mask; |
173 | 173 | } |
174 | 174 | $this->events["message"] = $client->getDefaultEvents("message"); |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | $instance->boot(); |
227 | 227 | |
228 | 228 | $default_mask = $client->getDefaultMessageMask(); |
229 | - if($default_mask != null) { |
|
229 | + if ($default_mask != null) { |
|
230 | 230 | $instance->setMask($default_mask); |
231 | 231 | } |
232 | 232 | $instance->setEvents([ |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | } |
277 | 277 | if (strtolower(substr($method, 0, 3)) === 'set') { |
278 | 278 | $name = Str::snake(substr($method, 3)); |
279 | - if(in_array($name, array_keys($this->attributes))) { |
|
279 | + if (in_array($name, array_keys($this->attributes))) { |
|
280 | 280 | return $this->__set($name, array_pop($arguments)); |
281 | 281 | } |
282 | 282 | } |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | * @return Attribute|mixed|null |
315 | 315 | */ |
316 | 316 | public function get($name) { |
317 | - if(isset($this->attributes[$name])) { |
|
317 | + if (isset($this->attributes[$name])) { |
|
318 | 318 | return $this->attributes[$name]; |
319 | 319 | } |
320 | 320 | |
@@ -399,8 +399,8 @@ discard block |
||
399 | 399 | public function parseRawFlags(array $raw_flags): void { |
400 | 400 | $this->flags = FlagCollection::make([]); |
401 | 401 | |
402 | - foreach($raw_flags as $flag) { |
|
403 | - if (strpos($flag, "\\") === 0){ |
|
402 | + foreach ($raw_flags as $flag) { |
|
403 | + if (strpos($flag, "\\") === 0) { |
|
404 | 404 | $flag = substr($flag, 1); |
405 | 405 | } |
406 | 406 | $flag_key = strtolower($flag); |
@@ -521,7 +521,7 @@ discard block |
||
521 | 521 | private function fetchPart(Part $part): void { |
522 | 522 | if ($part->isAttachment()) { |
523 | 523 | $this->fetchAttachment($part); |
524 | - }else{ |
|
524 | + }else { |
|
525 | 525 | $encoding = $this->getEncoding($part); |
526 | 526 | |
527 | 527 | $content = $this->decodeString($part->content, $part->encoding); |
@@ -546,7 +546,7 @@ discard block |
||
546 | 546 | |
547 | 547 | if (isset($this->bodies[$subtype])) { |
548 | 548 | $this->bodies[$subtype] .= "\n".$content; |
549 | - }else{ |
|
549 | + }else { |
|
550 | 550 | $this->bodies[$subtype] = $content; |
551 | 551 | } |
552 | 552 | } |
@@ -566,7 +566,7 @@ discard block |
||
566 | 566 | } |
567 | 567 | if ($oAttachment->getId() !== null) { |
568 | 568 | $this->attachments->put($oAttachment->getId(), $oAttachment); |
569 | - } else { |
|
569 | + }else { |
|
570 | 570 | $this->attachments->push($oAttachment); |
571 | 571 | } |
572 | 572 | } |
@@ -712,9 +712,9 @@ discard block |
||
712 | 712 | return EncodingAliases::get($parameter->value, "ISO-8859-2"); |
713 | 713 | } |
714 | 714 | } |
715 | - }elseif (property_exists($structure, 'charset')){ |
|
715 | + }elseif (property_exists($structure, 'charset')) { |
|
716 | 716 | return EncodingAliases::get($structure->charset, "ISO-8859-2"); |
717 | - }elseif (is_string($structure) === true){ |
|
717 | + }elseif (is_string($structure) === true) { |
|
718 | 718 | return mb_detect_encoding($structure); |
719 | 719 | } |
720 | 720 | |
@@ -729,7 +729,7 @@ discard block |
||
729 | 729 | * @throws Exceptions\FolderFetchingException |
730 | 730 | * @throws Exceptions\RuntimeException |
731 | 731 | */ |
732 | - public function getFolder(){ |
|
732 | + public function getFolder() { |
|
733 | 733 | return $this->client->getFolderByPath($this->folder_path); |
734 | 734 | } |
735 | 735 | |
@@ -745,13 +745,13 @@ discard block |
||
745 | 745 | * @throws Exceptions\GetMessagesFailedException |
746 | 746 | * @throws Exceptions\RuntimeException |
747 | 747 | */ |
748 | - public function thread(Folder $sent_folder = null, MessageCollection &$thread = null, Folder $folder = null): MessageCollection { |
|
748 | + public function thread(Folder $sent_folder = null, MessageCollection & $thread = null, Folder $folder = null): MessageCollection { |
|
749 | 749 | $thread = $thread ?: MessageCollection::make([]); |
750 | - $folder = $folder ?: $this->getFolder(); |
|
750 | + $folder = $folder ?: $this->getFolder(); |
|
751 | 751 | $sent_folder = $sent_folder ?: $this->client->getFolderByPath(ClientManager::get("options.common_folders.sent", "INBOX/Sent")); |
752 | 752 | |
753 | 753 | /** @var Message $message */ |
754 | - foreach($thread as $message) { |
|
754 | + foreach ($thread as $message) { |
|
755 | 755 | if ($message->message_id->first() == $this->message_id->first()) { |
756 | 756 | return $thread; |
757 | 757 | } |
@@ -762,7 +762,7 @@ discard block |
||
762 | 762 | $this->fetchThreadByInReplyTo($thread, $this->message_id, $sent_folder, $folder, $sent_folder); |
763 | 763 | |
764 | 764 | if (is_array($this->in_reply_to)) { |
765 | - foreach($this->in_reply_to as $in_reply_to) { |
|
765 | + foreach ($this->in_reply_to as $in_reply_to) { |
|
766 | 766 | $this->fetchThreadByMessageId($thread, $in_reply_to, $folder, $folder, $sent_folder); |
767 | 767 | $this->fetchThreadByMessageId($thread, $in_reply_to, $sent_folder, $folder, $sent_folder); |
768 | 768 | } |
@@ -784,7 +784,7 @@ discard block |
||
784 | 784 | * @throws Exceptions\RuntimeException |
785 | 785 | * @throws Exceptions\FolderFetchingException |
786 | 786 | */ |
787 | - protected function fetchThreadByInReplyTo(MessageCollection &$thread, string $in_reply_to, Folder $primary_folder, Folder $secondary_folder, Folder $sent_folder): void{ |
|
787 | + protected function fetchThreadByInReplyTo(MessageCollection & $thread, string $in_reply_to, Folder $primary_folder, Folder $secondary_folder, Folder $sent_folder): void{ |
|
788 | 788 | $primary_folder->query()->inReplyTo($in_reply_to) |
789 | 789 | ->setFetchBody($this->getFetchBodyOption()) |
790 | 790 | ->leaveUnread()->get()->each(function($message) use(&$thread, $secondary_folder, $sent_folder): void{ |
@@ -806,7 +806,7 @@ discard block |
||
806 | 806 | * @throws Exceptions\RuntimeException |
807 | 807 | * @throws Exceptions\FolderFetchingException |
808 | 808 | */ |
809 | - protected function fetchThreadByMessageId(MessageCollection &$thread, string $message_id, Folder $primary_folder, Folder $secondary_folder, Folder $sent_folder): void{ |
|
809 | + protected function fetchThreadByMessageId(MessageCollection & $thread, string $message_id, Folder $primary_folder, Folder $secondary_folder, Folder $sent_folder): void{ |
|
810 | 810 | $primary_folder->query()->messageId($message_id) |
811 | 811 | ->setFetchBody($this->getFetchBodyOption()) |
812 | 812 | ->leaveUnread()->get()->each(function($message) use(&$thread, $secondary_folder, $sent_folder): void{ |
@@ -901,13 +901,13 @@ discard block |
||
901 | 901 | * @throws MessageHeaderFetchingException |
902 | 902 | */ |
903 | 903 | protected function fetchNewMail(Folder $folder, int $next_uid, string $event, bool $expunge): Message { |
904 | - if($expunge) $this->client->expunge(); |
|
904 | + if ($expunge) $this->client->expunge(); |
|
905 | 905 | |
906 | 906 | $this->client->openFolder($folder->path); |
907 | 907 | |
908 | 908 | if ($this->sequence === IMAP::ST_UID) { |
909 | 909 | $sequence_id = $next_uid; |
910 | - }else{ |
|
910 | + }else { |
|
911 | 911 | $sequence_id = $this->client->getConnection()->getMessageNumber($next_uid); |
912 | 912 | } |
913 | 913 | |
@@ -937,11 +937,11 @@ discard block |
||
937 | 937 | */ |
938 | 938 | public function delete(bool $expunge = true, string $trash_path = null, bool $force_move = false) { |
939 | 939 | $status = $this->setFlag("Deleted"); |
940 | - if($force_move) { |
|
940 | + if ($force_move) { |
|
941 | 941 | $trash_path ??= $this->config["common_folders"]["trash"]; |
942 | 942 | $status = $this->move($trash_path); |
943 | 943 | } |
944 | - if($expunge) $this->client->expunge(); |
|
944 | + if ($expunge) $this->client->expunge(); |
|
945 | 945 | |
946 | 946 | $event = $this->getEvent("message", "deleted"); |
947 | 947 | $event::dispatch($this); |
@@ -961,7 +961,7 @@ discard block |
||
961 | 961 | */ |
962 | 962 | public function restore(bool $expunge = true): bool { |
963 | 963 | $status = $this->unsetFlag("Deleted"); |
964 | - if($expunge) $this->client->expunge(); |
|
964 | + if ($expunge) $this->client->expunge(); |
|
965 | 965 | |
966 | 966 | $event = $this->getEvent("message", "restored"); |
967 | 967 | $event::dispatch($this); |
@@ -1204,7 +1204,7 @@ discard block |
||
1204 | 1204 | * @return $this |
1205 | 1205 | */ |
1206 | 1206 | public function setMask(string $mask): self { |
1207 | - if(class_exists($mask)){ |
|
1207 | + if (class_exists($mask)) { |
|
1208 | 1208 | $this->mask = $mask; |
1209 | 1209 | } |
1210 | 1210 | |
@@ -1229,7 +1229,7 @@ discard block |
||
1229 | 1229 | */ |
1230 | 1230 | public function mask($mask = null): object { |
1231 | 1231 | $mask ??= $this->mask; |
1232 | - if(class_exists($mask)){ |
|
1232 | + if (class_exists($mask)) { |
|
1233 | 1233 | return new $mask($this); |
1234 | 1234 | } |
1235 | 1235 | |
@@ -1381,7 +1381,7 @@ discard block |
||
1381 | 1381 | if ($this->getSequence() === IMAP::ST_UID) { |
1382 | 1382 | $this->setUid($uid); |
1383 | 1383 | $this->setMsglist($msglist); |
1384 | - }else{ |
|
1384 | + }else { |
|
1385 | 1385 | $this->setMsgn($uid, $msglist); |
1386 | 1386 | } |
1387 | 1387 | } |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | public function offsetSet($offset, $value): void { |
114 | 114 | if (is_null($offset)) { |
115 | 115 | $this->values[] = $value; |
116 | - } else { |
|
116 | + }else { |
|
117 | 117 | $this->values[$offset] = $value; |
118 | 118 | } |
119 | 119 | } |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | if ($this->contains($value) === false) { |
181 | 181 | $this->values[] = $value; |
182 | 182 | } |
183 | - }else{ |
|
183 | + }else { |
|
184 | 184 | $this->values[] = $value; |
185 | 185 | } |
186 | 186 | } |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | * |
228 | 228 | * @return mixed|null |
229 | 229 | */ |
230 | - public function first(){ |
|
230 | + public function first() { |
|
231 | 231 | if ($this->offsetExists(0)) { |
232 | 232 | return $this->values[0]; |
233 | 233 | } |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | * |
240 | 240 | * @return mixed|null |
241 | 241 | */ |
242 | - public function last(){ |
|
242 | + public function last() { |
|
243 | 243 | if (($cnt = $this->count()) > 0) { |
244 | 244 | return $this->values[$cnt - 1]; |
245 | 245 | } |
@@ -85,8 +85,8 @@ discard block |
||
85 | 85 | } |
86 | 86 | |
87 | 87 | if (strpos(strtolower($name), "where") === false) { |
88 | - $method = 'where' . ucfirst($name); |
|
89 | - } else { |
|
88 | + $method = 'where'.ucfirst($name); |
|
89 | + }else { |
|
90 | 90 | $method = lcfirst($name); |
91 | 91 | } |
92 | 92 | |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | return call_user_func_array([$that, $method], $arguments); |
95 | 95 | } |
96 | 96 | |
97 | - throw new MethodNotFoundException("Method " . self::class . '::' . $method . '() is not supported'); |
|
97 | + throw new MethodNotFoundException("Method ".self::class.'::'.$method.'() is not supported'); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | /** |
@@ -137,11 +137,11 @@ 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 | } |
144 | - } else { |
|
144 | + }else { |
|
145 | 145 | $this->push_search_criteria($criteria, $value); |
146 | 146 | } |
147 | 147 | |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | |
162 | 162 | if ($value === null || $value === '') { |
163 | 163 | $this->query->push([$criteria]); |
164 | - } else { |
|
164 | + }else { |
|
165 | 165 | $this->query->push([$criteria, $value]); |
166 | 166 | } |
167 | 167 | } |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | |
86 | 86 | if (ClientManager::get('options.fetch_order') === 'desc') { |
87 | 87 | $this->fetch_order = 'desc'; |
88 | - } else { |
|
88 | + }else { |
|
89 | 89 | $this->fetch_order = 'asc'; |
90 | 90 | } |
91 | 91 | |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | break; |
117 | 117 | } |
118 | 118 | |
119 | - return (string)$value; |
|
119 | + return (string) $value; |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | /** |
@@ -148,14 +148,14 @@ discard block |
||
148 | 148 | $this->query->each(function($statement) use (&$query): void { |
149 | 149 | if ((is_countable($statement) ? count($statement) : 0) == 1) { |
150 | 150 | $query .= $statement[0]; |
151 | - } else { |
|
151 | + }else { |
|
152 | 152 | if ($statement[1] === null) { |
153 | 153 | $query .= $statement[0]; |
154 | - } else { |
|
154 | + }else { |
|
155 | 155 | if (is_numeric($statement[1])) { |
156 | - $query .= $statement[0] . ' ' . $statement[1]; |
|
157 | - } else { |
|
158 | - $query .= $statement[0] . ' "' . $statement[1] . '"'; |
|
156 | + $query .= $statement[0].' '.$statement[1]; |
|
157 | + }else { |
|
158 | + $query .= $statement[0].' "'.$statement[1].'"'; |
|
159 | 159 | } |
160 | 160 | } |
161 | 161 | } |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | try { |
181 | 181 | $available_messages = $this->client->getConnection()->search([$this->getRawQuery()], $this->sequence); |
182 | 182 | return $available_messages !== false ? new Collection($available_messages) : new Collection(); |
183 | - } catch (RuntimeException|ConnectionFailedException $e) { |
|
183 | + } catch (RuntimeException | ConnectionFailedException $e) { |
|
184 | 184 | throw new GetMessagesFailedException("failed to fetch messages", 0, $e); |
185 | 185 | } |
186 | 186 | } |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | protected function make(int $uid, int $msglist, string $header, string $content, array $flags) { |
247 | 247 | try { |
248 | 248 | return Message::make($uid, $msglist, $this->getClient(), $header, $content, $flags, $this->getFetchOptions(), $this->sequence); |
249 | - } catch (MessageNotFoundException|RuntimeException|MessageFlagException|InvalidMessageDateException|MessageContentFetchingException $e) { |
|
249 | + } catch (MessageNotFoundException | RuntimeException | MessageFlagException | InvalidMessageDateException | MessageContentFetchingException $e) { |
|
250 | 250 | $this->setError($uid, $e); |
251 | 251 | } |
252 | 252 | |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | $key = $message->getMessageId(); |
279 | 279 | break; |
280 | 280 | } |
281 | - return (string)$key; |
|
281 | + return (string) $key; |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | /** |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | $extensions = $raw_messages["extensions"][$uid] ?? []; |
327 | 327 | |
328 | 328 | $message = $this->make($uid, $msglist, $header, $content, $flag); |
329 | - foreach($extensions as $key => $extension) { |
|
329 | + foreach ($extensions as $key => $extension) { |
|
330 | 330 | $message->getHeader()->set($key, $extension); |
331 | 331 | } |
332 | 332 | if ($message !== null) { |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | $uids = $connection->getUid(); |
479 | 479 | $available_messages = new Collection(); |
480 | 480 | if (is_array($uids)) { |
481 | - foreach ($uids as $id){ |
|
481 | + foreach ($uids as $id) { |
|
482 | 482 | if ($closure($id)) { |
483 | 483 | $available_messages->push($id); |
484 | 484 | } |
@@ -68,7 +68,7 @@ |
||
68 | 68 | * @return int|null |
69 | 69 | */ |
70 | 70 | public function total($total = null): ?int { |
71 | - if($total === null) { |
|
71 | + if ($total === null) { |
|
72 | 72 | return $this->total; |
73 | 73 | } |
74 | 74 |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | public function __construct(object $parent) { |
42 | 42 | $this->parent = $parent; |
43 | 43 | |
44 | - if(method_exists($this->parent, 'getAttributes')){ |
|
44 | + if (method_exists($this->parent, 'getAttributes')) { |
|
45 | 45 | $this->attributes = array_merge($this->attributes, $this->parent->getAttributes()); |
46 | 46 | } |
47 | 47 | |
@@ -62,17 +62,17 @@ discard block |
||
62 | 62 | * @throws MethodNotFoundException |
63 | 63 | */ |
64 | 64 | public function __call(string $method, array $arguments) { |
65 | - if(strtolower(substr($method, 0, 3)) === 'get') { |
|
65 | + if (strtolower(substr($method, 0, 3)) === 'get') { |
|
66 | 66 | $name = Str::snake(substr($method, 3)); |
67 | 67 | |
68 | - if(isset($this->attributes[$name])) { |
|
68 | + if (isset($this->attributes[$name])) { |
|
69 | 69 | return $this->attributes[$name]; |
70 | 70 | } |
71 | 71 | |
72 | 72 | }elseif (strtolower(substr($method, 0, 3)) === 'set') { |
73 | 73 | $name = Str::snake(substr($method, 3)); |
74 | 74 | |
75 | - if(isset($this->attributes[$name])) { |
|
75 | + if (isset($this->attributes[$name])) { |
|
76 | 76 | $this->attributes[$name] = array_pop($arguments); |
77 | 77 | |
78 | 78 | return $this->attributes[$name]; |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | |
81 | 81 | } |
82 | 82 | |
83 | - if(method_exists($this->parent, $method) === true){ |
|
83 | + if (method_exists($this->parent, $method) === true) { |
|
84 | 84 | return call_user_func_array([$this->parent, $method], $arguments); |
85 | 85 | } |
86 | 86 | |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | * @return mixed|null |
108 | 108 | */ |
109 | 109 | public function __get($name) { |
110 | - if(isset($this->attributes[$name])) { |
|
110 | + if (isset($this->attributes[$name])) { |
|
111 | 111 | return $this->attributes[$name]; |
112 | 112 | } |
113 | 113 |
@@ -30,13 +30,13 @@ discard block |
||
30 | 30 | * |
31 | 31 | * @return null |
32 | 32 | */ |
33 | - public function getHtmlBody(){ |
|
33 | + public function getHtmlBody() { |
|
34 | 34 | $bodies = $this->parent->getBodies(); |
35 | 35 | if (!isset($bodies['html'])) { |
36 | 36 | return null; |
37 | 37 | } |
38 | 38 | |
39 | - if(is_object($bodies['html']) && property_exists($bodies['html'], 'content')) { |
|
39 | + if (is_object($bodies['html']) && property_exists($bodies['html'], 'content')) { |
|
40 | 40 | return $bodies['html']->content; |
41 | 41 | } |
42 | 42 | return $bodies['html']; |
@@ -50,15 +50,15 @@ discard block |
||
50 | 50 | */ |
51 | 51 | public function getCustomHTMLBody($callback = false): ?string { |
52 | 52 | $body = $this->getHtmlBody(); |
53 | - if($body === null) return null; |
|
53 | + if ($body === null) return null; |
|
54 | 54 | |
55 | 55 | if ($callback !== false) { |
56 | 56 | $aAttachment = $this->parent->getAttachments(); |
57 | 57 | $aAttachment->each(function($oAttachment) use(&$body, $callback): void { |
58 | 58 | /** @var Attachment $oAttachment */ |
59 | - if(is_callable($callback)) { |
|
59 | + if (is_callable($callback)) { |
|
60 | 60 | $body = $callback($body, $oAttachment); |
61 | - }elseif(is_string($callback)) { |
|
61 | + }elseif (is_string($callback)) { |
|
62 | 62 | call_user_func($callback, [$body, $oAttachment]); |
63 | 63 | } |
64 | 64 | }); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * @return string|null |
75 | 75 | */ |
76 | 76 | public function getHTMLBodyWithEmbeddedBase64Images(): ?string { |
77 | - return $this->getCustomHTMLBody(function($body, $oAttachment){ |
|
77 | + return $this->getCustomHTMLBody(function($body, $oAttachment) { |
|
78 | 78 | /** @var Attachment $oAttachment */ |
79 | 79 | if ($oAttachment->id) { |
80 | 80 | $body = str_replace('cid:'.$oAttachment->id, 'data:'.$oAttachment->getContentType().';base64, '.base64_encode($oAttachment->getContent()), $body); |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | |
120 | 120 | $this->setDelimiter($delimiter); |
121 | 121 | $this->path = $folder_name; |
122 | - $this->full_name = $this->decodeName($folder_name); |
|
122 | + $this->full_name = $this->decodeName($folder_name); |
|
123 | 123 | $this->name = $this->getSimpleName($this->delimiter, $this->full_name); |
124 | 124 | |
125 | 125 | $this->parseAttributes($attributes); |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | public function move(string $new_name, bool $expunge = true): bool { |
231 | 231 | $this->client->checkConnection(); |
232 | 232 | $status = $this->client->getConnection()->renameFolder($this->full_name, $new_name); |
233 | - if($expunge) $this->client->expunge(); |
|
233 | + if ($expunge) $this->client->expunge(); |
|
234 | 234 | |
235 | 235 | $folder = $this->client->getFolder($new_name); |
236 | 236 | $event = $this->getEvent("folder", "moved"); |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | * date string that conforms to the rfc2060 specifications for a date_time value or be a Carbon object. |
274 | 274 | */ |
275 | 275 | |
276 | - if ($internal_date instanceof Carbon){ |
|
276 | + if ($internal_date instanceof Carbon) { |
|
277 | 277 | $internal_date = $internal_date->format('d-M-Y H:i:s O'); |
278 | 278 | } |
279 | 279 | |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | */ |
307 | 307 | public function delete(bool $expunge = true): bool { |
308 | 308 | $status = $this->client->getConnection()->deleteFolder($this->path); |
309 | - if($expunge) $this->client->expunge(); |
|
309 | + if ($expunge) $this->client->expunge(); |
|
310 | 310 | |
311 | 311 | $event = $this->getEvent("folder", "deleted"); |
312 | 312 | $event::dispatch($this); |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | try { |
372 | 372 | $line = $connection->nextLine(); |
373 | 373 | if (($pos = strpos($line, "EXISTS")) !== false) { |
374 | - $msgn = (int) substr($line, 2, $pos -2); |
|
374 | + $msgn = (int) substr($line, 2, $pos - 2); |
|
375 | 375 | $connection->done(); |
376 | 376 | |
377 | 377 | $this->client->openFolder($this->path, true); |
@@ -384,8 +384,8 @@ discard block |
||
384 | 384 | |
385 | 385 | $connection->idle(); |
386 | 386 | } |
387 | - }catch (Exceptions\RuntimeException $e) { |
|
388 | - if(strpos($e->getMessage(), "connection closed") === false) { |
|
387 | + } catch (Exceptions\RuntimeException $e) { |
|
388 | + if (strpos($e->getMessage(), "connection closed") === false) { |
|
389 | 389 | throw $e; |
390 | 390 | } |
391 | 391 | if ($auto_reconnect === true) { |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | * @param mixed $delimiter |
436 | 436 | */ |
437 | 437 | public function setDelimiter(string $delimiter): void { |
438 | - if(in_array($delimiter, [null, '', ' ', false]) === true) { |
|
438 | + if (in_array($delimiter, [null, '', ' ', false]) === true) { |
|
439 | 439 | $delimiter = ClientManager::get('options.delimiter', '/'); |
440 | 440 | } |
441 | 441 |