Passed
Push — master ( ef4669...9202b0 )
by Malte
07:17 queued 02:44
created
src/IMAP/Providers/LaravelServiceProvider.php 1 patch
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -114,11 +114,15 @@  discard block
 block discarded – undo
114 114
         $arrays = func_get_args();
115 115
         $base = array_shift($arrays);
116 116
 
117
-        if(!is_array($base)) $base = empty($base) ? array() : array($base);
117
+        if(!is_array($base)) {
118
+            $base = empty($base) ? array() : array($base);
119
+        }
118 120
 
119 121
         foreach($arrays as $append) {
120 122
 
121
-            if(!is_array($append)) $append = array($append);
123
+            if(!is_array($append)) {
124
+                $append = array($append);
125
+            }
122 126
 
123 127
             foreach($append as $key => $value) {
124 128
 
@@ -130,7 +134,9 @@  discard block
 block discarded – undo
130 134
                 if(is_array($value) or is_array($base[$key])) {
131 135
                     $base[$key] = $this->array_merge_recursive_distinct($base[$key], $append[$key]);
132 136
                 } else if(is_numeric($key)) {
133
-                    if(!in_array($value, $base)) $base[] = $value;
137
+                    if(!in_array($value, $base)) {
138
+                        $base[] = $value;
139
+                    }
134 140
                 } else {
135 141
                     $base[$key] = $value;
136 142
                 }
Please login to merge, or discard this patch.
src/IMAP/Support/Masks/MessageMask.php 1 patch
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -45,7 +45,9 @@  discard block
 block discarded – undo
45 45
      */
46 46
     public function getCustomHTMLBody($callback = false) {
47 47
         $body = $this->getHtmlBody();
48
-        if($body === null) return null;
48
+        if($body === null) {
49
+            return null;
50
+        }
49 51
 
50 52
         if ($callback !== false) {
51 53
             $aAttachment = $this->parent->getAttachments();
@@ -53,7 +55,7 @@  discard block
 block discarded – undo
53 55
                 /** @var Attachment $oAttachment */
54 56
                 if(is_callable($callback)) {
55 57
                     $body = $callback($body, $oAttachment);
56
-                }elseif(is_string($callback)) {
58
+                } elseif(is_string($callback)) {
57 59
                     call_user_func($callback, [$body, $oAttachment]);
58 60
                 }
59 61
             });
Please login to merge, or discard this patch.
src/IMAP/Support/Masks/Mask.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@
 block discarded – undo
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])) {
Please login to merge, or discard this patch.
src/IMAP/Client.php 1 patch
Braces   +19 added lines, -13 removed lines patch added patch discarded remove patch
@@ -179,39 +179,39 @@  discard block
 block discarded – undo
179 179
             if(isset($config['masks']['message'])) {
180 180
                 if(class_exists($config['masks']['message'])) {
181 181
                     $this->default_message_mask = $config['masks']['message'];
182
-                }else{
182
+                } else{
183 183
                     throw new MaskNotFoundException("Unknown mask provided: ".$config['masks']['message']);
184 184
                 }
185
-            }else{
185
+            } else{
186 186
                 if(class_exists($default_config['message'])) {
187 187
                     $this->default_message_mask = $default_config['message'];
188
-                }else{
188
+                } else{
189 189
                     throw new MaskNotFoundException("Unknown mask provided: ".$default_config['message']);
190 190
                 }
191 191
             }
192 192
             if(isset($config['masks']['attachment'])) {
193 193
                 if(class_exists($config['masks']['attachment'])) {
194 194
                     $this->default_message_mask = $config['masks']['attachment'];
195
-                }else{
195
+                } else{
196 196
                     throw new MaskNotFoundException("Unknown mask provided: ".$config['masks']['attachment']);
197 197
                 }
198
-            }else{
198
+            } else{
199 199
                 if(class_exists($default_config['attachment'])) {
200 200
                     $this->default_message_mask = $default_config['attachment'];
201
-                }else{
201
+                } else{
202 202
                     throw new MaskNotFoundException("Unknown mask provided: ".$default_config['attachment']);
203 203
                 }
204 204
             }
205
-        }else{
205
+        } else{
206 206
             if(class_exists($default_config['message'])) {
207 207
                 $this->default_message_mask = $default_config['message'];
208
-            }else{
208
+            } else{
209 209
                 throw new MaskNotFoundException("Unknown mask provided: ".$default_config['message']);
210 210
             }
211 211
 
212 212
             if(class_exists($default_config['attachment'])) {
213 213
                 $this->default_message_mask = $default_config['attachment'];
214
-            }else{
214
+            } else{
215 215
                 throw new MaskNotFoundException("Unknown mask provided: ".$default_config['attachment']);
216 216
             }
217 217
         }
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
             }
