@@ -207,7 +207,7 @@ discard block  | 
                                                    ||
| 207 | 207 |      public function __construct($uid, $msglist, Client $client, $fetch_options = null, $fetch_body = null, $fetch_attachment = null, $fetch_flags = null) { | 
                                                        
| 208 | 208 | |
| 209 | 209 | $default_mask = $client->getDefaultMessageMask();  | 
                                                        
| 210 | -        if($default_mask != null) { | 
                                                        |
| 210 | +        if ($default_mask != null) { | 
                                                        |
| 211 | 211 | $this->mask = $default_mask;  | 
                                                        
| 212 | 212 | }  | 
                                                        
| 213 | 213 | |
@@ -226,7 +226,7 @@ discard block  | 
                                                    ||
| 226 | 226 | $this->msglist = $msglist;  | 
                                                        
| 227 | 227 | $this->client = $client;  | 
                                                        
| 228 | 228 | |
| 229 | - $this->uid = $uid;  | 
                                                        |
| 229 | + $this->uid = $uid;  | 
                                                        |
| 230 | 230 | $this->msgn = ($this->fetch_options == IMAP::FT_UID) ? \imap_msgno($this->client->getConnection(), $uid) : $uid;  | 
                                                        
| 231 | 231 | |
| 232 | 232 | $this->parseHeader();  | 
                                                        
@@ -249,17 +249,17 @@ discard block  | 
                                                    ||
| 249 | 249 | * @throws MethodNotFoundException  | 
                                                        
| 250 | 250 | */  | 
                                                        
| 251 | 251 |      public function __call($method, $arguments) { | 
                                                        
| 252 | -        if(strtolower(substr($method, 0, 3)) === 'get') { | 
                                                        |
| 252 | +        if (strtolower(substr($method, 0, 3)) === 'get') { | 
                                                        |
| 253 | 253 | $name = Str::snake(substr($method, 3));  | 
                                                        
| 254 | 254 | |
| 255 | -            if(in_array($name, array_keys($this->attributes))) { | 
                                                        |
| 255 | +            if (in_array($name, array_keys($this->attributes))) { | 
                                                        |
| 256 | 256 | return $this->attributes[$name];  | 
                                                        
| 257 | 257 | }  | 
                                                        
| 258 | 258 | |
| 259 | 259 |          }elseif (strtolower(substr($method, 0, 3)) === 'set') { | 
                                                        
| 260 | 260 | $name = Str::snake(substr($method, 3));  | 
                                                        
| 261 | 261 | |
| 262 | -            if(in_array($name, array_keys($this->attributes))) { | 
                                                        |
| 262 | +            if (in_array($name, array_keys($this->attributes))) { | 
                                                        |
| 263 | 263 | $this->attributes[$name] = array_pop($arguments);  | 
                                                        
| 264 | 264 | |
| 265 | 265 | return $this->attributes[$name];  | 
                                                        
@@ -288,7 +288,7 @@ discard block  | 
                                                    ||
| 288 | 288 | * @return mixed|null  | 
                                                        
| 289 | 289 | */  | 
                                                        
| 290 | 290 |      public function __get($name) { | 
                                                        
| 291 | -        if(isset($this->attributes[$name])) { | 
                                                        |
| 291 | +        if (isset($this->attributes[$name])) { | 
                                                        |
| 292 | 292 | return $this->attributes[$name];  | 
                                                        
| 293 | 293 | }  | 
                                                        
| 294 | 294 | |
@@ -384,16 +384,16 @@ discard block  | 
                                                    ||
| 384 | 384 | }  | 
                                                        
| 385 | 385 | |
| 386 | 386 |          if (property_exists($header, 'subject')) { | 
                                                        
| 387 | -            if($this->config['decoder']['message']['subject'] === 'utf-8') { | 
                                                        |
| 387 | +            if ($this->config['decoder']['message']['subject'] === 'utf-8') { | 
                                                        |
| 388 | 388 | $this->subject = \imap_utf8($header->subject);  | 
                                                        
| 389 | -            }elseif($this->config['decoder']['message']['subject'] === 'iconv') { | 
                                                        |
| 389 | +            }elseif ($this->config['decoder']['message']['subject'] === 'iconv') { | 
                                                        |
| 390 | 390 | $this->subject = iconv_mime_decode($header->subject);  | 
                                                        
| 391 | -            }else{ | 
                                                        |
| 391 | +            } else { | 
                                                        |
| 392 | 392 | $this->subject = mb_decode_mimeheader($header->subject);  | 
                                                        
| 393 | 393 | }  | 
                                                        
| 394 | 394 | }  | 
                                                        
| 395 | 395 | |
| 396 | -        foreach(['from', 'to', 'cc', 'bcc', 'reply_to', 'sender'] as $part){ | 
                                                        |
| 396 | +        foreach (['from', 'to', 'cc', 'bcc', 'reply_to', 'sender'] as $part) { | 
                                                        |
| 397 | 397 | $this->extractHeaderAddressPart($header, $part);  | 
                                                        
| 398 | 398 | }  | 
                                                        
| 399 | 399 | |
@@ -423,9 +423,9 @@ discard block  | 
                                                    ||
| 423 | 423 | * @return int|null  | 
                                                        
| 424 | 424 | */  | 
                                                        
| 425 | 425 |      private function extractPriority($header) { | 
                                                        
| 426 | -        if(preg_match('/x\-priority\:.*([0-9]{1,2})/i', $header, $priority)){ | 
                                                        |
| 426 | +        if (preg_match('/x\-priority\:.*([0-9]{1,2})/i', $header, $priority)) { | 
                                                        |
| 427 | 427 | $priority = isset($priority[1]) ? (int) $priority[1] : 0;  | 
                                                        
| 428 | -            switch($priority){ | 
                                                        |
| 428 | +            switch ($priority) { | 
                                                        |
| 429 | 429 | case IMAP::MESSAGE_PRIORITY_HIGHEST;  | 
                                                        
| 430 | 430 | $priority = IMAP::MESSAGE_PRIORITY_HIGHEST;  | 
                                                        
| 431 | 431 | break;  | 
                                                        
@@ -476,7 +476,7 @@ discard block  | 
                                                    ||
| 476 | 476 |          if (property_exists($header, 'date')) { | 
                                                        
| 477 | 477 | $date = $header->date;  | 
                                                        
| 478 | 478 | |
| 479 | -            if(preg_match('/\+0580/', $date)) { | 
                                                        |
| 479 | +            if (preg_match('/\+0580/', $date)) { | 
                                                        |
| 480 | 480 |                  $date = str_replace('+0580', '+0530', $date); | 
                                                        
| 481 | 481 | }  | 
                                                        
| 482 | 482 | |
@@ -499,7 +499,7 @@ discard block  | 
                                                    ||
| 499 | 499 | $date = trim(array_pop($array));  | 
                                                        
| 500 | 500 | break;  | 
                                                        
| 501 | 501 | }  | 
                                                        
| 502 | -                try{ | 
                                                        |
| 502 | +                try { | 
                                                        |
| 503 | 503 | $parsed_date = Carbon::parse($date);  | 
                                                        
| 504 | 504 |                  } catch (\Exception $_e) { | 
                                                        
| 505 | 505 |                      throw new InvalidMessageDateException("Invalid message date. ID:".$this->getMessageId(), 1000, $e); | 
                                                        
@@ -522,7 +522,7 @@ discard block  | 
                                                    ||
| 522 | 522 | $this->client->openFolder($this->folder_path);  | 
                                                        
| 523 | 523 | $flags = \imap_fetch_overview($this->client->getConnection(), $this->uid, IMAP::FT_UID);  | 
                                                        
| 524 | 524 |          if (is_array($flags) && isset($flags[0])) { | 
                                                        
| 525 | -            foreach($this->available_flags as $flag) { | 
                                                        |
| 525 | +            foreach ($this->available_flags as $flag) { | 
                                                        |
| 526 | 526 | $this->parseFlag($flags, $flag);  | 
                                                        
| 527 | 527 | }  | 
                                                        
| 528 | 528 | }  | 
                                                        
@@ -594,7 +594,7 @@ discard block  | 
                                                    ||
| 594 | 594 |              } else { | 
                                                        
| 595 | 595 | $personalParts = \imap_mime_header_decode($address->personal);  | 
                                                        
| 596 | 596 | |
| 597 | -                if(is_array($personalParts)) { | 
                                                        |
| 597 | +                if (is_array($personalParts)) { | 
                                                        |
| 598 | 598 | $address->personal = '';  | 
                                                        
| 599 | 599 |                      foreach ($personalParts as $p) { | 
                                                        
| 600 | 600 | $address->personal .= $this->convertEncoding($p->text, $this->getEncoding($p));  | 
                                                        
@@ -672,7 +672,7 @@ discard block  | 
                                                    ||
| 672 | 672 | * @return object  | 
                                                        
| 673 | 673 | * @throws Exceptions\ConnectionFailedException  | 
                                                        
| 674 | 674 | */  | 
                                                        
| 675 | -    private function createBody($type, $structure, $partNumber){ | 
                                                        |
| 675 | +    private function createBody($type, $structure, $partNumber) { | 
                                                        |
| 676 | 676 | return (object) [  | 
                                                        
| 677 | 677 | "type" => $type,  | 
                                                        
| 678 | 678 | "content" => $this->fetchPart($structure, $partNumber),  | 
                                                        
@@ -687,7 +687,7 @@ discard block  | 
                                                    ||
| 687 | 687 | * @return mixed|string  | 
                                                        
| 688 | 688 | * @throws Exceptions\ConnectionFailedException  | 
                                                        
| 689 | 689 | */  | 
                                                        
| 690 | -    private function fetchPart($structure, $partNumber){ | 
                                                        |
| 690 | +    private function fetchPart($structure, $partNumber) { | 
                                                        |
| 691 | 691 | $encoding = $this->getEncoding($structure);  | 
                                                        
| 692 | 692 | |
| 693 | 693 | $content = \imap_fetchbody($this->client->getConnection(), $this->uid, $partNumber | 1, $this->fetch_options | IMAP::FT_UID);  | 
                                                        
@@ -888,7 +888,7 @@ discard block  | 
                                                    ||
| 888 | 888 | }  | 
                                                        
| 889 | 889 |          }elseif (property_exists($structure, 'charset')) { | 
                                                        
| 890 | 890 | return EncodingAliases::get($structure->charset, $this->fallback_encoding);  | 
                                                        
| 891 | -        }elseif (is_string($structure) === true){ | 
                                                        |
| 891 | +        }elseif (is_string($structure) === true) { | 
                                                        |
| 892 | 892 | return mb_detect_encoding($structure);  | 
                                                        
| 893 | 893 | }  | 
                                                        
| 894 | 894 | |
@@ -938,7 +938,7 @@ discard block  | 
                                                    ||
| 938 | 938 | return null;  | 
                                                        
| 939 | 939 | }  | 
                                                        
| 940 | 940 | |
| 941 | -    public function getFolder(){ | 
                                                        |
| 941 | +    public function getFolder() { | 
                                                        |
| 942 | 942 | return $this->client->getFolder($this->folder_path);  | 
                                                        
| 943 | 943 | }  | 
                                                        
| 944 | 944 | |
@@ -954,7 +954,7 @@ discard block  | 
                                                    ||
| 954 | 954 | */  | 
                                                        
| 955 | 955 |      public function moveToFolder($mailbox = 'INBOX', $expunge = false, $create_folder = true) { | 
                                                        
| 956 | 956 | |
| 957 | - if($create_folder) $this->client->createFolder($mailbox, true);  | 
                                                        |
| 957 | + if ($create_folder) $this->client->createFolder($mailbox, true);  | 
                                                        |
| 958 | 958 | |
| 959 | 959 | $target_folder = $this->client->getFolder($mailbox);  | 
                                                        
| 960 | 960 | $target_status = $target_folder->getStatus(IMAP::SA_ALL);  | 
                                                        
@@ -962,8 +962,8 @@ discard block  | 
                                                    ||
| 962 | 962 | $this->client->openFolder($this->folder_path);  | 
                                                        
| 963 | 963 | $status = \imap_mail_move($this->client->getConnection(), $this->uid, $mailbox, IMAP::CP_UID);  | 
                                                        
| 964 | 964 | |
| 965 | -        if($status === true){ | 
                                                        |
| 966 | - if($expunge) $this->client->expunge();  | 
                                                        |
| 965 | +        if ($status === true) { | 
                                                        |
| 966 | + if ($expunge) $this->client->expunge();  | 
                                                        |
| 967 | 967 | $this->client->openFolder($target_folder->path);  | 
                                                        
| 968 | 968 | |
| 969 | 969 | $message = $target_folder->getMessage($target_status->uidnext, null, $this->fetch_options, $this->fetch_body, $this->fetch_attachment, $this->fetch_flags);  | 
                                                        
@@ -985,7 +985,7 @@ discard block  | 
                                                    ||
| 985 | 985 | $this->client->openFolder($this->folder_path);  | 
                                                        
| 986 | 986 | |
| 987 | 987 | $status = \imap_delete($this->client->getConnection(), $this->uid, IMAP::FT_UID);  | 
                                                        
| 988 | - if($expunge) $this->client->expunge();  | 
                                                        |
| 988 | + if ($expunge) $this->client->expunge();  | 
                                                        |
| 989 | 989 | MessageDeletedEvent::dispatch($this);  | 
                                                        
| 990 | 990 | |
| 991 | 991 | return $status;  | 
                                                        
@@ -1002,7 +1002,7 @@ discard block  | 
                                                    ||
| 1002 | 1002 | $this->client->openFolder($this->folder_path);  | 
                                                        
| 1003 | 1003 | |
| 1004 | 1004 | $status = \imap_undelete($this->client->getConnection(), $this->uid, IMAP::FT_UID);  | 
                                                        
| 1005 | - if($expunge) $this->client->expunge();  | 
                                                        |
| 1005 | + if ($expunge) $this->client->expunge();  | 
                                                        |
| 1006 | 1006 | MessageRestoredEvent::dispatch($this);  | 
                                                        
| 1007 | 1007 | |
| 1008 | 1008 | return $status;  | 
                                                        
@@ -1079,7 +1079,7 @@ discard block  | 
                                                    ||
| 1079 | 1079 | * @return string  | 
                                                        
| 1080 | 1080 | * @throws Exceptions\ConnectionFailedException  | 
                                                        
| 1081 | 1081 | */  | 
                                                        
| 1082 | -    public function getToken(){ | 
                                                        |
| 1082 | +    public function getToken() { | 
                                                        |
| 1083 | 1083 |          return base64_encode(implode('-', [$this->message_id, $this->subject, strlen($this->getRawBody())])); | 
                                                        
| 1084 | 1084 | }  | 
                                                        
| 1085 | 1085 | |
@@ -1142,7 +1142,7 @@ discard block  | 
                                                    ||
| 1142 | 1142 | /**  | 
                                                        
| 1143 | 1143 | * @return object|null  | 
                                                        
| 1144 | 1144 | */  | 
                                                        
| 1145 | -    public function getStructure(){ | 
                                                        |
| 1145 | +    public function getStructure() { | 
                                                        |
| 1146 | 1146 | return $this->structure;  | 
                                                        
| 1147 | 1147 | }  | 
                                                        
| 1148 | 1148 | |
@@ -1166,7 +1166,7 @@ discard block  | 
                                                    ||
| 1166 | 1166 | /**  | 
                                                        
| 1167 | 1167 | * @return array  | 
                                                        
| 1168 | 1168 | */  | 
                                                        
| 1169 | -    public function getAttributes(){ | 
                                                        |
| 1169 | +    public function getAttributes() { | 
                                                        |
| 1170 | 1170 | return $this->attributes;  | 
                                                        
| 1171 | 1171 | }  | 
                                                        
| 1172 | 1172 | |
@@ -1174,8 +1174,8 @@ discard block  | 
                                                    ||
| 1174 | 1174 | * @param $mask  | 
                                                        
| 1175 | 1175 | * @return $this  | 
                                                        
| 1176 | 1176 | */  | 
                                                        
| 1177 | -    public function setMask($mask){ | 
                                                        |
| 1178 | -        if(class_exists($mask)){ | 
                                                        |
| 1177 | +    public function setMask($mask) { | 
                                                        |
| 1178 | +        if (class_exists($mask)) { | 
                                                        |
| 1179 | 1179 | $this->mask = $mask;  | 
                                                        
| 1180 | 1180 | }  | 
                                                        
| 1181 | 1181 | |
@@ -1185,7 +1185,7 @@ discard block  | 
                                                    ||
| 1185 | 1185 | /**  | 
                                                        
| 1186 | 1186 | * @return string  | 
                                                        
| 1187 | 1187 | */  | 
                                                        
| 1188 | -    public function getMask(){ | 
                                                        |
| 1188 | +    public function getMask() { | 
                                                        |
| 1189 | 1189 | return $this->mask;  | 
                                                        
| 1190 | 1190 | }  | 
                                                        
| 1191 | 1191 | |
@@ -1196,9 +1196,9 @@ discard block  | 
                                                    ||
| 1196 | 1196 | * @return mixed  | 
                                                        
| 1197 | 1197 | * @throws MaskNotFoundException  | 
                                                        
| 1198 | 1198 | */  | 
                                                        
| 1199 | -    public function mask($mask = null){ | 
                                                        |
| 1199 | +    public function mask($mask = null) { | 
                                                        |
| 1200 | 1200 | $mask = $mask !== null ? $mask : $this->mask;  | 
                                                        
| 1201 | -        if(class_exists($mask)){ | 
                                                        |
| 1201 | +        if (class_exists($mask)) { | 
                                                        |
| 1202 | 1202 | return new $mask($this);  | 
                                                        
| 1203 | 1203 | }  | 
                                                        
| 1204 | 1204 | |