@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | public function __construct($msgn, $msglist, Client $client, $fetch_options = null, $fetch_body = false, $fetch_flags = false) { |
196 | 196 | |
197 | 197 | $default_mask = $client->getDefaultMessageMask(); |
198 | - if($default_mask != null) { |
|
198 | + if ($default_mask != null) { |
|
199 | 199 | $this->mask = $default_mask; |
200 | 200 | } |
201 | 201 | $this->events["message"] = $client->getDefaultEvents("message"); |
@@ -249,13 +249,13 @@ discard block |
||
249 | 249 | * @throws MessageContentFetchingException |
250 | 250 | * @throws \ReflectionException |
251 | 251 | */ |
252 | - public static function make($msgn, $msglist, Client $client, $raw_header, $raw_body, $raw_flags, $fetch_options = null){ |
|
252 | + public static function make($msgn, $msglist, Client $client, $raw_header, $raw_body, $raw_flags, $fetch_options = null) { |
|
253 | 253 | $reflection = new \ReflectionClass(self::class); |
254 | 254 | /** @var self $instance */ |
255 | 255 | $instance = $reflection->newInstanceWithoutConstructor(); |
256 | 256 | |
257 | 257 | $default_mask = $client->getDefaultMessageMask(); |
258 | - if($default_mask != null) { |
|
258 | + if ($default_mask != null) { |
|
259 | 259 | $instance->setMask($default_mask); |
260 | 260 | } |
261 | 261 | $instance->setEvents([ |
@@ -301,13 +301,13 @@ discard block |
||
301 | 301 | * @throws MethodNotFoundException |
302 | 302 | */ |
303 | 303 | public function __call($method, $arguments) { |
304 | - if(strtolower(substr($method, 0, 3)) === 'get') { |
|
304 | + if (strtolower(substr($method, 0, 3)) === 'get') { |
|
305 | 305 | $name = Str::snake(substr($method, 3)); |
306 | 306 | return $this->get($name); |
307 | 307 | }elseif (strtolower(substr($method, 0, 3)) === 'set') { |
308 | 308 | $name = Str::snake(substr($method, 3)); |
309 | 309 | |
310 | - if(in_array($name, array_keys($this->attributes))) { |
|
310 | + if (in_array($name, array_keys($this->attributes))) { |
|
311 | 311 | $this->attributes[$name] = array_pop($arguments); |
312 | 312 | |
313 | 313 | return $this->attributes[$name]; |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | * @return mixed|null |
349 | 349 | */ |
350 | 350 | public function get($name) { |
351 | - if(isset($this->attributes[$name])) { |
|
351 | + if (isset($this->attributes[$name])) { |
|
352 | 352 | return $this->attributes[$name]; |
353 | 353 | } |
354 | 354 | |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | * |
422 | 422 | * @throws InvalidMessageDateException |
423 | 423 | */ |
424 | - public function parseRawHeader($raw_header){ |
|
424 | + public function parseRawHeader($raw_header) { |
|
425 | 425 | $this->header = new Header($raw_header); |
426 | 426 | } |
427 | 427 | |
@@ -432,8 +432,8 @@ discard block |
||
432 | 432 | public function parseRawFlags($raw_flags) { |
433 | 433 | $this->flags = FlagCollection::make([]); |
434 | 434 | |
435 | - foreach($raw_flags as $flag) { |
|
436 | - if (strpos($flag, "\\") === 0){ |
|
435 | + foreach ($raw_flags as $flag) { |
|
436 | + if (strpos($flag, "\\") === 0) { |
|
437 | 437 | $flag = substr($flag, 1); |
438 | 438 | } |
439 | 439 | $flag_key = strtolower($flag); |
@@ -536,7 +536,7 @@ discard block |
||
536 | 536 | |
537 | 537 | if ($part->isAttachment()) { |
538 | 538 | $this->fetchAttachment($part); |
539 | - }else{ |
|
539 | + }else { |
|
540 | 540 | $encoding = $this->getEncoding($part); |
541 | 541 | |
542 | 542 | $content = $this->decodeString($part->content, $part->encoding); |
@@ -574,7 +574,7 @@ discard block |
||
574 | 574 | if ($oAttachment->getName() !== null && $oAttachment->getSize() > 0) { |
575 | 575 | if ($oAttachment->getId() !== null) { |
576 | 576 | $this->attachments->put($oAttachment->getId(), $oAttachment); |
577 | - } else { |
|
577 | + }else { |
|
578 | 578 | $this->attachments->push($oAttachment); |
579 | 579 | } |
580 | 580 | } |
@@ -691,7 +691,7 @@ discard block |
||
691 | 691 | |
692 | 692 | if (function_exists('iconv') && $from != 'UTF-7' && $to != 'UTF-7') { |
693 | 693 | return @iconv($from, $to.'//IGNORE', $str); |
694 | - } else { |
|
694 | + }else { |
|
695 | 695 | if (!$from) { |
696 | 696 | return mb_convert_encoding($str, $to); |
697 | 697 | } |
@@ -712,9 +712,9 @@ discard block |
||
712 | 712 | return EncodingAliases::get($parameter->value); |
713 | 713 | } |
714 | 714 | } |
715 | - }elseif (property_exists($structure, 'charset')){ |
|
715 | + }elseif (property_exists($structure, 'charset')) { |
|
716 | 716 | return EncodingAliases::get($structure->charset); |
717 | - }elseif (is_string($structure) === true){ |
|
717 | + }elseif (is_string($structure) === true) { |
|
718 | 718 | return mb_detect_encoding($structure); |
719 | 719 | } |
720 | 720 | |
@@ -728,7 +728,7 @@ discard block |
||
728 | 728 | * @throws Exceptions\ConnectionFailedException |
729 | 729 | * @throws Exceptions\FolderFetchingException |
730 | 730 | */ |
731 | - public function getFolder(){ |
|
731 | + public function getFolder() { |
|
732 | 732 | return $this->client->getFolder($this->folder_path); |
733 | 733 | } |
734 | 734 | |
@@ -743,13 +743,13 @@ discard block |
||
743 | 743 | * @throws Exceptions\FolderFetchingException |
744 | 744 | * @throws Exceptions\GetMessagesFailedException |
745 | 745 | */ |
746 | - public function thread($sent_folder = null, &$thread = null, $folder = null){ |
|
746 | + public function thread($sent_folder = null, &$thread = null, $folder = null) { |
|
747 | 747 | $thread = $thread ? $thread : MessageCollection::make([]); |
748 | - $folder = $folder ? $folder : $this->getFolder(); |
|
748 | + $folder = $folder ? $folder : $this->getFolder(); |
|
749 | 749 | $sent_folder = $sent_folder ? $sent_folder : $this->client->getFolder(ClientManager::get("options.common_folders.sent", "INBOX/Sent")); |
750 | 750 | |
751 | 751 | /** @var Message $message */ |
752 | - foreach($thread as $message) { |
|
752 | + foreach ($thread as $message) { |
|
753 | 753 | if ($message->message_id == $this->message_id) { |
754 | 754 | return $thread; |
755 | 755 | } |
@@ -770,7 +770,7 @@ discard block |
||
770 | 770 | }); |
771 | 771 | |
772 | 772 | if (is_array($this->in_reply_to)) { |
773 | - foreach($this->in_reply_to as $in_reply_to) { |
|
773 | + foreach ($this->in_reply_to as $in_reply_to) { |
|
774 | 774 | $folder->query()->messageId($in_reply_to) |
775 | 775 | ->setFetchBody($this->getFetchBodyOption()) |
776 | 776 | ->leaveUnread()->get()->each(function($message) use(&$thread, $folder, $sent_folder){ |
@@ -815,7 +815,7 @@ discard block |
||
815 | 815 | |
816 | 816 | $this->client->openFolder($this->folder_path); |
817 | 817 | if ($this->client->getConnection()->copyMessage($folder->path, $this->msgn) == true) { |
818 | - if($expunge) $this->client->expunge(); |
|
818 | + if ($expunge) $this->client->expunge(); |
|
819 | 819 | |
820 | 820 | $this->client->openFolder($folder->path); |
821 | 821 | $message_num = $this->client->getConnection()->getMessageNumber($next_uid); |
@@ -857,7 +857,7 @@ discard block |
||
857 | 857 | |
858 | 858 | $this->client->openFolder($this->folder_path); |
859 | 859 | if ($this->client->getConnection()->moveMessage($folder->path, $this->msgn) == true) { |
860 | - if($expunge) $this->client->expunge(); |
|
860 | + if ($expunge) $this->client->expunge(); |
|
861 | 861 | |
862 | 862 | $this->client->openFolder($folder->path); |
863 | 863 | $message_num = $this->client->getConnection()->getMessageNumber($next_uid); |
@@ -884,7 +884,7 @@ discard block |
||
884 | 884 | */ |
885 | 885 | public function delete($expunge = true) { |
886 | 886 | $status = $this->setFlag("Deleted"); |
887 | - if($expunge) $this->client->expunge(); |
|
887 | + if ($expunge) $this->client->expunge(); |
|
888 | 888 | |
889 | 889 | $event = $this->getEvent("message", "deleted"); |
890 | 890 | $event::dispatch($this); |
@@ -903,7 +903,7 @@ discard block |
||
903 | 903 | */ |
904 | 904 | public function restore($expunge = true) { |
905 | 905 | $status = $this->unsetFlag("Deleted"); |
906 | - if($expunge) $this->client->expunge(); |
|
906 | + if ($expunge) $this->client->expunge(); |
|
907 | 907 | |
908 | 908 | $event = $this->getEvent("message", "restored"); |
909 | 909 | $event::dispatch($this); |
@@ -1056,7 +1056,7 @@ discard block |
||
1056 | 1056 | * |
1057 | 1057 | * @return Structure|null |
1058 | 1058 | */ |
1059 | - public function getStructure(){ |
|
1059 | + public function getStructure() { |
|
1060 | 1060 | return $this->structure; |
1061 | 1061 | } |
1062 | 1062 | |
@@ -1082,7 +1082,7 @@ discard block |
||
1082 | 1082 | * |
1083 | 1083 | * @return array |
1084 | 1084 | */ |
1085 | - public function getAttributes(){ |
|
1085 | + public function getAttributes() { |
|
1086 | 1086 | return array_merge($this->attributes, $this->header->getAttributes()); |
1087 | 1087 | } |
1088 | 1088 | |
@@ -1092,8 +1092,8 @@ discard block |
||
1092 | 1092 | * |
1093 | 1093 | * @return $this |
1094 | 1094 | */ |
1095 | - public function setMask($mask){ |
|
1096 | - if(class_exists($mask)){ |
|
1095 | + public function setMask($mask) { |
|
1096 | + if (class_exists($mask)) { |
|
1097 | 1097 | $this->mask = $mask; |
1098 | 1098 | } |
1099 | 1099 | |
@@ -1105,7 +1105,7 @@ discard block |
||
1105 | 1105 | * |
1106 | 1106 | * @return string |
1107 | 1107 | */ |
1108 | - public function getMask(){ |
|
1108 | + public function getMask() { |
|
1109 | 1109 | return $this->mask; |
1110 | 1110 | } |
1111 | 1111 | |
@@ -1116,9 +1116,9 @@ discard block |
||
1116 | 1116 | * @return mixed |
1117 | 1117 | * @throws MaskNotFoundException |
1118 | 1118 | */ |
1119 | - public function mask($mask = null){ |
|
1119 | + public function mask($mask = null) { |
|
1120 | 1120 | $mask = $mask !== null ? $mask : $this->mask; |
1121 | - if(class_exists($mask)){ |
|
1121 | + if (class_exists($mask)) { |
|
1122 | 1122 | return new $mask($this); |
1123 | 1123 | } |
1124 | 1124 | |
@@ -1131,7 +1131,7 @@ discard block |
||
1131 | 1131 | * |
1132 | 1132 | * @return $this |
1133 | 1133 | */ |
1134 | - public function setFolderPath($folder_path){ |
|
1134 | + public function setFolderPath($folder_path) { |
|
1135 | 1135 | $this->folder_path = $folder_path; |
1136 | 1136 | |
1137 | 1137 | return $this; |
@@ -1143,7 +1143,7 @@ discard block |
||
1143 | 1143 | * |
1144 | 1144 | * @return $this |
1145 | 1145 | */ |
1146 | - public function setConfig($config){ |
|
1146 | + public function setConfig($config) { |
|
1147 | 1147 | $this->config = $config; |
1148 | 1148 | |
1149 | 1149 | return $this; |
@@ -1155,7 +1155,7 @@ discard block |
||
1155 | 1155 | * |
1156 | 1156 | * @return $this |
1157 | 1157 | */ |
1158 | - public function setAttachments($attachments){ |
|
1158 | + public function setAttachments($attachments) { |
|
1159 | 1159 | $this->attachments = $attachments; |
1160 | 1160 | |
1161 | 1161 | return $this; |
@@ -1167,7 +1167,7 @@ discard block |
||
1167 | 1167 | * |
1168 | 1168 | * @return $this |
1169 | 1169 | */ |
1170 | - public function setFlags($flags){ |
|
1170 | + public function setFlags($flags) { |
|
1171 | 1171 | $this->flags = $flags; |
1172 | 1172 | |
1173 | 1173 | return $this; |
@@ -1180,7 +1180,7 @@ discard block |
||
1180 | 1180 | * @throws Exceptions\ConnectionFailedException |
1181 | 1181 | * @return $this |
1182 | 1182 | */ |
1183 | - public function setClient($client){ |
|
1183 | + public function setClient($client) { |
|
1184 | 1184 | $this->client = $client; |
1185 | 1185 | $this->client->openFolder($this->folder_path); |
1186 | 1186 | |
@@ -1196,7 +1196,7 @@ discard block |
||
1196 | 1196 | * @throws Exceptions\RuntimeException |
1197 | 1197 | * @return $this |
1198 | 1198 | */ |
1199 | - public function setMsgn($msgn, $msglist = null){ |
|
1199 | + public function setMsgn($msgn, $msglist = null) { |
|
1200 | 1200 | $this->msgn = $msgn; |
1201 | 1201 | $this->msglist = $msglist; |
1202 | 1202 | $this->uid = $this->client->getConnection()->getUid($this->msgn); |
@@ -377,7 +377,7 @@ |
||
377 | 377 | if (strpos($folder_name, $delimiter) !== false) { |
378 | 378 | return $this->getFolderByPath($folder_name); |
379 | 379 | } |
380 | - } |
|
380 | + } |
|
381 | 381 | |
382 | 382 | return $this->getFolderByName($folder_name); |
383 | 383 | } |
@@ -177,11 +177,11 @@ discard block |
||
177 | 177 | * @param array $config |
178 | 178 | * @param array $default_config |
179 | 179 | */ |
180 | - private function setAccountConfig($key, $config, $default_config){ |
|
180 | + private function setAccountConfig($key, $config, $default_config) { |
|
181 | 181 | $value = $this->default_account_config[$key]; |
182 | - if(isset($config[$key])) { |
|
182 | + if (isset($config[$key])) { |
|
183 | 183 | $value = $config[$key]; |
184 | - }elseif(isset($default_config[$key])) { |
|
184 | + }elseif (isset($default_config[$key])) { |
|
185 | 185 | $value = $default_config[$key]; |
186 | 186 | } |
187 | 187 | $this->$key = $value; |
@@ -193,9 +193,9 @@ discard block |
||
193 | 193 | */ |
194 | 194 | protected function setEventsFromConfig($config) { |
195 | 195 | $this->events = ClientManager::get("events"); |
196 | - if(isset($config['events'])){ |
|
197 | - if(isset($config['events'])) { |
|
198 | - foreach($config['events'] as $section => $events) { |
|
196 | + if (isset($config['events'])) { |
|
197 | + if (isset($config['events'])) { |
|
198 | + foreach ($config['events'] as $section => $events) { |
|
199 | 199 | $this->events[$section] = array_merge($this->events[$section], $events); |
200 | 200 | } |
201 | 201 | } |
@@ -209,45 +209,45 @@ discard block |
||
209 | 209 | * @throws MaskNotFoundException |
210 | 210 | */ |
211 | 211 | protected function setMaskFromConfig($config) { |
212 | - $default_config = ClientManager::get("masks"); |
|
212 | + $default_config = ClientManager::get("masks"); |
|
213 | 213 | |
214 | - if(isset($config['masks'])){ |
|
215 | - if(isset($config['masks']['message'])) { |
|
216 | - if(class_exists($config['masks']['message'])) { |
|
214 | + if (isset($config['masks'])) { |
|
215 | + if (isset($config['masks']['message'])) { |
|
216 | + if (class_exists($config['masks']['message'])) { |
|
217 | 217 | $this->default_message_mask = $config['masks']['message']; |
218 | - }else{ |
|
218 | + }else { |
|
219 | 219 | throw new MaskNotFoundException("Unknown mask provided: ".$config['masks']['message']); |
220 | 220 | } |
221 | - }else{ |
|
222 | - if(class_exists($default_config['message'])) { |
|
221 | + }else { |
|
222 | + if (class_exists($default_config['message'])) { |
|
223 | 223 | $this->default_message_mask = $default_config['message']; |
224 | - }else{ |
|
224 | + }else { |
|
225 | 225 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['message']); |
226 | 226 | } |
227 | 227 | } |
228 | - if(isset($config['masks']['attachment'])) { |
|
229 | - if(class_exists($config['masks']['attachment'])) { |
|
228 | + if (isset($config['masks']['attachment'])) { |
|
229 | + if (class_exists($config['masks']['attachment'])) { |
|
230 | 230 | $this->default_message_mask = $config['masks']['attachment']; |
231 | - }else{ |
|
231 | + }else { |
|
232 | 232 | throw new MaskNotFoundException("Unknown mask provided: ".$config['masks']['attachment']); |
233 | 233 | } |
234 | - }else{ |
|
235 | - if(class_exists($default_config['attachment'])) { |
|
234 | + }else { |
|
235 | + if (class_exists($default_config['attachment'])) { |
|
236 | 236 | $this->default_message_mask = $default_config['attachment']; |
237 | - }else{ |
|
237 | + }else { |
|
238 | 238 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['attachment']); |
239 | 239 | } |
240 | 240 | } |
241 | - }else{ |
|
242 | - if(class_exists($default_config['message'])) { |
|
241 | + }else { |
|
242 | + if (class_exists($default_config['message'])) { |
|
243 | 243 | $this->default_message_mask = $default_config['message']; |
244 | - }else{ |
|
244 | + }else { |
|
245 | 245 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['message']); |
246 | 246 | } |
247 | 247 | |
248 | - if(class_exists($default_config['attachment'])) { |
|
248 | + if (class_exists($default_config['attachment'])) { |
|
249 | 249 | $this->default_message_mask = $default_config['attachment']; |
250 | - }else{ |
|
250 | + }else { |
|
251 | 251 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['attachment']); |
252 | 252 | } |
253 | 253 | } |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | $timeout = $this->connection !== false ? $this->connection->getConnectionTimeout() : null; |
312 | 312 | $this->connection = new ImapProtocol($this->validate_cert); |
313 | 313 | $this->connection->setConnectionTimeout($timeout); |
314 | - }else{ |
|
314 | + }else { |
|
315 | 315 | if (extension_loaded('imap') === false) { |
316 | 316 | throw new ConnectionFailedException("connection setup failed", 0, new ProtocolNotSupportedException($protocol." is an unsupported protocol")); |
317 | 317 | } |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | $pattern = $parent_folder.($hierarchical ? '%' : '*'); |
425 | 425 | $items = $this->connection->folders('', $pattern); |
426 | 426 | |
427 | - if(is_array($items)){ |
|
427 | + if (is_array($items)) { |
|
428 | 428 | foreach ($items as $folder_name => $item) { |
429 | 429 | $folder = new Folder($this, $folder_name, $item["delimiter"], $item["flags"]); |
430 | 430 | |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | } |
440 | 440 | |
441 | 441 | return $folders; |
442 | - }else{ |
|
442 | + }else { |
|
443 | 443 | throw new FolderFetchingException("failed to fetch any folders"); |
444 | 444 | } |
445 | 445 | } |
@@ -475,10 +475,10 @@ discard block |
||
475 | 475 | $this->checkConnection(); |
476 | 476 | $status = $this->connection->createFolder($folder); |
477 | 477 | |
478 | - if($expunge) $this->expunge(); |
|
478 | + if ($expunge) $this->expunge(); |
|
479 | 479 | |
480 | 480 | $folder = $this->getFolder($folder); |
481 | - if($status && $folder) { |
|
481 | + if ($status && $folder) { |
|
482 | 482 | $event = $this->getEvent("folder", "new"); |
483 | 483 | $event::dispatch($folder); |
484 | 484 | } |
@@ -503,7 +503,7 @@ discard block |
||
503 | 503 | * |
504 | 504 | * @return Folder |
505 | 505 | */ |
506 | - public function getFolderPath(){ |
|
506 | + public function getFolderPath() { |
|
507 | 507 | return $this->active_folder; |
508 | 508 | } |
509 | 509 | |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | * |
558 | 558 | * @return int |
559 | 559 | */ |
560 | - public function getTimeout($type){ |
|
560 | + public function getTimeout($type) { |
|
561 | 561 | return $this->connection->getConnectionTimeout(); |
562 | 562 | } |
563 | 563 | |
@@ -566,7 +566,7 @@ discard block |
||
566 | 566 | * |
567 | 567 | * @return string |
568 | 568 | */ |
569 | - public function getDefaultMessageMask(){ |
|
569 | + public function getDefaultMessageMask() { |
|
570 | 570 | return $this->default_message_mask; |
571 | 571 | } |
572 | 572 | |
@@ -576,7 +576,7 @@ discard block |
||
576 | 576 | * |
577 | 577 | * @return array |
578 | 578 | */ |
579 | - public function getDefaultEvents($section){ |
|
579 | + public function getDefaultEvents($section) { |
|
580 | 580 | return $this->events[$section]; |
581 | 581 | } |
582 | 582 | |
@@ -588,7 +588,7 @@ discard block |
||
588 | 588 | * @throws MaskNotFoundException |
589 | 589 | */ |
590 | 590 | public function setDefaultMessageMask($mask) { |
591 | - if(class_exists($mask)) { |
|
591 | + if (class_exists($mask)) { |
|
592 | 592 | $this->default_message_mask = $mask; |
593 | 593 | |
594 | 594 | return $this; |
@@ -602,7 +602,7 @@ discard block |
||
602 | 602 | * |
603 | 603 | * @return string |
604 | 604 | */ |
605 | - public function getDefaultAttachmentMask(){ |
|
605 | + public function getDefaultAttachmentMask() { |
|
606 | 606 | return $this->default_attachment_mask; |
607 | 607 | } |
608 | 608 | |
@@ -614,7 +614,7 @@ discard block |
||
614 | 614 | * @throws MaskNotFoundException |
615 | 615 | */ |
616 | 616 | public function setDefaultAttachmentMask($mask) { |
617 | - if(class_exists($mask)) { |
|
617 | + if (class_exists($mask)) { |
|
618 | 618 | $this->default_attachment_mask = $mask; |
619 | 619 | |
620 | 620 | return $this; |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | $value = $this->default_account_config[$key]; |
182 | 182 | if(isset($config[$key])) { |
183 | 183 | $value = $config[$key]; |
184 | - }elseif(isset($default_config[$key])) { |
|
184 | + } elseif(isset($default_config[$key])) { |
|
185 | 185 | $value = $default_config[$key]; |
186 | 186 | } |
187 | 187 | $this->$key = $value; |
@@ -215,39 +215,39 @@ discard block |
||
215 | 215 | if(isset($config['masks']['message'])) { |
216 | 216 | if(class_exists($config['masks']['message'])) { |
217 | 217 | $this->default_message_mask = $config['masks']['message']; |
218 | - }else{ |
|
218 | + } else{ |
|
219 | 219 | throw new MaskNotFoundException("Unknown mask provided: ".$config['masks']['message']); |
220 | 220 | } |
221 | - }else{ |
|
221 | + } else{ |
|
222 | 222 | if(class_exists($default_config['message'])) { |
223 | 223 | $this->default_message_mask = $default_config['message']; |
224 | - }else{ |
|
224 | + } else{ |
|
225 | 225 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['message']); |
226 | 226 | } |
227 | 227 | } |
228 | 228 | if(isset($config['masks']['attachment'])) { |
229 | 229 | if(class_exists($config['masks']['attachment'])) { |
230 | 230 | $this->default_message_mask = $config['masks']['attachment']; |
231 | - }else{ |
|
231 | + } else{ |
|
232 | 232 | throw new MaskNotFoundException("Unknown mask provided: ".$config['masks']['attachment']); |
233 | 233 | } |
234 | - }else{ |
|
234 | + } else{ |
|
235 | 235 | if(class_exists($default_config['attachment'])) { |
236 | 236 | $this->default_message_mask = $default_config['attachment']; |
237 | - }else{ |
|
237 | + } else{ |
|
238 | 238 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['attachment']); |
239 | 239 | } |
240 | 240 | } |
241 | - }else{ |
|
241 | + } else{ |
|
242 | 242 | if(class_exists($default_config['message'])) { |
243 | 243 | $this->default_message_mask = $default_config['message']; |
244 | - }else{ |
|
244 | + } else{ |
|
245 | 245 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['message']); |
246 | 246 | } |
247 | 247 | |
248 | 248 | if(class_exists($default_config['attachment'])) { |
249 | 249 | $this->default_message_mask = $default_config['attachment']; |
250 | - }else{ |
|
250 | + } else{ |
|
251 | 251 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['attachment']); |
252 | 252 | } |
253 | 253 | } |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | $timeout = $this->connection !== false ? $this->connection->getConnectionTimeout() : null; |
312 | 312 | $this->connection = new ImapProtocol($this->validate_cert); |
313 | 313 | $this->connection->setConnectionTimeout($timeout); |
314 | - }else{ |
|
314 | + } else{ |
|
315 | 315 | if (extension_loaded('imap') === false) { |
316 | 316 | throw new ConnectionFailedException("connection setup failed", 0, new ProtocolNotSupportedException($protocol." is an unsupported protocol")); |
317 | 317 | } |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | } |
440 | 440 | |
441 | 441 | return $folders; |
442 | - }else{ |
|
442 | + } else{ |
|
443 | 443 | throw new FolderFetchingException("failed to fetch any folders"); |
444 | 444 | } |
445 | 445 | } |
@@ -475,7 +475,9 @@ discard block |
||
475 | 475 | $this->checkConnection(); |
476 | 476 | $status = $this->connection->createFolder($folder); |
477 | 477 | |
478 | - if($expunge) $this->expunge(); |
|
478 | + if($expunge) { |
|
479 | + $this->expunge(); |
|
480 | + } |
|
479 | 481 | |
480 | 482 | $folder = $this->getFolder($folder); |
481 | 483 | if($status && $folder) { |