377 377
 
378 378
             return $folders;
379
-        }else{
379
+        } else{
380 380
             throw new MailboxFetchingException($this->getLastError());
381 381
         }
382 382
     }
@@ -414,7 +414,9 @@  discard block
 block discarded – undo
414 414
     public function createFolder($name, $expunge = true) {
415 415
         $this->checkConnection();
416 416
         $status = \imap_createmailbox($this->getConnection(), $this->getAddress() . \imap_utf7_encode($name));
417
-        if($expunge) $this->expunge();
417
+        if($expunge) {
418
+            $this->expunge();
419
+        }
418 420
 
419 421
         return $status;
420 422
     }
@@ -431,7 +433,9 @@  discard block
 block discarded – undo
431 433
     public function renameFolder($old_name, $new_name, $expunge = true) {
432 434
         $this->checkConnection();
433 435
         $status = \imap_renamemailbox($this->getConnection(), $this->getAddress() . \imap_utf7_encode($old_name), $this->getAddress() . \imap_utf7_encode($new_name));
434
-        if($expunge) $this->expunge();
436
+        if($expunge) {
437
+            $this->expunge();
438
+        }
435 439
 
436 440
         return $status;
437 441
     }
@@ -447,7 +451,9 @@  discard block
 block discarded – undo
447 451
     public function deleteFolder($name, $expunge = true) {
448 452
         $this->checkConnection();
449 453
         $status = \imap_deletemailbox($this->getConnection(), $this->getAddress() . \imap_utf7_encode($name));
450
-        if($expunge) $this->expunge();
454
+        if($expunge) {
455
+            $this->expunge();
456
+        }
451 457
 
452 458
         return $status;
453 459
     }
Please login to merge, or discard this patch.
src/IMAP/Folder.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -375,7 +375,9 @@  discard block
 block discarded – undo
375 375
      */
376 376
     public function delete($expunge = true) {
377 377
         $status = \imap_deletemailbox($this->client->getConnection(), $this->path);
378
-        if($expunge) $this->client->expunge();
378
+        if($expunge) {
379
+            $this->client->expunge();
380
+        }
379 381
 
380 382
         return $status;
381 383
     }
@@ -392,7 +394,9 @@  discard block
 block discarded – undo
392 394
      */
393 395
     public function move($target_mailbox, $expunge = true) {
394 396
         $status = \imap_renamemailbox($this->client->getConnection(), $this->path, $target_mailbox);
395
-        if($expunge) $this->client->expunge();
397
+        if($expunge) {
398
+            $this->client->expunge();
399
+        }
396 400
 
397 401
         return $status;
398 402
     }
Please login to merge, or discard this patch.
src/IMAP/Query/WhereQuery.php 1 patch
Braces   +9 added lines, -5 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 
84 84
         if (strpos(strtolower($name), "where") === false){
85 85
             $method = 'where'.ucfirst($name);
86
-        }else{
86
+        } else{
87 87
             $method = lcfirst($name);
88 88
         }
89 89
 
@@ -129,13 +129,13 @@  discard block
 block discarded – undo
129 129
                 }
130 130
                 return $this->where($key, $value);
131 131
             }
132
-        }else{
132
+        } else{
133 133
             $criteria = $this->validate_criteria($criteria);
134 134
             $value = $this->parse_value($value);
135 135
 
136 136
             if($value === null || $value === ''){
137 137
                 $this->query->push([$criteria]);
138
-            }else{
138
+            } else{
139 139
                 $this->query->push([$criteria, $value]);
140 140
             }
141 141
         }
