@@ -16,7 +16,7 @@  | 
                                                    ||
| 16 | 16 | * New custom method which can be called through a mask  | 
                                                        
| 17 | 17 | * @return string  | 
                                                        
| 18 | 18 | */  | 
                                                        
| 19 | -    public function token(){ | 
                                                        |
| 19 | +    public function token() { | 
                                                        |
| 20 | 20 |          return implode('-', [$this->message_id, $this->uid, $this->message_no]); | 
                                                        
| 21 | 21 | }  | 
                                                        
| 22 | 22 | |
@@ -16,7 +16,7 @@  | 
                                                    ||
| 16 | 16 | * New custom method which can be called through a mask  | 
                                                        
| 17 | 17 | * @return string  | 
                                                        
| 18 | 18 | */  | 
                                                        
| 19 | -    public function token(){ | 
                                                        |
| 19 | +    public function token() { | 
                                                        |
| 20 | 20 |          return implode('-', [$this->id, $this->getMessage()->getUid(), $this->name]); | 
                                                        
| 21 | 21 | }  | 
                                                        
| 22 | 22 | |
@@ -46,7 +46,9 @@ discard block  | 
                                                    ||
| 46 | 46 | */  | 
                                                        
| 47 | 47 |      public function getCustomHTMLBody($callback = false) { | 
                                                        
| 48 | 48 | $body = $this->getHtmlBody();  | 
                                                        
| 49 | - if($body === null) return null;  | 
                                                        |
| 49 | +        if($body === null) { | 
                                                        |
| 50 | + return null;  | 
                                                        |
| 51 | + }  | 
                                                        |
| 50 | 52 | |
| 51 | 53 |          if ($callback !== false) { | 
                                                        
| 52 | 54 | $aAttachment = $this->parent->getAttachments();  | 
                                                        
@@ -54,7 +56,7 @@ discard block  | 
                                                    ||
| 54 | 56 | /** @var Attachment $oAttachment */  | 
                                                        
| 55 | 57 |                  if(is_callable($callback)) { | 
                                                        
| 56 | 58 | $body = $callback($body, $oAttachment);  | 
                                                        
| 57 | -                }elseif(is_string($callback)) { | 
                                                        |
| 59 | +                } elseif(is_string($callback)) { | 
                                                        |
| 58 | 60 | call_user_func($callback, [$body, $oAttachment]);  | 
                                                        
| 59 | 61 | }  | 
                                                        
| 60 | 62 | });  | 
                                                        
@@ -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) { | 
                                                        
| 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) { | 
                                                        
| 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() { | 
                                                        
| 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); | 
                                                        
@@ -67,7 +67,7 @@  | 
                                                    ||
| 67 | 67 | return $this->attributes[$name];  | 
                                                        
| 68 | 68 | }  | 
                                                        
| 69 | 69 | |
| 70 | -        }elseif (strtolower(substr($method, 0, 3)) === 'set') { | 
                                                        |
| 70 | +        } elseif (strtolower(substr($method, 0, 3)) === 'set') { | 
                                                        |
| 71 | 71 | $name = Str::snake(substr($method, 3));  | 
                                                        
| 72 | 72 | |
| 73 | 73 |              if(isset($this->attributes[$name])) { | 
                                                        
@@ -43,7 +43,7 @@ discard block  | 
                                                    ||
| 43 | 43 |      public function __construct($parent) { | 
                                                        
| 44 | 44 | $this->parent = $parent;  | 
                                                        
| 45 | 45 | |
| 46 | -        if(method_exists($this->parent, 'getAttributes')){ | 
                                                        |
| 46 | +        if (method_exists($this->parent, 'getAttributes')) { | 
                                                        |
| 47 | 47 | $this->attributes = array_merge($this->attributes, $this->parent->getAttributes());  | 
                                                        
| 48 | 48 | }  | 
                                                        
| 49 | 49 | |
@@ -53,7 +53,7 @@ discard block  | 
                                                    ||
| 53 | 53 | /**  | 
                                                        
| 54 | 54 | * Boot method made to be used by any custom mask  | 
                                                        
| 55 | 55 | */  | 
                                                        
| 56 | -    protected function boot(){} | 
                                                        |
| 56 | +    protected function boot() {} | 
                                                        |
| 57 | 57 | |
| 58 | 58 | /**  | 
                                                        
| 59 | 59 | * Call dynamic attribute setter and getter methods and inherit the parent calls  | 
                                                        
@@ -64,17 +64,17 @@ discard block  | 
                                                    ||
| 64 | 64 | * @throws MethodNotFoundException  | 
                                                        
| 65 | 65 | */  | 
                                                        
| 66 | 66 |      public function __call(string $method, array $arguments) { | 
                                                        
| 67 | -        if(strtolower(substr($method, 0, 3)) === 'get') { | 
                                                        |
| 67 | +        if (strtolower(substr($method, 0, 3)) === 'get') { | 
                                                        |
| 68 | 68 | $name = Str::snake(substr($method, 3));  | 
                                                        
| 69 | 69 | |
| 70 | -            if(isset($this->attributes[$name])) { | 
                                                        |
| 70 | +            if (isset($this->attributes[$name])) { | 
                                                        |
| 71 | 71 | return $this->attributes[$name];  | 
                                                        
| 72 | 72 | }  | 
                                                        
| 73 | 73 | |
| 74 | 74 |          }elseif (strtolower(substr($method, 0, 3)) === 'set') { | 
                                                        
| 75 | 75 | $name = Str::snake(substr($method, 3));  | 
                                                        
| 76 | 76 | |
| 77 | -            if(isset($this->attributes[$name])) { | 
                                                        |
| 77 | +            if (isset($this->attributes[$name])) { | 
                                                        |
| 78 | 78 | $this->attributes[$name] = array_pop($arguments);  | 
                                                        
| 79 | 79 | |
| 80 | 80 | return $this->attributes[$name];  | 
                                                        
@@ -82,7 +82,7 @@ discard block  | 
                                                    ||
| 82 | 82 | |
| 83 | 83 | }  | 
                                                        
| 84 | 84 | |
| 85 | -        if(method_exists($this->parent, $method) === true){ | 
                                                        |
| 85 | +        if (method_exists($this->parent, $method) === true) { | 
                                                        |
| 86 | 86 | return call_user_func_array([$this->parent, $method], $arguments);  | 
                                                        
| 87 | 87 | }  | 
                                                        
| 88 | 88 | |
@@ -109,7 +109,7 @@ discard block  | 
                                                    ||
| 109 | 109 | * @return mixed|null  | 
                                                        
| 110 | 110 | */  | 
                                                        
| 111 | 111 |      public function __get($name) { | 
                                                        
| 112 | -        if(isset($this->attributes[$name])) { | 
                                                        |
| 112 | +        if (isset($this->attributes[$name])) { | 
                                                        |
| 113 | 113 | return $this->attributes[$name];  | 
                                                        
| 114 | 114 | }  | 
                                                        
| 115 | 115 | |
@@ -121,7 +121,7 @@ discard block  | 
                                                    ||
| 121 | 121 | *  | 
                                                        
| 122 | 122 | * @return object  | 
                                                        
| 123 | 123 | */  | 
                                                        
| 124 | -    public function getParent(){ | 
                                                        |
| 124 | +    public function getParent() { | 
                                                        |
| 125 | 125 | return $this->parent;  | 
                                                        
| 126 | 126 | }  | 
                                                        
| 127 | 127 | |
@@ -69,7 +69,7 @@  | 
                                                    ||
| 69 | 69 | * @return int|null  | 
                                                        
| 70 | 70 | */  | 
                                                        
| 71 | 71 |      public function total($total = null) { | 
                                                        
| 72 | -        if($total === null) { | 
                                                        |
| 72 | +        if ($total === null) { | 
                                                        |
| 73 | 73 | return $this->total;  | 
                                                        
| 74 | 74 | }  | 
                                                        
| 75 | 75 | |
@@ -55,7 +55,7 @@  | 
                                                    ||
| 55 | 55 | // so add them back in manually if we can  | 
                                                        
| 56 | 56 |          if (defined('STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT')) { | 
                                                        
| 57 | 57 | $cryptoMethod = STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT;  | 
                                                        
| 58 | -        }elseif (defined('STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT')) { | 
                                                        |
| 58 | +        } elseif (defined('STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT')) { | 
                                                        |
| 59 | 59 | $cryptoMethod = STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT;  | 
                                                        
| 60 | 60 | }  | 
                                                        
| 61 | 61 | |
@@ -233,7 +233,7 @@  | 
                                                    ||
| 233 | 233 | return "UID";  | 
                                                        
| 234 | 234 | }  | 
                                                        
| 235 | 235 |          if (strlen($uid) > 0 && !is_numeric($uid)) { | 
                                                        
| 236 | - return (string)$uid;  | 
                                                        |
| 236 | + return (string) $uid;  | 
                                                        |
| 237 | 237 | }  | 
                                                        
| 238 | 238 | |
| 239 | 239 | return "";  | 
                                                        
@@ -26,8 +26,8 @@  | 
                                                    ||
| 26 | 26 | </tr>  | 
                                                        
| 27 | 27 | </thead>  | 
                                                        
| 28 | 28 | <tbody>  | 
                                                        
| 29 | - <?php if($paginator->count() > 0): ?>  | 
                                                        |
| 30 | - <?php foreach($paginator as $message): ?>  | 
                                                        |
| 29 | + <?php if ($paginator->count() > 0): ?>  | 
                                                        |
| 30 | + <?php foreach ($paginator as $message): ?>  | 
                                                        |
| 31 | 31 | <tr>  | 
                                                        
| 32 | 32 | <td><?php echo $message->getUid(); ?></td>  | 
                                                        
| 33 | 33 | <td><?php echo $message->getSubject(); ?></td>  | 
                                                        
@@ -35,11 +35,14 @@  | 
                                                    ||
| 35 | 35 | <td><?php echo $message->getAttachments()->count() > 0 ? 'yes' : 'no'; ?></td>  | 
                                                        
| 36 | 36 | </tr>  | 
                                                        
| 37 | 37 | <?php endforeach; ?>  | 
                                                        
| 38 | - <?php else: ?>  | 
                                                        |
| 38 | +    <?php else { | 
                                                        |
| 39 | + : ?>  | 
                                                        |
| 39 | 40 | <tr>  | 
                                                        
| 40 | 41 | <td colspan="4">No messages found</td>  | 
                                                        
| 41 | 42 | </tr>  | 
                                                        
| 42 | - <?php endif; ?>  | 
                                                        |
| 43 | + <?php endif;  | 
                                                        |
| 44 | +}  | 
                                                        |
| 45 | +?>  | 
                                                        |
| 43 | 46 | </tbody>  | 
                                                        
| 44 | 47 | </table>  | 
                                                        
| 45 | 48 | |
@@ -24,8 +24,8 @@  | 
                                                    ||
| 24 | 24 | </tr>  | 
                                                        
| 25 | 25 | </thead>  | 
                                                        
| 26 | 26 | <tbody>  | 
                                                        
| 27 | - <?php if($paginator->count() > 0): ?>  | 
                                                        |
| 28 | - <?php foreach($paginator as $folder): ?>  | 
                                                        |
| 27 | + <?php if ($paginator->count() > 0): ?>  | 
                                                        |
| 28 | + <?php foreach ($paginator as $folder): ?>  | 
                                                        |
| 29 | 29 | <tr>  | 
                                                        
| 30 | 30 | <td><?php echo $folder->name; ?></td>  | 
                                                        
| 31 | 31 | <td><?php echo $folder->search()->unseen()->setFetchBody(false)->count(); ?></td>  | 
                                                        
@@ -31,11 +31,14 @@  | 
                                                    ||
| 31 | 31 | <td><?php echo $folder->search()->unseen()->setFetchBody(false)->count(); ?></td>  | 
                                                        
| 32 | 32 | </tr>  | 
                                                        
| 33 | 33 | <?php endforeach; ?>  | 
                                                        
| 34 | - <?php else: ?>  | 
                                                        |
| 34 | +    <?php else { | 
                                                        |
| 35 | + : ?>  | 
                                                        |
| 35 | 36 | <tr>  | 
                                                        
| 36 | 37 | <td colspan="4">No folders found</td>  | 
                                                        
| 37 | 38 | </tr>  | 
                                                        
| 38 | - <?php endif; ?>  | 
                                                        |
| 39 | + <?php endif;  | 
                                                        |
| 40 | +}  | 
                                                        |
| 41 | +?>  | 
                                                        |
| 39 | 42 | </tbody>  | 
                                                        
| 40 | 43 | </table>  | 
                                                        
| 41 | 44 | |
@@ -121,7 +121,7 @@  | 
                                                    ||
| 121 | 121 |      protected function parse(){ | 
                                                        
| 122 | 122 |          if ($this->header === null) { | 
                                                        
| 123 | 123 | $body = $this->findHeaders();  | 
                                                        
| 124 | -        }else{ | 
                                                        |
| 124 | +        } else{ | 
                                                        |
| 125 | 125 | $body = $this->raw;  | 
                                                        
| 126 | 126 | }  | 
                                                        
| 127 | 127 | |
@@ -159,10 +159,10 @@ discard block  | 
                                                    ||
| 159 | 159 | *  | 
                                                        
| 160 | 160 | * @throws InvalidMessageDateException  | 
                                                        
| 161 | 161 | */  | 
                                                        
| 162 | -    protected function parse(){ | 
                                                        |
| 162 | +    protected function parse() { | 
                                                        |
| 163 | 163 |          if ($this->header === null) { | 
                                                        
| 164 | 164 | $body = $this->findHeaders();  | 
                                                        
| 165 | -        }else{ | 
                                                        |
| 165 | +        }else { | 
                                                        |
| 166 | 166 | $body = $this->raw;  | 
                                                        
| 167 | 167 | }  | 
                                                        
| 168 | 168 | |
@@ -174,11 +174,11 @@ discard block  | 
                                                    ||
| 174 | 174 |          $this->name = $this->header->get("name"); | 
                                                        
| 175 | 175 |          $this->filename = $this->header->get("filename"); | 
                                                        
| 176 | 176 | |
| 177 | -        if(!empty($this->header->get("id"))) { | 
                                                        |
| 177 | +        if (!empty($this->header->get("id"))) { | 
                                                        |
| 178 | 178 |              $this->id = $this->header->get("id"); | 
                                                        
| 179 | -        } else if(!empty($this->header->get("x_attachment_id"))){ | 
                                                        |
| 179 | +        }else if (!empty($this->header->get("x_attachment_id"))) { | 
                                                        |
| 180 | 180 |              $this->id = $this->header->get("x_attachment_id"); | 
                                                        
| 181 | -        } else if(!empty($this->header->get("content_id"))){ | 
                                                        |
| 181 | +        }else if (!empty($this->header->get("content_id"))) { | 
                                                        |
| 182 | 182 |              $this->id = strtr($this->header->get("content_id"), [ | 
                                                        
| 183 | 183 | '<' => '',  | 
                                                        
| 184 | 184 | '>' => ''  | 
                                                        
@@ -186,7 +186,7 @@ discard block  | 
                                                    ||
| 186 | 186 | }  | 
                                                        
| 187 | 187 | |
| 188 | 188 |          $content_types = $this->header->get("content_type"); | 
                                                        
| 189 | -        if(!empty($content_types)){ | 
                                                        |
| 189 | +        if (!empty($content_types)) { | 
                                                        |
| 190 | 190 | $this->subtype = $this->parseSubtype($content_types);  | 
                                                        
| 191 | 191 | $content_type = $content_types;  | 
                                                        
| 192 | 192 |              if (is_array($content_types)) { | 
                                                        
@@ -226,16 +226,16 @@ discard block  | 
                                                    ||
| 226 | 226 | *  | 
                                                        
| 227 | 227 | * @return string  | 
                                                        
| 228 | 228 | */  | 
                                                        
| 229 | -    private function parseSubtype($content_type){ | 
                                                        |
| 229 | +    private function parseSubtype($content_type) { | 
                                                        |
| 230 | 230 |          if (is_array($content_type)) { | 
                                                        
| 231 | -            foreach ($content_type as $part){ | 
                                                        |
| 232 | -                if ((strpos($part, "/")) !== false){ | 
                                                        |
| 231 | +            foreach ($content_type as $part) { | 
                                                        |
| 232 | +                if ((strpos($part, "/")) !== false) { | 
                                                        |
| 233 | 233 | return $this->parseSubtype($part);  | 
                                                        
| 234 | 234 | }  | 
                                                        
| 235 | 235 | }  | 
                                                        
| 236 | 236 | return null;  | 
                                                        
| 237 | 237 | }  | 
                                                        
| 238 | -        if (($pos = strpos($content_type, "/")) !== false){ | 
                                                        |
| 238 | +        if (($pos = strpos($content_type, "/")) !== false) { | 
                                                        |
| 239 | 239 | return substr($content_type, $pos + 1);  | 
                                                        
| 240 | 240 | }  | 
                                                        
| 241 | 241 | return null;  | 
                                                        
@@ -244,9 +244,9 @@ discard block  | 
                                                    ||
| 244 | 244 | /**  | 
                                                        
| 245 | 245 | * Try to parse the disposition if any is present  | 
                                                        
| 246 | 246 | */  | 
                                                        
| 247 | -    private function parseDisposition(){ | 
                                                        |
| 247 | +    private function parseDisposition() { | 
                                                        |
| 248 | 248 |          $content_disposition = $this->header->get("content_disposition"); | 
                                                        
| 249 | -        if($content_disposition !== null) { | 
                                                        |
| 249 | +        if ($content_disposition !== null) { | 
                                                        |
| 250 | 250 | $this->ifdisposition = true;  | 
                                                        
| 251 | 251 |              $this->disposition = (is_array($content_disposition)) ? implode(' ', $content_disposition) : $content_disposition; | 
                                                        
| 252 | 252 | }  | 
                                                        
@@ -255,9 +255,9 @@ discard block  | 
                                                    ||
| 255 | 255 | /**  | 
                                                        
| 256 | 256 | * Try to parse the description if any is present  | 
                                                        
| 257 | 257 | */  | 
                                                        
| 258 | -    private function parseDescription(){ | 
                                                        |
| 258 | +    private function parseDescription() { | 
                                                        |
| 259 | 259 |          $content_description = $this->header->get("content_description"); | 
                                                        
| 260 | -        if($content_description !== null) { | 
                                                        |
| 260 | +        if ($content_description !== null) { | 
                                                        |
| 261 | 261 | $this->ifdescription = true;  | 
                                                        
| 262 | 262 | $this->description = $content_description;  | 
                                                        
| 263 | 263 | }  | 
                                                        
@@ -266,9 +266,9 @@ discard block  | 
                                                    ||
| 266 | 266 | /**  | 
                                                        
| 267 | 267 | * Try to parse the encoding if any is present  | 
                                                        
| 268 | 268 | */  | 
                                                        
| 269 | -    private function parseEncoding(){ | 
                                                        |
| 269 | +    private function parseEncoding() { | 
                                                        |
| 270 | 270 |          $encoding = $this->header->get("content_transfer_encoding"); | 
                                                        
| 271 | -        if($encoding !== null) { | 
                                                        |
| 271 | +        if ($encoding !== null) { | 
                                                        |
| 272 | 272 |              switch (strtolower($encoding)) { | 
                                                        
| 273 | 273 | case "quoted-printable":  | 
                                                        
| 274 | 274 | $this->encoding = IMAP::MESSAGE_ENC_QUOTED_PRINTABLE;  |