Passed
Push — master ( 81c85c...b3bf46 )
by Malte
02:06
created
examples/folder_structure.blade.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,8 +24,8 @@
 block discarded – undo
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>
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,11 +31,14 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Part.php 2 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -121,7 +121,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -159,10 +159,10 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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)) {
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
      * @return string
208 208
      * @throws InvalidMessageDateException
209 209
      */
210
-    private function findHeaders(){
210
+    private function findHeaders() {
211 211
         $body = $this->raw;
212 212
         while (($pos = strpos($body, "\r\n")) > 0) {
213 213
             $body = substr($body, $pos + 2);
@@ -226,16 +226,16 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
      *
299 299
      * @return bool
300 300
      */
301
-    public function isAttachment(){
301
+    public function isAttachment() {
302 302
         if ($this->type == IMAP::MESSAGE_TYPE_TEXT &&
303 303
             ($this->ifdisposition == 0 ||
304 304
                 (empty($this->disposition) || !in_array(strtolower($this->disposition), ClientManager::get('options.dispositions')))
Please login to merge, or discard this patch.
src/Query/Query.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -252,7 +252,7 @@
 block discarded – undo
252 252
      */
253 253
     public function paginate($per_page = 5, $page = null, $page_name = 'imap_page'){
254 254
         if (
255
-               $page === null
255
+                $page === null
256 256
             && isset($_GET[$page_name])
257 257
             && $_GET[$page_name] > 0
258 258
         ) {
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -80,11 +80,11 @@  discard block
 block discarded – undo
80 80
         $this->setClient($client);
81 81
 
82 82
         $this->sequence = ClientManager::get('options.sequence', IMAP::ST_MSGN);
83
-        if(ClientManager::get('options.fetch') === IMAP::FT_PEEK) $this->leaveUnread();
83
+        if (ClientManager::get('options.fetch') === IMAP::FT_PEEK) $this->leaveUnread();
84 84
 
85 85
         if (ClientManager::get('options.fetch_order') === 'desc') {
86 86
             $this->fetch_order = 'desc';
87
-        } else {
87
+        }else {
88 88
             $this->fetch_order = 'asc';
89 89
         }
90 90
 
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
     /**
99 99
      * Instance boot method for additional functionality
100 100
      */
101
-    protected function boot(){}
101
+    protected function boot() {}
102 102
 
103 103
     /**
104 104
      * Parse a given value
@@ -106,8 +106,8 @@  discard block
 block discarded – undo
106 106
      *
107 107
      * @return string
108 108
      */
109
-    protected function parse_value($value){
110
-        switch(true){
109
+    protected function parse_value($value) {
110
+        switch (true) {
111 111
             case $value instanceof \Carbon\Carbon:
112 112
                 $value = $value->format($this->date_format);
113 113
                 break;
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
      * @throws MessageSearchValidationException
125 125
      */
126 126
     protected function parse_date($date) {
127
-        if($date instanceof \Carbon\Carbon) return $date;
127
+        if ($date instanceof \Carbon\Carbon) return $date;
128 128
 
129 129
         try {
130 130
             $date = Carbon::parse($date);
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
      * @return Collection
176 176
      * @throws GetMessagesFailedException
177 177
      */
178
-    protected function search(){
178
+    protected function search() {
179 179
         $this->generate_query();
180 180
 
181 181
         try {
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
                     $raw_flag = isset($raw_flags[$uid]) ? $raw_flags[$uid] : [];
241 241
 
242 242
                     $message = Message::make($uid, $msglist, $this->getClient(), $raw_header, $raw_content, $raw_flag, $this->getFetchOptions(), $this->sequence);
243
-                    switch ($message_key){
243
+                    switch ($message_key) {
244 244
                         case 'number':
245 245
                             $message_key = $message->getMessageNo();
246 246
                             break;
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 
263 263
             return $messages;
264 264
         } catch (\Exception $e) {
265
-            throw new GetMessagesFailedException($e->getMessage(),0, $e);
265
+            throw new GetMessagesFailedException($e->getMessage(), 0, $e);
266 266
         }
267 267
     }
268 268
 
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
      * @throws MessageHeaderFetchingException
281 281
      * @throws \Webklex\PHPIMAP\Exceptions\EventNotFoundException
282 282
      */
283
-    public function getMessage($uid, $msglist = null, $sequence = null){
283
+    public function getMessage($uid, $msglist = null, $sequence = null) {
284 284
         return new Message($uid, $msglist, $this->getClient(), $this->getFetchOptions(), $this->getFetchBody(), $this->getFetchFlags(), $sequence ? $sequence : $this->sequence);
285 285
     }
286 286
 
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
      * @return LengthAwarePaginator
294 294
      * @throws GetMessagesFailedException
295 295
      */
296
-    public function paginate($per_page = 5, $page = null, $page_name = 'imap_page'){
296
+    public function paginate($per_page = 5, $page = null, $page_name = 'imap_page') {
297 297
         if (
298 298
                $page === null
299 299
             && isset($_GET[$page_name])
@@ -319,10 +319,10 @@  discard block
 block discarded – undo
319 319
         $this->query->each(function($statement) use(&$query) {
320 320
             if (count($statement) == 1) {
321 321
                 $query .= $statement[0];
322
-            } else {
323
-                if($statement[1] === null){
322
+            }else {
323
+                if ($statement[1] === null) {
324 324
                     $query .= $statement[0];
325
-                }else{
325
+                }else {
326 326
                     $query .= $statement[0].' "'.$statement[1].'"';
327 327
                 }
328 328
             }
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
      * @return $this
353 353
      */
354 354
     public function limit($limit, $page = 1) {
355
-        if($page >= 1) $this->page = $page;
355
+        if ($page >= 1) $this->page = $page;
356 356
         $this->limit = $limit;
357 357
 
358 358
         return $this;
Please login to merge, or discard this patch.
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -80,7 +80,9 @@  discard block
 block discarded – undo
80 80
         $this->setClient($client);
81 81
 
82 82
         $this->sequence = ClientManager::get('options.sequence', IMAP::ST_MSGN);
83
-        if(ClientManager::get('options.fetch') === IMAP::FT_PEEK) $this->leaveUnread();
83
+        if(ClientManager::get('options.fetch') === IMAP::FT_PEEK) {
84
+            $this->leaveUnread();
85
+        }
84 86
 
85 87
         if (ClientManager::get('options.fetch_order') === 'desc') {
86 88
             $this->fetch_order = 'desc';
@@ -124,7 +126,9 @@  discard block
 block discarded – undo
124 126
      * @throws MessageSearchValidationException
125 127
      */
126 128
     protected function parse_date($date) {
127
-        if($date instanceof \Carbon\Carbon) return $date;
129
+        if($date instanceof \Carbon\Carbon) {
130
+            return $date;
131
+        }
128 132
 
129 133
         try {
130 134
             $date = Carbon::parse($date);
@@ -322,7 +326,7 @@  discard block
 block discarded – undo
322 326
             } else {
323 327
                 if($statement[1] === null){
324 328
                     $query .= $statement[0];
325
-                }else{
329
+                } else{
326 330
                     $query .= $statement[0].' "'.$statement[1].'"';
327 331
                 }
328 332
             }
@@ -352,7 +356,9 @@  discard block
 block discarded – undo
352 356
      * @return $this
353 357
      */
354 358
     public function limit($limit, $page = 1) {
355
-        if($page >= 1) $this->page = $page;
359
+        if($page >= 1) {
360
+            $this->page = $page;
361
+        }
356 362
         $this->limit = $limit;
357 363
 
358 364
         return $this;
Please login to merge, or discard this patch.
src/Attachment.php 2 patches
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
         $this->part_number = $part->part_number;
105 105
 
106 106
         $default_mask = $this->oMessage->getClient()->getDefaultAttachmentMask();
107
-        if($default_mask != null) {
107
+        if ($default_mask != null) {
108 108
             $this->mask = $default_mask;
109 109
         }
110 110
 
@@ -121,10 +121,10 @@  discard block
 block discarded – undo
121 121
      * @throws MethodNotFoundException
122 122
      */
123 123
     public function __call($method, $arguments) {
124
-        if(strtolower(substr($method, 0, 3)) === 'get') {
124
+        if (strtolower(substr($method, 0, 3)) === 'get') {
125 125
             $name = Str::snake(substr($method, 3));
126 126
 
127
-            if(isset($this->attributes[$name])) {
127
+            if (isset($this->attributes[$name])) {
128 128
                 return $this->attributes[$name];
129 129
             }
130 130
 
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
      * @return mixed|null
161 161
      */
162 162
     public function __get($name) {
163
-        if(isset($this->attributes[$name])) {
163
+        if (isset($this->attributes[$name])) {
164 164
             return $this->attributes[$name];
165 165
         }
166 166
 
@@ -223,14 +223,14 @@  discard block
 block discarded – undo
223 223
             $this->setName($name);
224 224
         }elseif (($filename = $this->part->filename) !== null) {
225 225
             $this->setName($filename);
226
-        } else {
226
+        }else {
227 227
             $this->setName("undefined");
228 228
         }
229 229
 
230 230
         if (IMAP::ATTACHMENT_TYPE_MESSAGE == $this->part->type) {
231 231
             if ($this->part->ifdescription) {
232 232
                 $this->setName($this->part->description);
233
-            } else {
233
+            }else {
234 234
                 $this->setName($this->part->subtype);
235 235
             }
236 236
         }
@@ -256,9 +256,9 @@  discard block
 block discarded – undo
256 256
     public function setName($name) {
257 257
         $decoder = $this->config['decoder']['attachment'];
258 258
         if ($name !== null) {
259
-            if($decoder === 'utf-8' && extension_loaded('imap')) {
259
+            if ($decoder === 'utf-8' && extension_loaded('imap')) {
260 260
                 $this->name = \imap_utf8($name);
261
-            }else{
261
+            }else {
262 262
                 $this->name = mb_decode_mimeheader($name);
263 263
             }
264 264
         }
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
      *
270 270
      * @return string|null
271 271
      */
272
-    public function getMimeType(){
272
+    public function getMimeType() {
273 273
         return (new \finfo())->buffer($this->getContent(), FILEINFO_MIME_TYPE);
274 274
     }
275 275
 
@@ -278,9 +278,9 @@  discard block
 block discarded – undo
278 278
      *
279 279
      * @return string|null
280 280
      */
281
-    public function getExtension(){
281
+    public function getExtension() {
282 282
         $deprecated_guesser = "\Symfony\Component\HttpFoundation\File\MimeType\ExtensionGuesser";
283
-        if (class_exists($deprecated_guesser) !== false){
283
+        if (class_exists($deprecated_guesser) !== false) {
284 284
             return $deprecated_guesser::getInstance()->guess($this->getMimeType());
285 285
         }
286 286
         $guesser = "\Symfony\Component\Mime\MimeTypes";
@@ -293,14 +293,14 @@  discard block
 block discarded – undo
293 293
      *
294 294
      * @return array
295 295
      */
296
-    public function getAttributes(){
296
+    public function getAttributes() {
297 297
         return $this->attributes;
298 298
     }
299 299
 
300 300
     /**
301 301
      * @return Message
302 302
      */
303
-    public function getMessage(){
303
+    public function getMessage() {
304 304
         return $this->oMessage;
305 305
     }
306 306
 
@@ -310,8 +310,8 @@  discard block
 block discarded – undo
310 310
      *
311 311
      * @return $this
312 312
      */
313
-    public function setMask($mask){
314
-        if(class_exists($mask)){
313
+    public function setMask($mask) {
314
+        if (class_exists($mask)) {
315 315
             $this->mask = $mask;
316 316
         }
317 317
 
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
      *
324 324
      * @return string
325 325
      */
326
-    public function getMask(){
326
+    public function getMask() {
327 327
         return $this->mask;
328 328
     }
329 329
 
@@ -334,9 +334,9 @@  discard block
 block discarded – undo
334 334
      * @return mixed
335 335
      * @throws MaskNotFoundException
336 336
      */
337
-    public function mask($mask = null){
337
+    public function mask($mask = null) {
338 338
         $mask = $mask !== null ? $mask : $this->mask;
339
-        if(class_exists($mask)){
339
+        if (class_exists($mask)) {
340 340
             return new $mask($this);
341 341
         }
342 342
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
             }
130 130
 
131 131
             return null;
132
-        }elseif (strtolower(substr($method, 0, 3)) === 'set') {
132
+        } elseif (strtolower(substr($method, 0, 3)) === 'set') {
133 133
             $name = Str::snake(substr($method, 3));
134 134
 
135 135
             $this->attributes[$name] = array_pop($arguments);
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 
222 222
         if (($name = $this->part->name) !== null) {
223 223
             $this->setName($name);
224
-        }elseif (($filename = $this->part->filename) !== null) {
224
+        } elseif (($filename = $this->part->filename) !== null) {
225 225
             $this->setName($filename);
226 226
         } else {
227 227
             $this->setName("undefined");
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
         if ($name !== null) {
259 259
             if($decoder === 'utf-8' && extension_loaded('imap')) {
260 260
                 $this->name = \imap_utf8($name);
261
-            }else{
261
+            } else{
262 262
                 $this->name = mb_decode_mimeheader($name);
263 263
             }
264 264
         }
Please login to merge, or discard this patch.
src/Structure.php 2 patches
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
         $content_type = (is_array($content_type)) ? implode(' ', $content_type) : $content_type;
92 92
         if(stripos($content_type, 'multipart') === 0) {
93 93
             $this->type = IMAP::MESSAGE_TYPE_MULTIPART;
94
-        }else{
94
+        } else{
95 95
             $this->type = IMAP::MESSAGE_TYPE_TEXT;
96 96
         }
97 97
     }
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
                     foreach($match[1] as $matched){
127 127
                         $boundaries[] = str_replace('"', '', $matched);
128 128
                     }
129
-                }else{
129
+                } else{
130 130
                     if(!empty($match[1])) {
131 131
                         $boundaries[] = str_replace('"', '', $match[1]);
132 132
                     }
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
      * @throws MessageContentFetchingException
78 78
      * @throws InvalidMessageDateException
79 79
      */
80
-    protected function parse(){
80
+    protected function parse() {
81 81
         $this->findContentType();
82 82
         $this->parts = $this->find_parts();
83 83
     }
@@ -85,13 +85,13 @@  discard block
 block discarded – undo
85 85
     /**
86 86
      * Determine the message content type
87 87
      */
88
-    public function findContentType(){
88
+    public function findContentType() {
89 89
 
90 90
         $content_type = $this->header->get("content_type");
91 91
         $content_type = (is_array($content_type)) ? implode(' ', $content_type) : $content_type;
92
-        if(stripos($content_type, 'multipart') === 0) {
92
+        if (stripos($content_type, 'multipart') === 0) {
93 93
             $this->type = IMAP::MESSAGE_TYPE_MULTIPART;
94
-        }else{
94
+        }else {
95 95
             $this->type = IMAP::MESSAGE_TYPE_TEXT;
96 96
         }
97 97
     }
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
     /**
100 100
      * Determine the message content type
101 101
      */
102
-    public function getBoundary(){
102
+    public function getBoundary() {
103 103
         $boundary = $this->header->find("/boundary=\"?([^\"]*)[\";\s]/");
104 104
         return str_replace('"', '', $boundary);
105 105
     }
@@ -111,9 +111,9 @@  discard block
 block discarded – undo
111 111
      * @throws MessageContentFetchingException
112 112
      * @throws InvalidMessageDateException
113 113
      */
114
-    public function find_parts(){
115
-        if($this->type === IMAP::MESSAGE_TYPE_MULTIPART) {
116
-            if (($boundary = $this->getBoundary()) === null)  {
114
+    public function find_parts() {
115
+        if ($this->type === IMAP::MESSAGE_TYPE_MULTIPART) {
116
+            if (($boundary = $this->getBoundary()) === null) {
117 117
                 throw new MessageContentFetchingException("no content found", 0);
118 118
             }
119 119
 
@@ -122,21 +122,21 @@  discard block
 block discarded – undo
122 122
             ];
123 123
 
124 124
             if (preg_match("/boundary\=\"?(.*)\"?/", $this->raw, $match) == 1) {
125
-                if(is_array($match[1])){
126
-                    foreach($match[1] as $matched){
125
+                if (is_array($match[1])) {
126
+                    foreach ($match[1] as $matched) {
127 127
                         $boundaries[] = str_replace('"', '', $matched);
128 128
                     }
129
-                }else{
130
-                    if(!empty($match[1])) {
129
+                }else {
130
+                    if (!empty($match[1])) {
131 131
                         $boundaries[] = str_replace('"', '', $match[1]);
132 132
                     }
133 133
                 }
134 134
             }
135 135
 
136
-            $raw_parts = explode( $boundaries[0], str_replace($boundaries, $boundaries[0], $this->raw) );
136
+            $raw_parts = explode($boundaries[0], str_replace($boundaries, $boundaries[0], $this->raw));
137 137
             $parts = [];
138 138
             $part_number = 0;
139
-            foreach($raw_parts as $part) {
139
+            foreach ($raw_parts as $part) {
140 140
                 $part = trim(rtrim($part));
141 141
                 if ($part !== "--") {
142 142
                     $parts[] = new Part($part, null, $part_number);
Please login to merge, or discard this patch.
src/Client.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -377,7 +377,7 @@
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -194,11 +194,11 @@  discard block
 block discarded – undo
194 194
      * @param array $config
195 195
      * @param array $default_config
196 196
      */
197
-    private function setAccountConfig($key, $config, $default_config){
197
+    private function setAccountConfig($key, $config, $default_config) {
198 198
         $value = $this->default_account_config[$key];
199
-        if(isset($config[$key])) {
199
+        if (isset($config[$key])) {
200 200
             $value = $config[$key];
201
-        }elseif(isset($default_config[$key])) {
201
+        }elseif (isset($default_config[$key])) {
202 202
             $value = $default_config[$key];
203 203
         }
204 204
         $this->$key = $value;
@@ -210,9 +210,9 @@  discard block
 block discarded – undo
210 210
      */
211 211
     protected function setEventsFromConfig($config) {
212 212
         $this->events = ClientManager::get("events");
213
-        if(isset($config['events'])){
214
-            if(isset($config['events'])) {
215
-                foreach($config['events'] as $section => $events) {
213
+        if (isset($config['events'])) {
214
+            if (isset($config['events'])) {
215
+                foreach ($config['events'] as $section => $events) {
216 216
                     $this->events[$section] = array_merge($this->events[$section], $events);
217 217
                 }
218 218
             }
@@ -226,45 +226,45 @@  discard block
 block discarded – undo
226 226
      * @throws MaskNotFoundException
227 227
      */
228 228
     protected function setMaskFromConfig($config) {
229
-        $default_config  = ClientManager::get("masks");
229
+        $default_config = ClientManager::get("masks");
230 230
 
231
-        if(isset($config['masks'])){
232
-            if(isset($config['masks']['message'])) {
233
-                if(class_exists($config['masks']['message'])) {
231
+        if (isset($config['masks'])) {
232
+            if (isset($config['masks']['message'])) {
233
+                if (class_exists($config['masks']['message'])) {
234 234
                     $this->default_message_mask = $config['masks']['message'];
235
-                }else{
235
+                }else {
236 236
                     throw new MaskNotFoundException("Unknown mask provided: ".$config['masks']['message']);
237 237
                 }
238
-            }else{
239
-                if(class_exists($default_config['message'])) {
238
+            }else {
239
+                if (class_exists($default_config['message'])) {
240 240
                     $this->default_message_mask = $default_config['message'];
241
-                }else{
241
+                }else {
242 242
                     throw new MaskNotFoundException("Unknown mask provided: ".$default_config['message']);
243 243
                 }
244 244
             }
245
-            if(isset($config['masks']['attachment'])) {
246
-                if(class_exists($config['masks']['attachment'])) {
245
+            if (isset($config['masks']['attachment'])) {
246
+                if (class_exists($config['masks']['attachment'])) {
247 247
                     $this->default_message_mask = $config['masks']['attachment'];
248
-                }else{
248
+                }else {
249 249
                     throw new MaskNotFoundException("Unknown mask provided: ".$config['masks']['attachment']);
250 250
                 }
251
-            }else{
252
-                if(class_exists($default_config['attachment'])) {
251
+            }else {
252
+                if (class_exists($default_config['attachment'])) {
253 253
                     $this->default_message_mask = $default_config['attachment'];
254
-                }else{
254
+                }else {
255 255
                     throw new MaskNotFoundException("Unknown mask provided: ".$default_config['attachment']);
256 256
                 }
257 257
             }
258
-        }else{
259
-            if(class_exists($default_config['message'])) {
258
+        }else {
259
+            if (class_exists($default_config['message'])) {
260 260
                 $this->default_message_mask = $default_config['message'];
261
-            }else{
261
+            }else {
262 262
                 throw new MaskNotFoundException("Unknown mask provided: ".$default_config['message']);
263 263
             }
264 264
 
265
-            if(class_exists($default_config['attachment'])) {
265
+            if (class_exists($default_config['attachment'])) {
266 266
                 $this->default_message_mask = $default_config['attachment'];
267
-            }else{
267
+            }else {
268 268
                 throw new MaskNotFoundException("Unknown mask provided: ".$default_config['attachment']);
269 269
             }
270 270
         }
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
             $this->connection = new ImapProtocol($this->validate_cert, $this->encryption);
330 330
             $this->connection->setConnectionTimeout($timeout);
331 331
             $this->connection->setProxy($this->proxy);
332
-        }else{
332
+        }else {
333 333
             if (extension_loaded('imap') === false) {
334 334
                 throw new ConnectionFailedException("connection setup failed", 0, new ProtocolNotSupportedException($protocol." is an unsupported protocol"));
335 335
             }
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
         $pattern = $parent_folder.($hierarchical ? '%' : '*');
443 443
         $items = $this->connection->folders('', $pattern);
444 444
 
445
-        if(is_array($items)){
445
+        if (is_array($items)) {
446 446
             foreach ($items as $folder_name => $item) {
447 447
                 $folder = new Folder($this, $folder_name, $item["delimiter"], $item["flags"]);
448 448
 
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
             }
458 458
 
459 459
             return $folders;
460
-        }else{
460
+        }else {
461 461
             throw new FolderFetchingException("failed to fetch any folders");
462 462
         }
463 463
     }
@@ -493,10 +493,10 @@  discard block
 block discarded – undo
493 493
         $this->checkConnection();
494 494
         $status = $this->connection->createFolder($folder);
495 495
 
496
-        if($expunge) $this->expunge();
496
+        if ($expunge) $this->expunge();
497 497
 
498 498
         $folder = $this->getFolder($folder);
499
-        if($status && $folder) {
499
+        if ($status && $folder) {
500 500
             $event = $this->getEvent("folder", "new");
501 501
             $event::dispatch($folder);
502 502
         }
@@ -521,7 +521,7 @@  discard block
 block discarded – undo
521 521
      *
522 522
      * @return Folder
523 523
      */
524
-    public function getFolderPath(){
524
+    public function getFolderPath() {
525 525
         return $this->active_folder;
526 526
     }
527 527
 
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
      *
576 576
      * @return int
577 577
      */
578
-    public function getTimeout($type){
578
+    public function getTimeout($type) {
579 579
         return $this->connection->getConnectionTimeout();
580 580
     }
581 581
 
@@ -584,7 +584,7 @@  discard block
 block discarded – undo
584 584
      *
585 585
      * @return string
586 586
      */
587
-    public function getDefaultMessageMask(){
587
+    public function getDefaultMessageMask() {
588 588
         return $this->default_message_mask;
589 589
     }
590 590
 
@@ -594,7 +594,7 @@  discard block
 block discarded – undo
594 594
      *
595 595
      * @return array
596 596
      */
597
-    public function getDefaultEvents($section){
597
+    public function getDefaultEvents($section) {
598 598
         return $this->events[$section];
599 599
     }
600 600
 
@@ -606,7 +606,7 @@  discard block
 block discarded – undo
606 606
      * @throws MaskNotFoundException
607 607
      */
608 608
     public function setDefaultMessageMask($mask) {
609
-        if(class_exists($mask)) {
609
+        if (class_exists($mask)) {
610 610
             $this->default_message_mask = $mask;
611 611
 
612 612
             return $this;
@@ -620,7 +620,7 @@  discard block
 block discarded – undo
620 620
      *
621 621
      * @return string
622 622
      */
623
-    public function getDefaultAttachmentMask(){
623
+    public function getDefaultAttachmentMask() {
624 624
         return $this->default_attachment_mask;
625 625
     }
626 626
 
@@ -632,7 +632,7 @@  discard block
 block discarded – undo
632 632
      * @throws MaskNotFoundException
633 633
      */
634 634
     public function setDefaultAttachmentMask($mask) {
635
-        if(class_exists($mask)) {
635
+        if (class_exists($mask)) {
636 636
             $this->default_attachment_mask = $mask;
637 637
 
638 638
             return $this;
Please login to merge, or discard this patch.
Braces   +15 added lines, -13 removed lines patch added patch discarded remove patch
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
         $value = $this->default_account_config[$key];
199 199
         if(isset($config[$key])) {
200 200
             $value = $config[$key];
201
-        }elseif(isset($default_config[$key])) {
201
+        } elseif(isset($default_config[$key])) {
202 202
             $value = $default_config[$key];
203 203
         }
204 204
         $this->$key = $value;
@@ -232,39 +232,39 @@  discard block
 block discarded – undo
232 232
             if(isset($config['masks']['message'])) {
233 233
                 if(class_exists($config['masks']['message'])) {
234 234
                     $this->default_message_mask = $config['masks']['message'];
235
-                }else{
235
+                } else{
236 236
                     throw new MaskNotFoundException("Unknown mask provided: ".$config['masks']['message']);
237 237
                 }
238
-            }else{
238
+            } else{
239 239
                 if(class_exists($default_config['message'])) {
240 240
                     $this->default_message_mask = $default_config['message'];
241
-                }else{
241
+                } else{
242 242
                     throw new MaskNotFoundException("Unknown mask provided: ".$default_config['message']);
243 243
                 }
244 244
             }
245 245
             if(isset($config['masks']['attachment'])) {
246 246
                 if(class_exists($config['masks']['attachment'])) {
247 247
                     $this->default_message_mask = $config['masks']['attachment'];
248
-                }else{
248
+                } else{
249 249
                     throw new MaskNotFoundException("Unknown mask provided: ".$config['masks']['attachment']);
250 250
                 }
251
-            }else{
251
+            } else{
252 252
                 if(class_exists($default_config['attachment'])) {
253 253
                     $this->default_message_mask = $default_config['attachment'];
254
-                }else{
254
+                } else{
255 255
                     throw new MaskNotFoundException("Unknown mask provided: ".$default_config['attachment']);
256 256
                 }
257 257
             }
258
-        }else{
258
+        } else{
259 259
             if(class_exists($default_config['message'])) {
260 260
                 $this->default_message_mask = $default_config['message'];
261
-            }else{
261
+            } else{
262 262
                 throw new MaskNotFoundException("Unknown mask provided: ".$default_config['message']);
263 263
             }
264 264
 
265 265
             if(class_exists($default_config['attachment'])) {
266 266
                 $this->default_message_mask = $default_config['attachment'];
267
-            }else{
267
+            } else{
268 268
                 throw new MaskNotFoundException("Unknown mask provided: ".$default_config['attachment']);
269 269
             }
270 270
         }
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
             $this->connection = new ImapProtocol($this->validate_cert, $this->encryption);
330 330
             $this->connection->setConnectionTimeout($timeout);
331 331
             $this->connection->setProxy($this->proxy);
332
-        }else{
332
+        } else{
333 333
             if (extension_loaded('imap') === false) {
334 334
                 throw new ConnectionFailedException("connection setup failed", 0, new ProtocolNotSupportedException($protocol." is an unsupported protocol"));
335 335
             }
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
             }
458 458
 
459 459
             return $folders;
460
-        }else{
460
+        } else{
461 461
             throw new FolderFetchingException("failed to fetch any folders");
462 462
         }
463 463
     }
@@ -493,7 +493,9 @@  discard block
 block discarded – undo
493 493
         $this->checkConnection();
494 494
         $status = $this->connection->createFolder($folder);
495 495
 
496
-        if($expunge) $this->expunge();
496
+        if($expunge) {
497
+            $this->expunge();
498
+        }
497 499
 
498 500
         $folder = $this->getFolder($folder);
499 501
         if($status && $folder) {
Please login to merge, or discard this patch.
src/Folder.php 2 patches
Braces   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -232,7 +232,9 @@  discard block
 block discarded – undo
232 232
     public function move($new_name, $expunge = true) {
233 233
         $this->client->checkConnection();
234 234
         $status = $this->client->getConnection()->renameFolder($this->full_name, $new_name);
235
-        if($expunge) $this->client->expunge();
235
+        if($expunge) {
236
+            $this->client->expunge();
237
+        }
236 238
 
237 239
         $folder = $this->client->getFolder($new_name);
238 240
         $event = $this->getEvent("folder", "moved");
@@ -306,7 +308,9 @@  discard block
 block discarded – undo
306 308
      */
307 309
     public function delete($expunge = true) {
308 310
         $status = $this->client->getConnection()->deleteFolder($this->path);
309
-        if($expunge) $this->client->expunge();
311
+        if($expunge) {
312
+            $this->client->expunge();
313
+        }
310 314
 
311 315
         $event = $this->getEvent("folder", "deleted");
312 316
         $event::dispatch($this);
@@ -374,7 +378,7 @@  discard block
 block discarded – undo
374 378
 
375 379
                     $connection->idle();
376 380
                 }
377
-            }catch (Exceptions\RuntimeException $e) {
381
+            } catch (Exceptions\RuntimeException $e) {
378 382
                 if(strpos($e->getMessage(), "connection closed") === false) {
379 383
                     throw $e;
380 384
                 }
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 
126 126
         $this->setDelimiter($delimiter);
127 127
         $this->path      = $folder_name;
128
-        $this->full_name  = $this->decodeName($folder_name);
128
+        $this->full_name = $this->decodeName($folder_name);
129 129
         $this->name      = $this->getSimpleName($this->delimiter, $this->full_name);
130 130
 
131 131
         $this->parseAttributes($attributes);
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
      * @return WhereQuery
139 139
      * @throws Exceptions\ConnectionFailedException
140 140
      */
141
-    public function query($charset = 'UTF-8'){
141
+    public function query($charset = 'UTF-8') {
142 142
         $this->getClient()->checkConnection();
143 143
         $this->getClient()->openFolder($this->path);
144 144
 
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
      * @inheritdoc self::query($charset = 'UTF-8')
150 150
      * @throws Exceptions\ConnectionFailedException
151 151
      */
152
-    public function search($charset = 'UTF-8'){
152
+    public function search($charset = 'UTF-8') {
153 153
         return $this->query($charset);
154 154
     }
155 155
 
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
      * @inheritdoc self::query($charset = 'UTF-8')
158 158
      * @throws Exceptions\ConnectionFailedException
159 159
      */
160
-    public function messages($charset = 'UTF-8'){
160
+    public function messages($charset = 'UTF-8') {
161 161
         return $this->query($charset);
162 162
     }
163 163
 
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
     public function move($new_name, $expunge = true) {
233 233
         $this->client->checkConnection();
234 234
         $status = $this->client->getConnection()->renameFolder($this->full_name, $new_name);
235
-        if($expunge) $this->client->expunge();
235
+        if ($expunge) $this->client->expunge();
236 236
 
237 237
         $folder = $this->client->getFolder($new_name);
238 238
         $event = $this->getEvent("folder", "moved");
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
      * @return array
249 249
      * @throws ConnectionFailedException
250 250
      */
251
-    public function overview($sequence = null){
251
+    public function overview($sequence = null) {
252 252
         $this->client->openFolder($this->path);
253 253
         $sequence = $sequence === null ? "1:*" : $sequence;
254 254
         return $this->client->getConnection()->overview($sequence);
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
          */
273 273
 
274 274
         if ($internal_date != null) {
275
-            if ($internal_date instanceof Carbon){
275
+            if ($internal_date instanceof Carbon) {
276 276
                 $internal_date = $internal_date->format('d-M-Y H:i:s O');
277 277
             }
278 278
         }
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
      */
307 307
     public function delete($expunge = true) {
308 308
         $status = $this->client->getConnection()->deleteFolder($this->path);
309
-        if($expunge) $this->client->expunge();
309
+        if ($expunge) $this->client->expunge();
310 310
 
311 311
         $event = $this->getEvent("folder", "deleted");
312 312
         $event::dispatch($this);
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
             try {
362 362
                 $line = $connection->nextLine();
363 363
                 if (($pos = strpos($line, "EXISTS")) !== false) {
364
-                    $msgn = (int) substr($line, 2, $pos -2);
364
+                    $msgn = (int) substr($line, 2, $pos - 2);
365 365
                     $connection->done();
366 366
 
367 367
                     $this->client->openFolder($this->path, true);
@@ -373,8 +373,8 @@  discard block
 block discarded – undo
373 373
 
374 374
                     $connection->idle();
375 375
                 }
376
-            }catch (Exceptions\RuntimeException $e) {
377
-                if(strpos($e->getMessage(), "connection closed") === false) {
376
+            } catch (Exceptions\RuntimeException $e) {
377
+                if (strpos($e->getMessage(), "connection closed") === false) {
378 378
                     throw $e;
379 379
                 }
380 380
             }
@@ -416,8 +416,8 @@  discard block
 block discarded – undo
416 416
      * Set the delimiter
417 417
      * @param $delimiter
418 418
      */
419
-    public function setDelimiter($delimiter){
420
-        if(in_array($delimiter, [null, '', ' ', false]) === true) {
419
+    public function setDelimiter($delimiter) {
420
+        if (in_array($delimiter, [null, '', ' ', false]) === true) {
421 421
             $delimiter = ClientManager::get('options.delimiter', '/');
422 422
         }
423 423
 
Please login to merge, or discard this patch.
src/Header.php 2 patches
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -73,10 +73,10 @@  discard block
 block discarded – undo
73 73
      * @throws MethodNotFoundException
74 74
      */
75 75
     public function __call($method, $arguments) {
76
-        if(strtolower(substr($method, 0, 3)) === 'get') {
76
+        if (strtolower(substr($method, 0, 3)) === 'get') {
77 77
             $name = preg_replace('/(.)(?=[A-Z])/u', '$1_', substr(strtolower($method), 3));
78 78
 
79
-            if(in_array($name, array_keys($this->attributes))) {
79
+            if (in_array($name, array_keys($this->attributes))) {
80 80
                 return $this->attributes[$name];
81 81
             }
82 82
 
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
      * @return mixed|null
103 103
      */
104 104
     public function get($name) {
105
-        if(isset($this->attributes[$name])) {
105
+        if (isset($this->attributes[$name])) {
106 106
             return $this->attributes[$name];
107 107
         }
108 108
 
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
     public function find($pattern) {
119 119
         if (preg_match_all($pattern, $this->raw, $matches)) {
120 120
             if (isset($matches[1])) {
121
-                if(count($matches[1]) > 0) {
121
+                if (count($matches[1]) > 0) {
122 122
                     return $matches[1][0];
123 123
                 }
124 124
             }
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
      *
132 132
      * @throws InvalidMessageDateException
133 133
      */
134
-    protected function parse(){
134
+    protected function parse() {
135 135
         $header = $this->rfc822_parse_headers($this->raw);
136 136
 
137 137
         $this->extractAddresses($header);
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
         $this->parseDate($header);
153 153
         foreach ($header as $key => $value) {
154 154
             $key = trim(rtrim(strtolower($key)));
155
-            if(!isset($this->attributes[$key])){
155
+            if (!isset($this->attributes[$key])) {
156 156
                 $this->attributes[$key] = $value;
157 157
             }
158 158
         }
@@ -168,12 +168,12 @@  discard block
 block discarded – undo
168 168
      *
169 169
      * @return object
170 170
      */
171
-    public function rfc822_parse_headers($raw_headers){
171
+    public function rfc822_parse_headers($raw_headers) {
172 172
         $headers = [];
173 173
         $imap_headers = [];
174 174
         if (extension_loaded('imap')) {
175 175
             $raw_imap_headers = (array) \imap_rfc822_parse_headers($this->raw);
176
-            foreach($raw_imap_headers as $key => $values) {
176
+            foreach ($raw_imap_headers as $key => $values) {
177 177
                 $key = str_replace("-", "_", $key);
178 178
                 $imap_headers[$key] = $values;
179 179
             }
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 
182 182
         $lines = explode("\r\n", $raw_headers);
183 183
         $prev_header = null;
184
-        foreach($lines as $line) {
184
+        foreach ($lines as $line) {
185 185
             if (substr($line, 0, 1) === "\n") {
186 186
                 $line = substr($line, 1);
187 187
             }
@@ -201,11 +201,11 @@  discard block
 block discarded – undo
201 201
                     }
202 202
                     if (is_array($headers[$prev_header])) {
203 203
                         $headers[$prev_header][] = $line;
204
-                    }else{
204
+                    }else {
205 205
                         $headers[$prev_header] .= $line;
206 206
                     }
207 207
                 }
208
-            }else{
208
+            }else {
209 209
                 if (($pos = strpos($line, ":")) > 0) {
210 210
                     $key = trim(rtrim(strtolower(substr($line, 0, $pos))));
211 211
                     $key = str_replace("-", "_", $key);
@@ -217,10 +217,10 @@  discard block
 block discarded – undo
217 217
             }
218 218
         }
219 219
 
220
-        foreach($headers as $key => $values) {
220
+        foreach ($headers as $key => $values) {
221 221
             if (isset($imap_headers[$key])) continue;
222 222
             $value = null;
223
-            switch($key){
223
+            switch ($key) {
224 224
                 case 'from':
225 225
                 case 'to':
226 226
                 case 'cc':
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
                     break;
236 236
                 default:
237 237
                     if (is_array($values)) {
238
-                        foreach($values as $k => $v) {
238
+                        foreach ($values as $k => $v) {
239 239
                             if ($v == "") {
240 240
                                 unset($values[$k]);
241 241
                             }
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
                             $value = implode(" ", $values);
248 248
                         } elseif ($available_values > 2) {
249 249
                             $value = array_values($values);
250
-                        } else {
250
+                        }else {
251 251
                             $value = "";
252 252
                         }
253 253
                     }
@@ -267,12 +267,12 @@  discard block
 block discarded – undo
267 267
      * @return array The decoded elements are returned in an array of objects, where each
268 268
      * object has two properties, charset and text.
269 269
      */
270
-    public function mime_header_decode($text){
270
+    public function mime_header_decode($text) {
271 271
         if (extension_loaded('imap')) {
272 272
             return \imap_mime_header_decode($text);
273 273
         }
274 274
         $charset = $this->getEncoding($text);
275
-        return [(object)[
275
+        return [(object) [
276 276
             "charset" => $charset,
277 277
             "text" => $this->convertEncoding($text, $charset)
278 278
         ]];
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
         try {
327 327
             if (function_exists('iconv') && $from != 'UTF-7' && $to != 'UTF-7') {
328 328
                 return iconv($from, $to, $str);
329
-            } else {
329
+            }else {
330 330
                 if (!$from) {
331 331
                     return mb_convert_encoding($str, $to);
332 332
                 }
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
             if (strstr($from, '-')) {
337 337
                 $from = str_replace('-', '', $from);
338 338
                 return $this->convertEncoding($str, $from, $to);
339
-            } else {
339
+            }else {
340 340
                 return $str;
341 341
             }
342 342
         }
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
             }
358 358
         }elseif (property_exists($structure, 'charset')) {
359 359
             return EncodingAliases::get($structure->charset, $this->fallback_encoding);
360
-        }elseif (is_string($structure) === true){
360
+        }elseif (is_string($structure) === true) {
361 361
             return mb_detect_encoding($structure);
362 362
         }
363 363
 
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
         $decoder = $this->config['decoder']['message'];
379 379
 
380 380
         if ($value !== null) {
381
-            if($decoder === 'utf-8' && extension_loaded('imap')) {
381
+            if ($decoder === 'utf-8' && extension_loaded('imap')) {
382 382
                 $value = \imap_utf8($value);
383 383
                 if (strpos(strtolower($value), '=?utf-8?') === 0) {
384 384
                     $value = mb_decode_mimeheader($value);
@@ -386,14 +386,14 @@  discard block
 block discarded – undo
386 386
                 if ($this->notDecoded($original_value, $value)) {
387 387
                     $decoded_value = $this->mime_header_decode($value);
388 388
                     if (count($decoded_value) > 0) {
389
-                        if(property_exists($decoded_value[0], "text")) {
389
+                        if (property_exists($decoded_value[0], "text")) {
390 390
                             $value = $decoded_value[0]->text;
391 391
                         }
392 392
                     }
393 393
                 }
394
-            }elseif($decoder === 'iconv') {
394
+            }elseif ($decoder === 'iconv') {
395 395
                 $value = iconv_mime_decode($value);
396
-            }else{
396
+            }else {
397 397
                 $value = mb_decode_mimeheader($value);
398 398
             }
399 399
 
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
      * @return array
417 417
      */
418 418
     private function decodeArray($values) {
419
-        foreach($values as $key => $value) {
419
+        foreach ($values as $key => $value) {
420 420
             $values[$key] = $this->decode($value);
421 421
         }
422 422
         return $values;
@@ -426,8 +426,8 @@  discard block
 block discarded – undo
426 426
      * Try to extract the priority from a given raw header string
427 427
      */
428 428
     private function findPriority() {
429
-        if(($priority = $this->get("x_priority")) === null) return;
430
-        switch($priority){
429
+        if (($priority = $this->get("x_priority")) === null) return;
430
+        switch ($priority) {
431 431
             case IMAP::MESSAGE_PRIORITY_HIGHEST;
432 432
                 $priority = IMAP::MESSAGE_PRIORITY_HIGHEST;
433 433
                 break;
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
      */
460 460
     private function decodeAddresses($values) {
461 461
         $addresses = [];
462
-        foreach($values as $address) {
462
+        foreach ($values as $address) {
463 463
             $address = trim(rtrim($address));
464 464
             if (strpos($address, ",") == strlen($address) - 1) {
465 465
                 $address = substr($address, 0, -1);
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
                 '/^(?:(?P<name>.+)\s)?(?(name)<|<?)(?P<email>[^\s]+?)(?(name)>|>?)$/',
469 469
                 $address,
470 470
                 $matches
471
-            )){
471
+            )) {
472 472
                 $name = trim(rtrim($matches["name"]));
473 473
                 $email = trim(rtrim($matches["email"]));
474 474
                 list($mailbox, $host) = array_pad(explode("@", $email), 2, null);
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
      * @param object $header
488 488
      */
489 489
     private function extractAddresses($header) {
490
-        foreach(['from', 'to', 'cc', 'bcc', 'reply_to', 'sender'] as $key){
490
+        foreach (['from', 'to', 'cc', 'bcc', 'reply_to', 'sender'] as $key) {
491 491
             if (property_exists($header, $key)) {
492 492
                 $this->attributes[$key] = $this->parseAddresses($header->$key);
493 493
             }
@@ -518,10 +518,10 @@  discard block
 block discarded – undo
518 518
             }
519 519
             if (!property_exists($address, 'personal')) {
520 520
                 $address->personal = false;
521
-            } else {
521
+            }else {
522 522
                 $personalParts = $this->mime_header_decode($address->personal);
523 523
 
524
-                if(is_array($personalParts)) {
524
+                if (is_array($personalParts)) {
525 525
                     $address->personal = '';
526 526
                     foreach ($personalParts as $p) {
527 527
                         $address->personal .= $this->convertEncoding($p->text, $this->getEncoding($p));
@@ -541,18 +541,18 @@  discard block
 block discarded – undo
541 541
     /**
542 542
      * Search and extract potential header extensions
543 543
      */
544
-    private function extractHeaderExtensions(){
544
+    private function extractHeaderExtensions() {
545 545
         foreach ($this->attributes as $key => $value) {
546 546
             // Only parse strings and don't parse any attributes like the user-agent
547 547
             if (is_string($value) === true && in_array($key, ["user_agent"]) === false) {
548
-                if (($pos = strpos($value, ";")) !== false){
548
+                if (($pos = strpos($value, ";")) !== false) {
549 549
                     $original = substr($value, 0, $pos);
550 550
                     $this->attributes[$key] = trim(rtrim($original));
551 551
 
552 552
                     // Get all potential extensions
553 553
                     $extensions = explode(";", substr($value, $pos + 1));
554
-                    foreach($extensions as $extension) {
555
-                        if (($pos = strpos($extension, "=")) !== false){
554
+                    foreach ($extensions as $extension) {
555
+                        if (($pos = strpos($extension, "=")) !== false) {
556 556
                             $key = substr($extension, 0, $pos);
557 557
                             $key = trim(rtrim(strtolower($key)));
558 558
 
@@ -595,7 +595,7 @@  discard block
 block discarded – undo
595 595
             $parsed_date = null;
596 596
             $date = $header->date;
597 597
 
598
-            if(preg_match('/\+0580/', $date)) {
598
+            if (preg_match('/\+0580/', $date)) {
599 599
                 $date = str_replace('+0580', '+0530', $date);
600 600
             }
601 601
 
@@ -618,7 +618,7 @@  discard block
 block discarded – undo
618 618
                         $date = trim(array_pop($array));
619 619
                         break;
620 620
                 }
621
-                try{
621
+                try {
622 622
                     $parsed_date = Carbon::parse($date);
623 623
                 } catch (\Exception $_e) {
624 624
                     throw new InvalidMessageDateException("Invalid message date. ID:".$this->get("message_id"), 1100, $e);
Please login to merge, or discard this patch.
Braces   +13 added lines, -9 removed lines patch added patch discarded remove patch
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
                 if ($prev_header !== null) {
193 193
                     $headers[$prev_header][] = $line;
194 194
                 }
195
-            }elseif (substr($line, 0, 1) === " ") {
195
+            } elseif (substr($line, 0, 1) === " ") {
196 196
                 $line = substr($line, 1);
197 197
                 $line = trim(rtrim($line));
198 198
                 if ($prev_header !== null) {
@@ -201,11 +201,11 @@  discard block
 block discarded – undo
201 201
                     }
202 202
                     if (is_array($headers[$prev_header])) {
203 203
                         $headers[$prev_header][] = $line;
204
-                    }else{
204
+                    } else{
205 205
                         $headers[$prev_header] .= $line;
206 206
                     }
207 207
                 }
208
-            }else{
208
+            } else{
209 209
                 if (($pos = strpos($line, ":")) > 0) {
210 210
                     $key = trim(rtrim(strtolower(substr($line, 0, $pos))));
211 211
                     $key = str_replace("-", "_", $key);
@@ -218,7 +218,9 @@  discard block
 block discarded – undo
218 218
         }
219 219
 
220 220
         foreach($headers as $key => $values) {
221
-            if (isset($imap_headers[$key])) continue;
221
+            if (isset($imap_headers[$key])) {
222
+                continue;
223
+            }
222 224
             $value = null;
223 225
             switch($key){
224 226
                 case 'from':
@@ -355,9 +357,9 @@  discard block
 block discarded – undo
355 357
                     return EncodingAliases::get($parameter->value, $this->fallback_encoding);
356 358
                 }
357 359
             }
358
-        }elseif (property_exists($structure, 'charset')) {
360
+        } elseif (property_exists($structure, 'charset')) {
359 361
             return EncodingAliases::get($structure->charset, $this->fallback_encoding);
360
-        }elseif (is_string($structure) === true){
362
+        } elseif (is_string($structure) === true){
361 363
             return mb_detect_encoding($structure);
362 364
         }
363 365
 
@@ -391,9 +393,9 @@  discard block
 block discarded – undo
391 393
                         }
392 394
                     }
393 395
                 }
394
-            }elseif($decoder === 'iconv') {
396
+            } elseif($decoder === 'iconv') {
395 397
                 $value = iconv_mime_decode($value);
396
-            }else{
398
+            } else{
397 399
                 $value = mb_decode_mimeheader($value);
398 400
             }
399 401
 
@@ -426,7 +428,9 @@  discard block
 block discarded – undo
426 428
      * Try to extract the priority from a given raw header string
427 429
      */
428 430
     private function findPriority() {
429
-        if(($priority = $this->get("x_priority")) === null) return;
431
+        if(($priority = $this->get("x_priority")) === null) {
432
+            return;
433
+        }
430 434
         switch($priority){
431 435
             case IMAP::MESSAGE_PRIORITY_HIGHEST;
432 436
                 $priority = IMAP::MESSAGE_PRIORITY_HIGHEST;
Please login to merge, or discard this patch.
src/Message.php 2 patches
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
     public function __construct($uid, $msglist, Client $client, $fetch_options = null, $fetch_body = false, $fetch_flags = false, $sequence = null) {
201 201
 
202 202
         $default_mask = $client->getDefaultMessageMask();
203
-        if($default_mask != null) {
203
+        if ($default_mask != null) {
204 204
             $this->mask = $default_mask;
205 205
         }
206 206
         $this->events["message"] = $client->getDefaultEvents("message");
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
         if ($this->sequence === IMAP::ST_UID) {
225 225
             $this->uid = $uid;
226 226
             $this->msgn = $this->client->getConnection()->getMessageNumber($this->uid);
227
-        }else{
227
+        }else {
228 228
             $this->msgn = $uid;
229 229
             $this->uid = $this->client->getConnection()->getUid($this->msgn);
230 230
         }
@@ -264,13 +264,13 @@  discard block
 block discarded – undo
264 264
      * @throws MessageContentFetchingException
265 265
      * @throws \ReflectionException
266 266
      */
267
-    public static function make($uid, $msglist, Client $client, $raw_header, $raw_body, $raw_flags, $fetch_options = null, $sequence = null){
267
+    public static function make($uid, $msglist, Client $client, $raw_header, $raw_body, $raw_flags, $fetch_options = null, $sequence = null) {
268 268
         $reflection = new \ReflectionClass(self::class);
269 269
         /** @var self $instance */
270 270
         $instance = $reflection->newInstanceWithoutConstructor();
271 271
 
272 272
         $default_mask = $client->getDefaultMessageMask();
273
-        if($default_mask != null) {
273
+        if ($default_mask != null) {
274 274
             $instance->setMask($default_mask);
275 275
         }
276 276
         $instance->setEvents([
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
         if ($instance->getSequence() === IMAP::ST_UID) {
290 290
             $instance->setUid($uid);
291 291
             $instance->setMsglist($msglist);
292
-        }else{
292
+        }else {
293 293
             $instance->setMsgn($uid, $msglist);
294 294
         }
295 295
 
@@ -317,13 +317,13 @@  discard block
 block discarded – undo
317 317
      * @throws MethodNotFoundException
318 318
      */
319 319
     public function __call($method, $arguments) {
320
-        if(strtolower(substr($method, 0, 3)) === 'get') {
320
+        if (strtolower(substr($method, 0, 3)) === 'get') {
321 321
             $name = Str::snake(substr($method, 3));
322 322
             return $this->get($name);
323 323
         }elseif (strtolower(substr($method, 0, 3)) === 'set') {
324 324
             $name = Str::snake(substr($method, 3));
325 325
 
326
-            if(in_array($name, array_keys($this->attributes))) {
326
+            if (in_array($name, array_keys($this->attributes))) {
327 327
                 $this->attributes[$name] = array_pop($arguments);
328 328
 
329 329
                 return $this->attributes[$name];
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
      * @return mixed|null
365 365
      */
366 366
     public function get($name) {
367
-        if(isset($this->attributes[$name])) {
367
+        if (isset($this->attributes[$name])) {
368 368
             return $this->attributes[$name];
369 369
         }
370 370
 
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
      *
439 439
      * @throws InvalidMessageDateException
440 440
      */
441
-    public function parseRawHeader($raw_header){
441
+    public function parseRawHeader($raw_header) {
442 442
         $this->header = new Header($raw_header);
443 443
     }
444 444
 
@@ -449,8 +449,8 @@  discard block
 block discarded – undo
449 449
     public function parseRawFlags($raw_flags) {
450 450
         $this->flags = FlagCollection::make([]);
451 451
 
452
-        foreach($raw_flags as $flag) {
453
-            if (strpos($flag, "\\") === 0){
452
+        foreach ($raw_flags as $flag) {
453
+            if (strpos($flag, "\\") === 0) {
454 454
                 $flag = substr($flag, 1);
455 455
             }
456 456
             $flag_key = strtolower($flag);
@@ -553,7 +553,7 @@  discard block
 block discarded – undo
553 553
 
554 554
         if ($part->isAttachment()) {
555 555
             $this->fetchAttachment($part);
556
-        }else{
556
+        }else {
557 557
             $encoding = $this->getEncoding($part);
558 558
 
559 559
             $content = $this->decodeString($part->content, $part->encoding);
@@ -591,7 +591,7 @@  discard block
 block discarded – undo
591 591
         if ($oAttachment->getName() !== null && $oAttachment->getSize() > 0) {
592 592
             if ($oAttachment->getId() !== null) {
593 593
                 $this->attachments->put($oAttachment->getId(), $oAttachment);
594
-            } else {
594
+            }else {
595 595
                 $this->attachments->push($oAttachment);
596 596
             }
597 597
         }
@@ -725,7 +725,7 @@  discard block
 block discarded – undo
725 725
 
726 726
         if (function_exists('iconv') && $from != 'UTF-7' && $to != 'UTF-7') {
727 727
             return @iconv($from, $to.'//IGNORE', $str);
728
-        } else {
728
+        }else {
729 729
             if (!$from) {
730 730
                 return mb_convert_encoding($str, $to);
731 731
             }
@@ -746,9 +746,9 @@  discard block
 block discarded – undo
746 746
                     return EncodingAliases::get($parameter->value);
747 747
                 }
748 748
             }
749
-        }elseif (property_exists($structure, 'charset')){
749
+        }elseif (property_exists($structure, 'charset')) {
750 750
             return EncodingAliases::get($structure->charset);
751
-        }elseif (is_string($structure) === true){
751
+        }elseif (is_string($structure) === true) {
752 752
             return mb_detect_encoding($structure);
753 753
         }
754 754
 
@@ -762,7 +762,7 @@  discard block
 block discarded – undo
762 762
      * @throws Exceptions\ConnectionFailedException
763 763
      * @throws Exceptions\FolderFetchingException
764 764
      */
765
-    public function getFolder(){
765
+    public function getFolder() {
766 766
         return $this->client->getFolder($this->folder_path);
767 767
     }
768 768
 
@@ -777,13 +777,13 @@  discard block
 block discarded – undo
777 777
      * @throws Exceptions\FolderFetchingException
778 778
      * @throws Exceptions\GetMessagesFailedException
779 779
      */
780
-    public function thread($sent_folder = null, &$thread = null, $folder = null){
780
+    public function thread($sent_folder = null, &$thread = null, $folder = null) {
781 781
         $thread = $thread ? $thread : MessageCollection::make([]);
782
-        $folder = $folder ? $folder :  $this->getFolder();
782
+        $folder = $folder ? $folder : $this->getFolder();
783 783
         $sent_folder = $sent_folder ? $sent_folder : $this->client->getFolder(ClientManager::get("options.common_folders.sent", "INBOX/Sent"));
784 784
 
785 785
         /** @var Message $message */
786
-        foreach($thread as $message) {
786
+        foreach ($thread as $message) {
787 787
             if ($message->message_id == $this->message_id) {
788 788
                 return $thread;
789 789
             }
@@ -804,7 +804,7 @@  discard block
 block discarded – undo
804 804
         });
805 805
 
806 806
         if (is_array($this->in_reply_to)) {
807
-            foreach($this->in_reply_to as $in_reply_to) {
807
+            foreach ($this->in_reply_to as $in_reply_to) {
808 808
                 $folder->query()->messageId($in_reply_to)
809 809
                     ->setFetchBody($this->getFetchBodyOption())
810 810
                     ->leaveUnread()->get()->each(function($message) use(&$thread, $folder, $sent_folder){
@@ -849,13 +849,13 @@  discard block
 block discarded – undo
849 849
 
850 850
             $this->client->openFolder($this->folder_path);
851 851
             if ($this->client->getConnection()->copyMessage($folder->path, $this->getSequenceId(), null, $this->sequence === IMAP::ST_UID) == true) {
852
-                if($expunge) $this->client->expunge();
852
+                if ($expunge) $this->client->expunge();
853 853
 
854 854
                 $this->client->openFolder($folder->path);
855 855
 
856 856
                 if ($this->sequence === IMAP::ST_UID) {
857 857
                     $sequence_id = $next_uid;
858
-                }else{
858
+                }else {
859 859
                     $sequence_id = $this->client->getConnection()->getMessageNumber($next_uid);
860 860
                 }
861 861
 
@@ -896,13 +896,13 @@  discard block
 block discarded – undo
896 896
 
897 897
             $this->client->openFolder($this->folder_path);
898 898
             if ($this->client->getConnection()->moveMessage($folder->path, $this->getSequenceId(), null, $this->sequence === IMAP::ST_UID) == true) {
899
-                if($expunge) $this->client->expunge();
899
+                if ($expunge) $this->client->expunge();
900 900
 
901 901
                 $this->client->openFolder($folder->path);
902 902
 
903 903
                 if ($this->sequence === IMAP::ST_UID) {
904 904
                     $sequence_id = $next_uid;
905
-                }else{
905
+                }else {
906 906
                     $sequence_id = $this->client->getConnection()->getMessageNumber($next_uid);
907 907
                 }
908 908
 
@@ -928,7 +928,7 @@  discard block
 block discarded – undo
928 928
      */
929 929
     public function delete($expunge = true) {
930 930
         $status = $this->setFlag("Deleted");
931
-        if($expunge) $this->client->expunge();
931
+        if ($expunge) $this->client->expunge();
932 932
 
933 933
         $event = $this->getEvent("message", "deleted");
934 934
         $event::dispatch($this);
@@ -947,7 +947,7 @@  discard block
 block discarded – undo
947 947
      */
948 948
     public function restore($expunge = true) {
949 949
         $status = $this->unsetFlag("Deleted");
950
-        if($expunge) $this->client->expunge();
950
+        if ($expunge) $this->client->expunge();
951 951
 
952 952
         $event = $this->getEvent("message", "restored");
953 953
         $event::dispatch($this);
@@ -1102,7 +1102,7 @@  discard block
 block discarded – undo
1102 1102
      *
1103 1103
      * @return Structure|null
1104 1104
      */
1105
-    public function getStructure(){
1105
+    public function getStructure() {
1106 1106
         return $this->structure;
1107 1107
     }
1108 1108
 
@@ -1128,7 +1128,7 @@  discard block
 block discarded – undo
1128 1128
      *
1129 1129
      * @return array
1130 1130
      */
1131
-    public function getAttributes(){
1131
+    public function getAttributes() {
1132 1132
         return array_merge($this->attributes, $this->header->getAttributes());
1133 1133
     }
1134 1134
 
@@ -1138,8 +1138,8 @@  discard block
 block discarded – undo
1138 1138
      *
1139 1139
      * @return $this
1140 1140
      */
1141
-    public function setMask($mask){
1142
-        if(class_exists($mask)){
1141
+    public function setMask($mask) {
1142
+        if (class_exists($mask)) {
1143 1143
             $this->mask = $mask;
1144 1144
         }
1145 1145
 
@@ -1151,7 +1151,7 @@  discard block
 block discarded – undo
1151 1151
      *
1152 1152
      * @return string
1153 1153
      */
1154
-    public function getMask(){
1154
+    public function getMask() {
1155 1155
         return $this->mask;
1156 1156
     }
1157 1157
 
@@ -1162,9 +1162,9 @@  discard block
 block discarded – undo
1162 1162
      * @return mixed
1163 1163
      * @throws MaskNotFoundException
1164 1164
      */
1165
-    public function mask($mask = null){
1165
+    public function mask($mask = null) {
1166 1166
         $mask = $mask !== null ? $mask : $this->mask;
1167
-        if(class_exists($mask)){
1167
+        if (class_exists($mask)) {
1168 1168
             return new $mask($this);
1169 1169
         }
1170 1170
 
@@ -1177,7 +1177,7 @@  discard block
 block discarded – undo
1177 1177
      *
1178 1178
      * @return $this
1179 1179
      */
1180
-    public function setFolderPath($folder_path){
1180
+    public function setFolderPath($folder_path) {
1181 1181
         $this->folder_path = $folder_path;
1182 1182
 
1183 1183
         return $this;
@@ -1189,7 +1189,7 @@  discard block
 block discarded – undo
1189 1189
      *
1190 1190
      * @return $this
1191 1191
      */
1192
-    public function setConfig($config){
1192
+    public function setConfig($config) {
1193 1193
         $this->config = $config;
1194 1194
 
1195 1195
         return $this;
@@ -1201,7 +1201,7 @@  discard block
 block discarded – undo
1201 1201
      *
1202 1202
      * @return $this
1203 1203
      */
1204
-    public function setAttachments($attachments){
1204
+    public function setAttachments($attachments) {
1205 1205
         $this->attachments = $attachments;
1206 1206
 
1207 1207
         return $this;
@@ -1213,7 +1213,7 @@  discard block
 block discarded – undo
1213 1213
      *
1214 1214
      * @return $this
1215 1215
      */
1216
-    public function setFlags($flags){
1216
+    public function setFlags($flags) {
1217 1217
         $this->flags = $flags;
1218 1218
 
1219 1219
         return $this;
@@ -1226,7 +1226,7 @@  discard block
 block discarded – undo
1226 1226
      * @throws Exceptions\ConnectionFailedException
1227 1227
      * @return $this
1228 1228
      */
1229
-    public function setClient($client){
1229
+    public function setClient($client) {
1230 1230
         $this->client = $client;
1231 1231
         $this->client->openFolder($this->folder_path);
1232 1232
 
@@ -1241,7 +1241,7 @@  discard block
 block discarded – undo
1241 1241
      * @throws Exceptions\RuntimeException
1242 1242
      * @return $this
1243 1243
      */
1244
-    public function setUid($uid){
1244
+    public function setUid($uid) {
1245 1245
         $this->uid = $uid;
1246 1246
         $this->msgn = $this->client->getConnection()->getMessageNumber($this->uid);
1247 1247
         $this->msglist = null;
@@ -1258,7 +1258,7 @@  discard block
 block discarded – undo
1258 1258
      * @throws Exceptions\RuntimeException
1259 1259
      * @return $this
1260 1260
      */
1261
-    public function setMsgn($msgn, $msglist = null){
1261
+    public function setMsgn($msgn, $msglist = null) {
1262 1262
         $this->msgn = $msgn;
1263 1263
         $this->msglist = $msglist;
1264 1264
         $this->uid = $this->client->getConnection()->getUid($this->msgn);
@@ -1271,7 +1271,7 @@  discard block
 block discarded – undo
1271 1271
      *
1272 1272
      * @return int
1273 1273
      */
1274
-    public function getSequence(){
1274
+    public function getSequence() {
1275 1275
         return $this->sequence;
1276 1276
     }
1277 1277
 
@@ -1280,7 +1280,7 @@  discard block
 block discarded – undo
1280 1280
      *
1281 1281
      * @return int
1282 1282
      */
1283
-    public function getSequenceId(){
1283
+    public function getSequenceId() {
1284 1284
         return $this->sequence === IMAP::ST_UID ? $this->uid : $this->msgn;
1285 1285
     }
1286 1286
 }
Please login to merge, or discard this patch.
Braces   +21 added lines, -13 removed lines patch added patch discarded remove patch
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
         if ($this->sequence === IMAP::ST_UID) {
225 225
             $this->uid = $uid;
226 226
             $this->msgn = $this->client->getConnection()->getMessageNumber($this->uid);
227
-        }else{
227
+        } else{
228 228
             $this->msgn = $uid;
229 229
             $this->uid = $this->client->getConnection()->getUid($this->msgn);
230 230
         }
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
         if ($instance->getSequence() === IMAP::ST_UID) {
290 290
             $instance->setUid($uid);
291 291
             $instance->setMsglist($msglist);
292
-        }else{
292
+        } else{
293 293
             $instance->setMsgn($uid, $msglist);
294 294
         }
295 295
 
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
         if(strtolower(substr($method, 0, 3)) === 'get') {
321 321
             $name = Str::snake(substr($method, 3));
322 322
             return $this->get($name);
323
-        }elseif (strtolower(substr($method, 0, 3)) === 'set') {
323
+        } elseif (strtolower(substr($method, 0, 3)) === 'set') {
324 324
             $name = Str::snake(substr($method, 3));
325 325
 
326 326
             if(in_array($name, array_keys($this->attributes))) {
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
             if ($this->getFlags()->get("seen") == null) {
506 506
                 $this->unsetFlag("Seen");
507 507
             }
508
-        }elseif ($this->getFlags()->get("seen") != null) {
508
+        } elseif ($this->getFlags()->get("seen") != null) {
509 509
             $this->setFlag("Seen");
510 510
         }
511 511
 
@@ -553,7 +553,7 @@  discard block
 block discarded – undo
553 553
 
554 554
         if ($part->isAttachment()) {
555 555
             $this->fetchAttachment($part);
556
-        }else{
556
+        } else{
557 557
             $encoding = $this->getEncoding($part);
558 558
 
559 559
             $content = $this->decodeString($part->content, $part->encoding);
@@ -746,9 +746,9 @@  discard block
 block discarded – undo
746 746
                     return EncodingAliases::get($parameter->value);
747 747
                 }
748 748
             }
749
-        }elseif (property_exists($structure, 'charset')){
749
+        } elseif (property_exists($structure, 'charset')){
750 750
             return EncodingAliases::get($structure->charset);
751
-        }elseif (is_string($structure) === true){
751
+        } elseif (is_string($structure) === true){
752 752
             return mb_detect_encoding($structure);
753 753
         }
754 754
 
@@ -849,13 +849,15 @@  discard block
 block discarded – undo
849 849
 
850 850
             $this->client->openFolder($this->folder_path);
851 851
             if ($this->client->getConnection()->copyMessage($folder->path, $this->getSequenceId(), null, $this->sequence === IMAP::ST_UID) == true) {
852
-                if($expunge) $this->client->expunge();
852
+                if($expunge) {
853
+                    $this->client->expunge();
854
+                }
853 855
 
854 856
                 $this->client->openFolder($folder->path);
855 857
 
856 858
                 if ($this->sequence === IMAP::ST_UID) {
857 859
                     $sequence_id = $next_uid;
858
-                }else{
860
+                } else{
859 861
                     $sequence_id = $this->client->getConnection()->getMessageNumber($next_uid);
860 862
                 }
861 863
 
@@ -896,13 +898,15 @@  discard block
 block discarded – undo
896 898
 
897 899
             $this->client->openFolder($this->folder_path);
898 900
             if ($this->client->getConnection()->moveMessage($folder->path, $this->getSequenceId(), null, $this->sequence === IMAP::ST_UID) == true) {
899
-                if($expunge) $this->client->expunge();
901
+                if($expunge) {
902
+                    $this->client->expunge();
903
+                }
900 904
 
901 905
                 $this->client->openFolder($folder->path);
902 906
 
903 907
                 if ($this->sequence === IMAP::ST_UID) {
904 908
                     $sequence_id = $next_uid;
905
-                }else{
909
+                } else{
906 910
                     $sequence_id = $this->client->getConnection()->getMessageNumber($next_uid);
907 911
                 }
908 912
 
@@ -928,7 +932,9 @@  discard block
 block discarded – undo
928 932
      */
929 933
     public function delete($expunge = true) {
930 934
         $status = $this->setFlag("Deleted");
931
-        if($expunge) $this->client->expunge();
935
+        if($expunge) {
936
+            $this->client->expunge();
937
+        }
932 938
 
933 939
         $event = $this->getEvent("message", "deleted");
934 940
         $event::dispatch($this);
@@ -947,7 +953,9 @@  discard block
 block discarded – undo
947 953
      */
948 954
     public function restore($expunge = true) {
949 955
         $status = $this->unsetFlag("Deleted");
950
-        if($expunge) $this->client->expunge();
956
+        if($expunge) {
957
+            $this->client->expunge();
958
+        }
951 959
 
952 960
         $event = $this->getEvent("message", "restored");
953 961
         $event::dispatch($this);
Please login to merge, or discard this patch.