@@ -150,7 +150,9 @@  discard block
 block discarded – undo
150 150
      */
151 151
     public function orWhere(\Closure $closure = null) {
152 152
         $this->query->push(['OR']);
153
-        if($closure !== null) $closure($this);
153
+        if($closure !== null) {
154
+            $closure($this);
155
+        }
154 156
 
155 157
         return $this;
156 158
     }
@@ -162,7 +164,9 @@  discard block
 block discarded – undo
162 164
      */
163 165
     public function andWhere(\Closure $closure = null) {
164 166
         $this->query->push(['AND']);
165
-        if($closure !== null) $closure($this);
167
+        if($closure !== null) {
168
+            $closure($this);
169
+        }
166 170
 
167 171
         return $this;
168 172
     }
Please login to merge, or discard this patch.
src/IMAP/Attachment.php 1 patch
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
             }
123 123
 
124 124
             return null;
125
-        }elseif (strtolower(substr($method, 0, 3)) === 'set') {
125
+        } elseif (strtolower(substr($method, 0, 3)) === 'set') {
126 126
             $name = Str::snake(substr($method, 3));
127 127
 
128 128
             $this->attributes[$name] = array_pop($arguments);
@@ -265,9 +265,9 @@  discard block
 block discarded – undo
265 265
     public function setName($name) {
266 266
         if($this->config['decoder']['attachment']['name'] === 'utf-8') {
267 267
             $this->name = \imap_utf8($name);
268
-        }elseif($this->config['decoder']['attachment']['name'] === 'iconv') {
268
+        } elseif($this->config['decoder']['attachment']['name'] === 'iconv') {
269 269
             $this->name = iconv_mime_decode($name);
270
-        }else{
270
+        } else{
271 271
             $this->name = mb_decode_mimeheader($name);
272 272
         }
273 273
     }
Please login to merge, or discard this patch.
src/IMAP/Query/Query.php 1 patch
Braces   +11 added lines, -5 removed lines patch added patch discarded remove patch
@@ -69,7 +69,9 @@  discard block
 block discarded – undo
69 69
     public function __construct(Client $client, $charset = 'UTF-8') {
70 70
         $this->setClient($client);
71 71
 
72
-        if(config('imap.options.fetch') === IMAP::FT_PEEK) $this->leaveUnread();
72
+        if(config('imap.options.fetch') === IMAP::FT_PEEK) {
73
+            $this->leaveUnread();
74
+        }
73 75
 
74 76
         $this->date_format = config('imap.date_format', 'd M y');
75 77
 
@@ -107,7 +109,9 @@  discard block
 block discarded – undo
107 109
      * @throws MessageSearchValidationException
108 110
      */
109 111
     protected function parse_date($date) {
110
-        if($date instanceof \Carbon\Carbon) return $date;
112
+        if($date instanceof \Carbon\Carbon) {
113
+            return $date;
114
+        }
111 115
 
112 116
         try {
113 117
             $date = Carbon::parse($date);
@@ -159,7 +163,7 @@  discard block
 block discarded – undo
159 163
         try {
160 164
             if ($this->getCharset() == null) {
161 165
                 $available_messages = \imap_search($this->getClient()->getConnection(), $this->getRawQuery(), IMAP::SE_UID);
162
-            }else{
166
+            } else{
163 167
                 $available_messages = \imap_search($this->getClient()->getConnection(), $this->getRawQuery(), IMAP::SE_UID, $this->getCharset());
164 168
             }
165 169
         } catch (\Exception $e) {
@@ -300,7 +304,7 @@  discard block
 block discarded – undo
300 304
             } else {
301 305
                 if($statement[1] === null){
302 306
                     $query .= $statement[0];
303
-                }else{
307
+                } else{
304 308
                     $query .= $statement[0].' "'.$statement[1].'"';
305 309
                 }
306 310
             }
@@ -330,7 +334,9 @@  discard block
 block discarded – undo
330 334
      * @return $this
331 335
      */
332 336
     public function limit($limit, $page = 1) {
333
-        if($page >= 1) $this->page = $page;
337
+        if($page >= 1) {
338
+            $this->page = $page;
339
+        }
334 340
         $this->limit = $limit;
335 341
 
336 342
         return $this;
Please login to merge, or discard this patch.
src/IMAP/Message.php 1 patch
Braces   +17 added lines, -9 removed lines patch added patch discarded remove patch
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
                 return $this->attributes[$name];
257 257
             }
258 258
 
259
-        }elseif (strtolower(substr($method, 0, 3)) === 'set') {
259
+        } elseif (strtolower(substr($method, 0, 3)) === 'set') {
260 260
             $name = Str::snake(substr($method, 3));
261 261
 
262 262
             if(in_array($name, array_keys($this->attributes))) {
@@ -386,9 +386,9 @@  discard block
 block discarded – undo
386 386
         if (property_exists($header, 'subject')) {
387 387
             if($this->config['decoder']['message']['subject'] === 'utf-8') {
388 388
                 $this->subject = \imap_utf8($header->subject);
389
-            }elseif($this->config['decoder']['message']['subject'] === 'iconv') {
389
+            } elseif($this->config['decoder']['message']['subject'] === 'iconv') {
390 390
                 $this->subject = iconv_mime_decode($header->subject);
391
-            }else{
391
+            } else{
392 392
                 $this->subject = mb_decode_mimeheader($header->subject);
393 393
             }
394 394
         }
@@ -905,9 +905,9 @@  discard block
 block discarded – undo
905 905
                     return EncodingAliases::get($parameter->value, $this->fallback_encoding);
906 906
                 }
907 907
             }
908
-        }elseif (property_exists($structure, 'charset')) {
908
+        } elseif (property_exists($structure, 'charset')) {
909 909
             return EncodingAliases::get($structure->charset, $this->fallback_encoding);
910
-        }elseif (is_string($structure) === true){
910
+        } elseif (is_string($structure) === true){
911 911
             return mb_detect_encoding($structure);
912 912
         }
913 913
 
@@ -973,7 +973,9 @@  discard block
 block discarded – undo
973 973
      */
974 974
     public function moveToFolder($mailbox = 'INBOX', $expunge = false, $create_folder = true) {
975 975
 
976
-        if($create_folder) $this->client->createFolder($mailbox, true);
976
+        if($create_folder) {
977
+            $this->client->createFolder($mailbox, true);
978
+        }
977 979
 
978 980
         $target_folder = $this->client->getFolder($mailbox);
979 981
         $target_status = $target_folder->getStatus(IMAP::SA_ALL);
@@ -982,7 +984,9 @@  discard block
 block discarded – undo
982 984
         $status = \imap_mail_move($this->client->getConnection(), $this->uid, $mailbox, IMAP::CP_UID);
983 985
 
984 986
         if($status === true){
985
-            if($expunge) $this->client->expunge();
987
+            if($expunge) {
988
+                $this->client->expunge();
989
+            }
986 990
             $this->client->openFolder($target_folder->path);
987 991
 
988 992
             $message = $target_folder->getMessage($target_status->uidnext, null, $this->fetch_options, $this->fetch_body, $this->fetch_attachment, $this->fetch_flags);
@@ -1004,7 +1008,9 @@  discard block
 block discarded – undo
1004 1008
         $this->client->openFolder($this->folder_path);
1005 1009
 
1006 1010
         $status = \imap_delete($this->client->getConnection(), $this->uid, IMAP::FT_UID);
1007
-        if($expunge) $this->client->expunge();
1011
+        if($expunge) {
1012
+            $this->client->expunge();
1013
+        }
1008 1014
         MessageDeletedEvent::dispatch($this);
1009 1015
 
1010 1016
         return $status;
@@ -1021,7 +1027,9 @@  discard block
 block discarded – undo
1021 1027
         $this->client->openFolder($this->folder_path);
1022 1028
 
1023 1029
         $status = \imap_undelete($this->client->getConnection(), $this->uid, IMAP::FT_UID);
1024
-        if($expunge) $this->client->expunge();
1030
+        if($expunge) {
1031
+            $this->client->expunge();
1032
+        }
1025 1033
         MessageRestoredEvent::dispatch($this);
1026 1034
 
1027 1035
         return $status;
Please login to merge, or discard this patch.