@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | public function __construct($uid, $msglist, Client $client, $fetch_options = null, $fetch_body = false, $fetch_flags = false, $sequence = null) { |
| 206 | 206 | |
| 207 | 207 | $default_mask = $client->getDefaultMessageMask(); |
| 208 | - if($default_mask != null) { |
|
| 208 | + if ($default_mask != null) { |
|
| 209 | 209 | $this->mask = $default_mask; |
| 210 | 210 | } |
| 211 | 211 | $this->events["message"] = $client->getDefaultEvents("message"); |
@@ -265,13 +265,13 @@ discard block |
||
| 265 | 265 | * @throws Exceptions\RuntimeException |
| 266 | 266 | * @throws Exceptions\MessageNotFoundException |
| 267 | 267 | */ |
| 268 | - public static function make($uid, $msglist, Client $client, $raw_header, $raw_body, $raw_flags, $fetch_options = null, $sequence = null){ |
|
| 268 | + public static function make($uid, $msglist, Client $client, $raw_header, $raw_body, $raw_flags, $fetch_options = null, $sequence = null) { |
|
| 269 | 269 | $reflection = new ReflectionClass(self::class); |
| 270 | 270 | /** @var self $instance */ |
| 271 | 271 | $instance = $reflection->newInstanceWithoutConstructor(); |
| 272 | 272 | |
| 273 | 273 | $default_mask = $client->getDefaultMessageMask(); |
| 274 | - if($default_mask != null) { |
|
| 274 | + if ($default_mask != null) { |
|
| 275 | 275 | $instance->setMask($default_mask); |
| 276 | 276 | } |
| 277 | 277 | $instance->setEvents([ |
@@ -306,13 +306,13 @@ discard block |
||
| 306 | 306 | * @throws MethodNotFoundException |
| 307 | 307 | */ |
| 308 | 308 | public function __call($method, $arguments) { |
| 309 | - if(strtolower(substr($method, 0, 3)) === 'get') { |
|
| 309 | + if (strtolower(substr($method, 0, 3)) === 'get') { |
|
| 310 | 310 | $name = Str::snake(substr($method, 3)); |
| 311 | 311 | return $this->get($name); |
| 312 | 312 | }elseif (strtolower(substr($method, 0, 3)) === 'set') { |
| 313 | 313 | $name = Str::snake(substr($method, 3)); |
| 314 | 314 | |
| 315 | - if(in_array($name, array_keys($this->attributes))) { |
|
| 315 | + if (in_array($name, array_keys($this->attributes))) { |
|
| 316 | 316 | return $this->__set($name, array_pop($arguments)); |
| 317 | 317 | } |
| 318 | 318 | |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | * @return mixed|null |
| 352 | 352 | */ |
| 353 | 353 | public function get($name) { |
| 354 | - if(isset($this->attributes[$name])) { |
|
| 354 | + if (isset($this->attributes[$name])) { |
|
| 355 | 355 | return $this->attributes[$name]; |
| 356 | 356 | } |
| 357 | 357 | |
@@ -425,7 +425,7 @@ discard block |
||
| 425 | 425 | * |
| 426 | 426 | * @throws InvalidMessageDateException |
| 427 | 427 | */ |
| 428 | - public function parseRawHeader($raw_header){ |
|
| 428 | + public function parseRawHeader($raw_header) { |
|
| 429 | 429 | $this->header = new Header($raw_header); |
| 430 | 430 | } |
| 431 | 431 | |
@@ -436,8 +436,8 @@ discard block |
||
| 436 | 436 | public function parseRawFlags($raw_flags) { |
| 437 | 437 | $this->flags = FlagCollection::make([]); |
| 438 | 438 | |
| 439 | - foreach($raw_flags as $flag) { |
|
| 440 | - if (strpos($flag, "\\") === 0){ |
|
| 439 | + foreach ($raw_flags as $flag) { |
|
| 440 | + if (strpos($flag, "\\") === 0) { |
|
| 441 | 441 | $flag = substr($flag, 1); |
| 442 | 442 | } |
| 443 | 443 | $flag_key = strtolower($flag); |
@@ -510,7 +510,7 @@ discard block |
||
| 510 | 510 | * @throws MessageFlagException |
| 511 | 511 | * @throws Exceptions\RuntimeException |
| 512 | 512 | */ |
| 513 | - public function peek(){ |
|
| 513 | + public function peek() { |
|
| 514 | 514 | if ($this->fetch_options == IMAP::FT_PEEK) { |
| 515 | 515 | if ($this->getFlags()->get("seen") == null) { |
| 516 | 516 | $this->unsetFlag("Seen"); |
@@ -559,7 +559,7 @@ discard block |
||
| 559 | 559 | private function fetchPart(Part $part) { |
| 560 | 560 | if ($part->isAttachment()) { |
| 561 | 561 | $this->fetchAttachment($part); |
| 562 | - }else{ |
|
| 562 | + }else { |
|
| 563 | 563 | $encoding = $this->getEncoding($part); |
| 564 | 564 | |
| 565 | 565 | $content = $this->decodeString($part->content, $part->encoding); |
@@ -584,7 +584,7 @@ discard block |
||
| 584 | 584 | |
| 585 | 585 | if (isset($this->bodies[$subtype])) { |
| 586 | 586 | $this->bodies[$subtype] .= "\n".$content; |
| 587 | - }else{ |
|
| 587 | + }else { |
|
| 588 | 588 | $this->bodies[$subtype] = $content; |
| 589 | 589 | } |
| 590 | 590 | } |
@@ -600,7 +600,7 @@ discard block |
||
| 600 | 600 | if ($oAttachment->getName() !== null && $oAttachment->getSize() > 0) { |
| 601 | 601 | if ($oAttachment->getId() !== null) { |
| 602 | 602 | $this->attachments->put($oAttachment->getId(), $oAttachment); |
| 603 | - } else { |
|
| 603 | + }else { |
|
| 604 | 604 | $this->attachments->push($oAttachment); |
| 605 | 605 | } |
| 606 | 606 | } |
@@ -734,7 +734,7 @@ discard block |
||
| 734 | 734 | |
| 735 | 735 | if (function_exists('iconv') && $from != 'UTF-7' && $to != 'UTF-7') { |
| 736 | 736 | return @iconv($from, $to.'//IGNORE', $str); |
| 737 | - } else { |
|
| 737 | + }else { |
|
| 738 | 738 | if (!$from) { |
| 739 | 739 | return mb_convert_encoding($str, $to); |
| 740 | 740 | } |
@@ -755,9 +755,9 @@ discard block |
||
| 755 | 755 | return EncodingAliases::get($parameter->value); |
| 756 | 756 | } |
| 757 | 757 | } |
| 758 | - }elseif (property_exists($structure, 'charset')){ |
|
| 758 | + }elseif (property_exists($structure, 'charset')) { |
|
| 759 | 759 | return EncodingAliases::get($structure->charset); |
| 760 | - }elseif (is_string($structure) === true){ |
|
| 760 | + }elseif (is_string($structure) === true) { |
|
| 761 | 761 | return mb_detect_encoding($structure); |
| 762 | 762 | } |
| 763 | 763 | |
@@ -772,7 +772,7 @@ discard block |
||
| 772 | 772 | * @throws Exceptions\FolderFetchingException |
| 773 | 773 | * @throws Exceptions\RuntimeException |
| 774 | 774 | */ |
| 775 | - public function getFolder(){ |
|
| 775 | + public function getFolder() { |
|
| 776 | 776 | return $this->client->getFolderByPath($this->folder_path); |
| 777 | 777 | } |
| 778 | 778 | |
@@ -788,13 +788,13 @@ discard block |
||
| 788 | 788 | * @throws Exceptions\GetMessagesFailedException |
| 789 | 789 | * @throws Exceptions\RuntimeException |
| 790 | 790 | */ |
| 791 | - public function thread($sent_folder = null, &$thread = null, $folder = null){ |
|
| 791 | + public function thread($sent_folder = null, &$thread = null, $folder = null) { |
|
| 792 | 792 | $thread = $thread ? $thread : MessageCollection::make([]); |
| 793 | - $folder = $folder ? $folder : $this->getFolder(); |
|
| 793 | + $folder = $folder ? $folder : $this->getFolder(); |
|
| 794 | 794 | $sent_folder = $sent_folder ? $sent_folder : $this->client->getFolderByPath(ClientManager::get("options.common_folders.sent", "INBOX/Sent")); |
| 795 | 795 | |
| 796 | 796 | /** @var Message $message */ |
| 797 | - foreach($thread as $message) { |
|
| 797 | + foreach ($thread as $message) { |
|
| 798 | 798 | if ($message->message_id == $this->message_id) { |
| 799 | 799 | return $thread; |
| 800 | 800 | } |
@@ -805,7 +805,7 @@ discard block |
||
| 805 | 805 | $this->fetchThreadByInReplyTo($thread, $this->message_id, $sent_folder, $folder, $sent_folder); |
| 806 | 806 | |
| 807 | 807 | if (is_array($this->in_reply_to)) { |
| 808 | - foreach($this->in_reply_to as $in_reply_to) { |
|
| 808 | + foreach ($this->in_reply_to as $in_reply_to) { |
|
| 809 | 809 | $this->fetchThreadByMessageId($thread, $in_reply_to, $folder, $folder, $sent_folder); |
| 810 | 810 | $this->fetchThreadByMessageId($thread, $in_reply_to, $sent_folder, $folder, $sent_folder); |
| 811 | 811 | } |
@@ -826,7 +826,7 @@ discard block |
||
| 826 | 826 | * @throws Exceptions\GetMessagesFailedException |
| 827 | 827 | * @throws Exceptions\RuntimeException |
| 828 | 828 | */ |
| 829 | - protected function fetchThreadByInReplyTo(&$thread, $in_reply_to, $primary_folder, $secondary_folder, $sent_folder){ |
|
| 829 | + protected function fetchThreadByInReplyTo(&$thread, $in_reply_to, $primary_folder, $secondary_folder, $sent_folder) { |
|
| 830 | 830 | $primary_folder->query()->inReplyTo($in_reply_to) |
| 831 | 831 | ->setFetchBody($this->getFetchBodyOption()) |
| 832 | 832 | ->leaveUnread()->get()->each(function($message) use(&$thread, $secondary_folder, $sent_folder){ |
@@ -847,7 +847,7 @@ discard block |
||
| 847 | 847 | * @throws Exceptions\GetMessagesFailedException |
| 848 | 848 | * @throws Exceptions\RuntimeException |
| 849 | 849 | */ |
| 850 | - protected function fetchThreadByMessageId(&$thread, $message_id, $primary_folder, $secondary_folder, $sent_folder){ |
|
| 850 | + protected function fetchThreadByMessageId(&$thread, $message_id, $primary_folder, $secondary_folder, $sent_folder) { |
|
| 851 | 851 | $primary_folder->query()->messageId($message_id) |
| 852 | 852 | ->setFetchBody($this->getFetchBodyOption()) |
| 853 | 853 | ->leaveUnread()->get()->each(function($message) use(&$thread, $secondary_folder, $sent_folder){ |
@@ -943,14 +943,14 @@ discard block |
||
| 943 | 943 | * @throws MessageFlagException |
| 944 | 944 | * @throws MessageHeaderFetchingException |
| 945 | 945 | */ |
| 946 | - protected function fetchNewMail($folder, $next_uid, $event, $expunge){ |
|
| 947 | - if($expunge) $this->client->expunge(); |
|
| 946 | + protected function fetchNewMail($folder, $next_uid, $event, $expunge) { |
|
| 947 | + if ($expunge) $this->client->expunge(); |
|
| 948 | 948 | |
| 949 | 949 | $this->client->openFolder($folder->path); |
| 950 | 950 | |
| 951 | 951 | if ($this->sequence === IMAP::ST_UID) { |
| 952 | 952 | $sequence_id = $next_uid; |
| 953 | - }else{ |
|
| 953 | + }else { |
|
| 954 | 954 | $sequence_id = $this->client->getConnection()->getMessageNumber($next_uid); |
| 955 | 955 | } |
| 956 | 956 | |
@@ -973,7 +973,7 @@ discard block |
||
| 973 | 973 | */ |
| 974 | 974 | public function delete($expunge = true) { |
| 975 | 975 | $status = $this->setFlag("Deleted"); |
| 976 | - if($expunge) $this->client->expunge(); |
|
| 976 | + if ($expunge) $this->client->expunge(); |
|
| 977 | 977 | |
| 978 | 978 | $event = $this->getEvent("message", "deleted"); |
| 979 | 979 | $event::dispatch($this); |
@@ -993,7 +993,7 @@ discard block |
||
| 993 | 993 | */ |
| 994 | 994 | public function restore($expunge = true) { |
| 995 | 995 | $status = $this->unsetFlag("Deleted"); |
| 996 | - if($expunge) $this->client->expunge(); |
|
| 996 | + if ($expunge) $this->client->expunge(); |
|
| 997 | 997 | |
| 998 | 998 | $event = $this->getEvent("message", "restored"); |
| 999 | 999 | $event::dispatch($this); |
@@ -1098,7 +1098,7 @@ discard block |
||
| 1098 | 1098 | * |
| 1099 | 1099 | * @return AttachmentCollection |
| 1100 | 1100 | */ |
| 1101 | - public function attachments(){ |
|
| 1101 | + public function attachments() { |
|
| 1102 | 1102 | return $this->getAttachments(); |
| 1103 | 1103 | } |
| 1104 | 1104 | |
@@ -1196,7 +1196,7 @@ discard block |
||
| 1196 | 1196 | * |
| 1197 | 1197 | * @return FlagCollection |
| 1198 | 1198 | */ |
| 1199 | - public function flags(){ |
|
| 1199 | + public function flags() { |
|
| 1200 | 1200 | return $this->getFlags(); |
| 1201 | 1201 | } |
| 1202 | 1202 | |
@@ -1205,7 +1205,7 @@ discard block |
||
| 1205 | 1205 | * |
| 1206 | 1206 | * @return Structure|null |
| 1207 | 1207 | */ |
| 1208 | - public function getStructure(){ |
|
| 1208 | + public function getStructure() { |
|
| 1209 | 1209 | return $this->structure; |
| 1210 | 1210 | } |
| 1211 | 1211 | |
@@ -1231,7 +1231,7 @@ discard block |
||
| 1231 | 1231 | * |
| 1232 | 1232 | * @return array |
| 1233 | 1233 | */ |
| 1234 | - public function getAttributes(){ |
|
| 1234 | + public function getAttributes() { |
|
| 1235 | 1235 | return array_merge($this->attributes, $this->header->getAttributes()); |
| 1236 | 1236 | } |
| 1237 | 1237 | |
@@ -1241,8 +1241,8 @@ discard block |
||
| 1241 | 1241 | * |
| 1242 | 1242 | * @return $this |
| 1243 | 1243 | */ |
| 1244 | - public function setMask($mask){ |
|
| 1245 | - if(class_exists($mask)){ |
|
| 1244 | + public function setMask($mask) { |
|
| 1245 | + if (class_exists($mask)) { |
|
| 1246 | 1246 | $this->mask = $mask; |
| 1247 | 1247 | } |
| 1248 | 1248 | |
@@ -1254,7 +1254,7 @@ discard block |
||
| 1254 | 1254 | * |
| 1255 | 1255 | * @return string |
| 1256 | 1256 | */ |
| 1257 | - public function getMask(){ |
|
| 1257 | + public function getMask() { |
|
| 1258 | 1258 | return $this->mask; |
| 1259 | 1259 | } |
| 1260 | 1260 | |
@@ -1265,9 +1265,9 @@ discard block |
||
| 1265 | 1265 | * @return mixed |
| 1266 | 1266 | * @throws MaskNotFoundException |
| 1267 | 1267 | */ |
| 1268 | - public function mask($mask = null){ |
|
| 1268 | + public function mask($mask = null) { |
|
| 1269 | 1269 | $mask = $mask !== null ? $mask : $this->mask; |
| 1270 | - if(class_exists($mask)){ |
|
| 1270 | + if (class_exists($mask)) { |
|
| 1271 | 1271 | return new $mask($this); |
| 1272 | 1272 | } |
| 1273 | 1273 | |
@@ -1280,7 +1280,7 @@ discard block |
||
| 1280 | 1280 | * |
| 1281 | 1281 | * @return $this |
| 1282 | 1282 | */ |
| 1283 | - public function setFolderPath($folder_path){ |
|
| 1283 | + public function setFolderPath($folder_path) { |
|
| 1284 | 1284 | $this->folder_path = $folder_path; |
| 1285 | 1285 | |
| 1286 | 1286 | return $this; |
@@ -1292,7 +1292,7 @@ discard block |
||
| 1292 | 1292 | * |
| 1293 | 1293 | * @return $this |
| 1294 | 1294 | */ |
| 1295 | - public function setConfig($config){ |
|
| 1295 | + public function setConfig($config) { |
|
| 1296 | 1296 | $this->config = $config; |
| 1297 | 1297 | |
| 1298 | 1298 | return $this; |
@@ -1304,7 +1304,7 @@ discard block |
||
| 1304 | 1304 | * |
| 1305 | 1305 | * @return $this |
| 1306 | 1306 | */ |
| 1307 | - public function setAvailableFlags($available_flags){ |
|
| 1307 | + public function setAvailableFlags($available_flags) { |
|
| 1308 | 1308 | $this->available_flags = $available_flags; |
| 1309 | 1309 | |
| 1310 | 1310 | return $this; |
@@ -1316,7 +1316,7 @@ discard block |
||
| 1316 | 1316 | * |
| 1317 | 1317 | * @return $this |
| 1318 | 1318 | */ |
| 1319 | - public function setAttachments($attachments){ |
|
| 1319 | + public function setAttachments($attachments) { |
|
| 1320 | 1320 | $this->attachments = $attachments; |
| 1321 | 1321 | |
| 1322 | 1322 | return $this; |
@@ -1328,7 +1328,7 @@ discard block |
||
| 1328 | 1328 | * |
| 1329 | 1329 | * @return $this |
| 1330 | 1330 | */ |
| 1331 | - public function setFlags($flags){ |
|
| 1331 | + public function setFlags($flags) { |
|
| 1332 | 1332 | $this->flags = $flags; |
| 1333 | 1333 | |
| 1334 | 1334 | return $this; |
@@ -1342,7 +1342,7 @@ discard block |
||
| 1342 | 1342 | * @throws Exceptions\RuntimeException |
| 1343 | 1343 | * @throws Exceptions\ConnectionFailedException |
| 1344 | 1344 | */ |
| 1345 | - public function setClient($client){ |
|
| 1345 | + public function setClient($client) { |
|
| 1346 | 1346 | $this->client = $client; |
| 1347 | 1347 | $this->client->openFolder($this->folder_path); |
| 1348 | 1348 | |
@@ -1357,7 +1357,7 @@ discard block |
||
| 1357 | 1357 | * @throws Exceptions\MessageNotFoundException |
| 1358 | 1358 | * @throws Exceptions\ConnectionFailedException |
| 1359 | 1359 | */ |
| 1360 | - public function setUid($uid){ |
|
| 1360 | + public function setUid($uid) { |
|
| 1361 | 1361 | $this->uid = $uid; |
| 1362 | 1362 | $this->msgn = $this->client->getConnection()->getMessageNumber($this->uid); |
| 1363 | 1363 | $this->msglist = null; |
@@ -1374,7 +1374,7 @@ discard block |
||
| 1374 | 1374 | * @throws Exceptions\MessageNotFoundException |
| 1375 | 1375 | * @throws Exceptions\ConnectionFailedException |
| 1376 | 1376 | */ |
| 1377 | - public function setMsgn($msgn, $msglist = null){ |
|
| 1377 | + public function setMsgn($msgn, $msglist = null) { |
|
| 1378 | 1378 | $this->msgn = $msgn; |
| 1379 | 1379 | $this->msglist = $msglist; |
| 1380 | 1380 | $this->uid = $this->client->getConnection()->getUid($this->msgn); |
@@ -1387,7 +1387,7 @@ discard block |
||
| 1387 | 1387 | * |
| 1388 | 1388 | * @return int |
| 1389 | 1389 | */ |
| 1390 | - public function getSequence(){ |
|
| 1390 | + public function getSequence() { |
|
| 1391 | 1391 | return $this->sequence; |
| 1392 | 1392 | } |
| 1393 | 1393 | |
@@ -1396,7 +1396,7 @@ discard block |
||
| 1396 | 1396 | * |
| 1397 | 1397 | * @return int |
| 1398 | 1398 | */ |
| 1399 | - public function getSequenceId(){ |
|
| 1399 | + public function getSequenceId() { |
|
| 1400 | 1400 | return $this->sequence === IMAP::ST_UID ? $this->uid : $this->msgn; |
| 1401 | 1401 | } |
| 1402 | 1402 | |
@@ -1408,11 +1408,11 @@ discard block |
||
| 1408 | 1408 | * @throws Exceptions\ConnectionFailedException |
| 1409 | 1409 | * @throws Exceptions\MessageNotFoundException |
| 1410 | 1410 | */ |
| 1411 | - public function setSequenceId($uid, $msglist = null){ |
|
| 1411 | + public function setSequenceId($uid, $msglist = null) { |
|
| 1412 | 1412 | if ($this->getSequence() === IMAP::ST_UID) { |
| 1413 | 1413 | $this->setUid($uid); |
| 1414 | 1414 | $this->setMsglist($msglist); |
| 1415 | - }else{ |
|
| 1415 | + }else { |
|
| 1416 | 1416 | $this->setMsgn($uid, $msglist); |
| 1417 | 1417 | } |
| 1418 | 1418 | } |
@@ -203,11 +203,11 @@ discard block |
||
| 203 | 203 | * @param array $config |
| 204 | 204 | * @param array $default_config |
| 205 | 205 | */ |
| 206 | - private function setAccountConfig($key, $config, $default_config){ |
|
| 206 | + private function setAccountConfig($key, $config, $default_config) { |
|
| 207 | 207 | $value = $this->default_account_config[$key]; |
| 208 | - if(isset($config[$key])) { |
|
| 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; |
@@ -219,9 +219,9 @@ discard block |
||
| 219 | 219 | */ |
| 220 | 220 | protected function setEventsFromConfig($config) { |
| 221 | 221 | $this->events = ClientManager::get("events"); |
| 222 | - if(isset($config['events'])){ |
|
| 223 | - if(isset($config['events'])) { |
|
| 224 | - foreach($config['events'] as $section => $events) { |
|
| 222 | + if (isset($config['events'])) { |
|
| 223 | + if (isset($config['events'])) { |
|
| 224 | + foreach ($config['events'] as $section => $events) { |
|
| 225 | 225 | $this->events[$section] = array_merge($this->events[$section], $events); |
| 226 | 226 | } |
| 227 | 227 | } |
@@ -235,45 +235,45 @@ discard block |
||
| 235 | 235 | * @throws MaskNotFoundException |
| 236 | 236 | */ |
| 237 | 237 | protected function setMaskFromConfig($config) { |
| 238 | - $default_config = ClientManager::get("masks"); |
|
| 238 | + $default_config = ClientManager::get("masks"); |
|
| 239 | 239 | |
| 240 | - if(isset($config['masks'])){ |
|
| 241 | - if(isset($config['masks']['message'])) { |
|
| 242 | - if(class_exists($config['masks']['message'])) { |
|
| 240 | + if (isset($config['masks'])) { |
|
| 241 | + if (isset($config['masks']['message'])) { |
|
| 242 | + if (class_exists($config['masks']['message'])) { |
|
| 243 | 243 | $this->default_message_mask = $config['masks']['message']; |
| 244 | - }else{ |
|
| 244 | + }else { |
|
| 245 | 245 | throw new MaskNotFoundException("Unknown mask provided: ".$config['masks']['message']); |
| 246 | 246 | } |
| 247 | - }else{ |
|
| 248 | - if(class_exists($default_config['message'])) { |
|
| 247 | + }else { |
|
| 248 | + if (class_exists($default_config['message'])) { |
|
| 249 | 249 | $this->default_message_mask = $default_config['message']; |
| 250 | - }else{ |
|
| 250 | + }else { |
|
| 251 | 251 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['message']); |
| 252 | 252 | } |
| 253 | 253 | } |
| 254 | - if(isset($config['masks']['attachment'])) { |
|
| 255 | - if(class_exists($config['masks']['attachment'])) { |
|
| 254 | + if (isset($config['masks']['attachment'])) { |
|
| 255 | + if (class_exists($config['masks']['attachment'])) { |
|
| 256 | 256 | $this->default_message_mask = $config['masks']['attachment']; |
| 257 | - }else{ |
|
| 257 | + }else { |
|
| 258 | 258 | throw new MaskNotFoundException("Unknown mask provided: ".$config['masks']['attachment']); |
| 259 | 259 | } |
| 260 | - }else{ |
|
| 261 | - if(class_exists($default_config['attachment'])) { |
|
| 260 | + }else { |
|
| 261 | + if (class_exists($default_config['attachment'])) { |
|
| 262 | 262 | $this->default_message_mask = $default_config['attachment']; |
| 263 | - }else{ |
|
| 263 | + }else { |
|
| 264 | 264 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['attachment']); |
| 265 | 265 | } |
| 266 | 266 | } |
| 267 | - }else{ |
|
| 268 | - if(class_exists($default_config['message'])) { |
|
| 267 | + }else { |
|
| 268 | + if (class_exists($default_config['message'])) { |
|
| 269 | 269 | $this->default_message_mask = $default_config['message']; |
| 270 | - }else{ |
|
| 270 | + }else { |
|
| 271 | 271 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['message']); |
| 272 | 272 | } |
| 273 | 273 | |
| 274 | - if(class_exists($default_config['attachment'])) { |
|
| 274 | + if (class_exists($default_config['attachment'])) { |
|
| 275 | 275 | $this->default_message_mask = $default_config['attachment']; |
| 276 | - }else{ |
|
| 276 | + }else { |
|
| 277 | 277 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['attachment']); |
| 278 | 278 | } |
| 279 | 279 | } |
@@ -337,7 +337,7 @@ discard block |
||
| 337 | 337 | $this->connection = new ImapProtocol($this->validate_cert, $this->encryption); |
| 338 | 338 | $this->connection->setConnectionTimeout($this->timeout); |
| 339 | 339 | $this->connection->setProxy($this->proxy); |
| 340 | - }else{ |
|
| 340 | + }else { |
|
| 341 | 341 | if (extension_loaded('imap') === false) { |
| 342 | 342 | throw new ConnectionFailedException("connection setup failed", 0, new ProtocolNotSupportedException($protocol." is an unsupported protocol")); |
| 343 | 343 | } |
@@ -462,7 +462,7 @@ discard block |
||
| 462 | 462 | $pattern = $parent_folder.($hierarchical ? '%' : '*'); |
| 463 | 463 | $items = $this->connection->folders('', $pattern); |
| 464 | 464 | |
| 465 | - if(is_array($items)){ |
|
| 465 | + if (is_array($items)) { |
|
| 466 | 466 | foreach ($items as $folder_name => $item) { |
| 467 | 467 | $folder = new Folder($this, $folder_name, $item["delimiter"], $item["flags"]); |
| 468 | 468 | |
@@ -477,7 +477,7 @@ discard block |
||
| 477 | 477 | } |
| 478 | 478 | |
| 479 | 479 | return $folders; |
| 480 | - }else{ |
|
| 480 | + }else { |
|
| 481 | 481 | throw new FolderFetchingException("failed to fetch any folders"); |
| 482 | 482 | } |
| 483 | 483 | } |
@@ -515,10 +515,10 @@ discard block |
||
| 515 | 515 | $this->checkConnection(); |
| 516 | 516 | $status = $this->connection->createFolder($folder); |
| 517 | 517 | |
| 518 | - if($expunge) $this->expunge(); |
|
| 518 | + if ($expunge) $this->expunge(); |
|
| 519 | 519 | |
| 520 | 520 | $folder = $this->getFolder($folder); |
| 521 | - if($status && $folder) { |
|
| 521 | + if ($status && $folder) { |
|
| 522 | 522 | $event = $this->getEvent("folder", "new"); |
| 523 | 523 | $event::dispatch($folder); |
| 524 | 524 | } |
@@ -544,7 +544,7 @@ discard block |
||
| 544 | 544 | * |
| 545 | 545 | * @return string |
| 546 | 546 | */ |
| 547 | - public function getFolderPath(){ |
|
| 547 | + public function getFolderPath() { |
|
| 548 | 548 | return $this->active_folder; |
| 549 | 549 | } |
| 550 | 550 | |
@@ -599,7 +599,7 @@ discard block |
||
| 599 | 599 | * |
| 600 | 600 | * @return int |
| 601 | 601 | */ |
| 602 | - public function getTimeout(){ |
|
| 602 | + public function getTimeout() { |
|
| 603 | 603 | return $this->connection->getConnectionTimeout(); |
| 604 | 604 | } |
| 605 | 605 | |
@@ -608,7 +608,7 @@ discard block |
||
| 608 | 608 | * |
| 609 | 609 | * @return string |
| 610 | 610 | */ |
| 611 | - public function getDefaultMessageMask(){ |
|
| 611 | + public function getDefaultMessageMask() { |
|
| 612 | 612 | return $this->default_message_mask; |
| 613 | 613 | } |
| 614 | 614 | |
@@ -618,7 +618,7 @@ discard block |
||
| 618 | 618 | * |
| 619 | 619 | * @return array |
| 620 | 620 | */ |
| 621 | - public function getDefaultEvents($section){ |
|
| 621 | + public function getDefaultEvents($section) { |
|
| 622 | 622 | return $this->events[$section]; |
| 623 | 623 | } |
| 624 | 624 | |
@@ -630,7 +630,7 @@ discard block |
||
| 630 | 630 | * @throws MaskNotFoundException |
| 631 | 631 | */ |
| 632 | 632 | public function setDefaultMessageMask($mask) { |
| 633 | - if(class_exists($mask)) { |
|
| 633 | + if (class_exists($mask)) { |
|
| 634 | 634 | $this->default_message_mask = $mask; |
| 635 | 635 | |
| 636 | 636 | return $this; |
@@ -644,7 +644,7 @@ discard block |
||
| 644 | 644 | * |
| 645 | 645 | * @return string |
| 646 | 646 | */ |
| 647 | - public function getDefaultAttachmentMask(){ |
|
| 647 | + public function getDefaultAttachmentMask() { |
|
| 648 | 648 | return $this->default_attachment_mask; |
| 649 | 649 | } |
| 650 | 650 | |
@@ -656,7 +656,7 @@ discard block |
||
| 656 | 656 | * @throws MaskNotFoundException |
| 657 | 657 | */ |
| 658 | 658 | public function setDefaultAttachmentMask($mask) { |
| 659 | - if(class_exists($mask)) { |
|
| 659 | + if (class_exists($mask)) { |
|
| 660 | 660 | $this->default_attachment_mask = $mask; |
| 661 | 661 | |
| 662 | 662 | return $this; |