Passed
Push — master ( ce24f7...decd81 )
by Malte
03:16
created
src/Client.php 1 patch
Braces   +15 added lines, -13 removed lines patch added patch discarded remove patch
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
         $value = $this->default_account_config[$key];
181 181
         if(isset($config[$key])) {
182 182
             $value = $config[$key];
183
-        }elseif(isset($default_config[$key])) {
183
+        } elseif(isset($default_config[$key])) {
184 184
             $value = $default_config[$key];
185 185
         }
186 186
         $this->$key = $value;
@@ -214,39 +214,39 @@  discard block
 block discarded – undo
214 214
             if(isset($config['masks']['message'])) {
215 215
                 if(class_exists($config['masks']['message'])) {
216 216
                     $this->default_message_mask = $config['masks']['message'];
217
-                }else{
217
+                } else{
218 218
                     throw new MaskNotFoundException("Unknown mask provided: ".$config['masks']['message']);
219 219
                 }
220
-            }else{
220
+            } else{
221 221
                 if(class_exists($default_config['message'])) {
222 222
                     $this->default_message_mask = $default_config['message'];
223
-                }else{
223
+                } else{
224 224
                     throw new MaskNotFoundException("Unknown mask provided: ".$default_config['message']);
225 225
                 }
226 226
             }
227 227
             if(isset($config['masks']['attachment'])) {
228 228
                 if(class_exists($config['masks']['attachment'])) {
229 229
                     $this->default_message_mask = $config['masks']['attachment'];
230
-                }else{
230
+                } else{
231 231
                     throw new MaskNotFoundException("Unknown mask provided: ".$config['masks']['attachment']);
232 232
                 }
233
-            }else{
233
+            } else{
234 234
                 if(class_exists($default_config['attachment'])) {
235 235
                     $this->default_message_mask = $default_config['attachment'];
236
-                }else{
236
+                } else{
237 237
                     throw new MaskNotFoundException("Unknown mask provided: ".$default_config['attachment']);
238 238
                 }
239 239
             }
240
-        }else{
240
+        } else{
241 241
             if(class_exists($default_config['message'])) {
242 242
                 $this->default_message_mask = $default_config['message'];
243
-            }else{
243
+            } else{
244 244
                 throw new MaskNotFoundException("Unknown mask provided: ".$default_config['message']);
245 245
             }
246 246
 
247 247
             if(class_exists($default_config['attachment'])) {
248 248
                 $this->default_message_mask = $default_config['attachment'];
249
-            }else{
249
+            } else{
250 250
                 throw new MaskNotFoundException("Unknown mask provided: ".$default_config['attachment']);
251 251
             }
252 252
         }
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
             $timeout = $this->connection !== false ? $this->connection->getConnectionTimeout() : null;
311 311
             $this->connection = new ImapProtocol($this->validate_cert);
312 312
             $this->connection->setConnectionTimeout($timeout);
313
-        }else{
313
+        } else{
314 314
             if (extension_loaded('imap') === false) {
315 315
                 throw new ConnectionFailedException("connection setup failed", 0, new ProtocolNotSupportedException($protocol." is an unsupported protocol"));
316 316
             }
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
             }
403 403
 
404 404
             return $folders;
405
-        }else{
405
+        } else{
406 406
             throw new FolderFetchingException("failed to fetch any folders");
407 407
         }
408 408
     }
@@ -436,7 +436,9 @@  discard block
 block discarded – undo
436 436
     public function createFolder($folder, $expunge = true) {
437 437
         $this->checkConnection();
438 438
         $status = $this->connection->createFolder($folder);
439
-        if($expunge) $this->expunge();
439
+        if($expunge) {
440
+            $this->expunge();
441
+        }
440 442
 
441 443
         $folder = $this->getFolder($folder);
442 444
         if($status && $folder) {
Please login to merge, or discard this patch.
src/Query/Query.php 1 patch
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -73,7 +73,9 @@  discard block
 block discarded – undo
73 73
     public function __construct(Client $client, $charset = 'UTF-8') {
74 74
         $this->setClient($client);
75 75
 
76
-        if(ClientManager::get('options.fetch') === IMAP::FT_PEEK) $this->leaveUnread();
76
+        if(ClientManager::get('options.fetch') === IMAP::FT_PEEK) {
77
+            $this->leaveUnread();
78
+        }
77 79
 
78 80
         $this->date_format = ClientManager::get('date_format', 'd M y');
79 81
 
@@ -111,7 +113,9 @@  discard block
 block discarded – undo
111 113
      * @throws MessageSearchValidationException
112 114
      */
113 115
     protected function parse_date($date) {
114
-        if($date instanceof \Carbon\Carbon) return $date;
116
+        if($date instanceof \Carbon\Carbon) {
117
+            return $date;
118
+        }
115 119
 
116 120
         try {
117 121
             $date = Carbon::parse($date);
@@ -286,7 +290,7 @@  discard block
 block discarded – undo
286 290
             } else {
287 291
                 if($statement[1] === null){
288 292
                     $query .= $statement[0];
289
-                }else{
293
+                } else{
290 294
                     $query .= $statement[0].' "'.$statement[1].'"';
291 295
                 }
292 296
             }
@@ -316,7 +320,9 @@  discard block
 block discarded – undo
316 320
      * @return $this
317 321
      */
318 322
     public function limit($limit, $page = 1) {
319
-        if($page >= 1) $this->page = $page;
323
+        if($page >= 1) {
324
+            $this->page = $page;
325
+        }
320 326
         $this->limit = $limit;
321 327
 
322 328
         return $this;
Please login to merge, or discard this patch.
src/Attachment.php 1 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 1 patch
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.
src/Message.php 1 patch
Braces   +15 added lines, -7 removed lines patch added patch discarded remove patch
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
         if(strtolower(substr($method, 0, 3)) === 'get') {
244 244
             $name = Str::snake(substr($method, 3));
245 245
             return $this->get($name);
246
-        }elseif (strtolower(substr($method, 0, 3)) === 'set') {
246
+        } elseif (strtolower(substr($method, 0, 3)) === 'set') {
247 247
             $name = Str::snake(substr($method, 3));
248 248
 
249 249
             if(in_array($name, array_keys($this->attributes))) {
@@ -614,9 +614,9 @@  discard block
 block discarded – undo
614 614
                     return EncodingAliases::get($parameter->value);
615 615
                 }
616 616
             }
617
-        }elseif (property_exists($structure, 'charset')){
617
+        } elseif (property_exists($structure, 'charset')){
618 618
             return EncodingAliases::get($structure->charset);
619
-        }elseif (is_string($structure) === true){
619
+        } elseif (is_string($structure) === true){
620 620
             return mb_detect_encoding($structure);
621 621
         }
622 622
 
@@ -660,7 +660,9 @@  discard block
 block discarded – undo
660 660
 
661 661
             $this->client->openFolder($this->folder_path);
662 662
             if ($this->client->getConnection()->copyMessage($folder->path, $this->msgn) == true) {
663
-                if($expunge) $this->client->expunge();
663
+                if($expunge) {
664
+                    $this->client->expunge();
665
+                }
664 666
 
665 667
                 $this->client->openFolder($folder->path);
666 668
                 $message_num = $this->client->getConnection()->getMessageNumber($next_uid);
@@ -702,7 +704,9 @@  discard block
 block discarded – undo
702 704
 
703 705
             $this->client->openFolder($this->folder_path);
704 706
             if ($this->client->getConnection()->moveMessage($folder->path, $this->msgn) == true) {
705
-                if($expunge) $this->client->expunge();
707
+                if($expunge) {
708
+                    $this->client->expunge();
709
+                }
706 710
 
707 711
                 $this->client->openFolder($folder->path);
708 712
                 $message_num = $this->client->getConnection()->getMessageNumber($next_uid);
@@ -729,7 +733,9 @@  discard block
 block discarded – undo
729 733
      */
730 734
     public function delete($expunge = true) {
731 735
         $status = $this->setFlag("Deleted");
732
-        if($expunge) $this->client->expunge();
736
+        if($expunge) {
737
+            $this->client->expunge();
738
+        }
733 739
 
734 740
         $event = $this->getEvent("message", "deleted");
735 741
         $event::dispatch($this);
@@ -748,7 +754,9 @@  discard block
 block discarded – undo
748 754
      */
749 755
     public function restore($expunge = true) {
750 756
         $status = $this->unsetFlag("Deleted");
751
-        if($expunge) $this->client->expunge();
757
+        if($expunge) {
758
+            $this->client->expunge();
759
+        }
752 760
 
753 761
         $event = $this->getEvent("message", "restored");
754 762
         $event::dispatch($this);
Please login to merge, or discard this patch.
src/Connection/Protocols/ImapProtocol.php 1 patch
Braces   +16 added lines, -7 removed lines patch added patch discarded remove patch
@@ -256,9 +256,13 @@  discard block
 block discarded – undo
256 256
             $tokens = [substr($tokens, 0, 2)];
257 257
         }
258 258
         if (is_array($lines)){
259
-            if ($this->debug) echo "<< ".json_encode($lines)."\n";
260
-        }else{
261
-            if ($this->debug) echo "<< ".$lines."\n";
259
+            if ($this->debug) {
260
+                echo "<< ".json_encode($lines)."\n";
261
+            }
262
+        } else{
263
+            if ($this->debug) {
264
+                echo "<< ".$lines."\n";
265
+            }
262 266
         }
263 267
 
264 268
         // last line has response code
@@ -300,7 +304,9 @@  discard block
 block discarded – undo
300 304
                 $line .= ' ' . $token;
301 305
             }
302 306
         }
303
-        if ($this->debug) echo ">> ".$line."\n";
307
+        if ($this->debug) {
308
+            echo ">> ".$line."\n";
309
+        }
304 310
 
305 311
         if (fwrite($this->stream, $line . "\r\n") === false) {
306 312
             throw new RuntimeException('failed to write - connection closed?');
@@ -450,7 +456,9 @@  discard block
 block discarded – undo
450 456
     public function getCapabilities() {
451 457
         $response = $this->requestAndResponse('CAPABILITY');
452 458
 
453
-        if (!$response) return [];
459
+        if (!$response) {
460
+            return [];
461
+        }
454 462
 
455 463
         $capabilities = [];
456 464
         foreach ($response as $line) {
@@ -605,9 +613,10 @@  discard block
 block discarded – undo
605 613
             // if we want only one message we can ignore everything else and just return
606 614
             if ($to === null && !is_array($from) && ($uid ? $tokens[2][$uidKey] == $from : $tokens[0] == $from)) {
607 615
                 // we still need to read all lines
608
-                while (!$this->readLine($tokens, $tag))
609
-
616
+                while (!$this->readLine($tokens, $tag)) {
617
+                
610 618
                     return $data;
619
+                }
611 620
             }
612 621
             $result[$tokens[0]] = $data;
613 622
         }
Please login to merge, or discard this patch.
src/Header.php 1 patch
Braces   +13 added lines, -9 removed lines patch added patch discarded remove patch
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
                 if ($prev_header !== null) {
189 189
                     $headers[$prev_header][] = $line;
190 190
                 }
191
-            }elseif (substr($line, 0, 1) === " ") {
191
+            } elseif (substr($line, 0, 1) === " ") {
192 192
                 $line = substr($line, 1);
193 193
                 $line = trim(rtrim($line));
194 194
                 if ($prev_header !== null) {
@@ -197,11 +197,11 @@  discard block
 block discarded – undo
197 197
                     }
198 198
                     if (is_array($headers[$prev_header])) {
199 199
                         $headers[$prev_header][] = $line;
200
-                    }else{
200
+                    } else{
201 201
                         $headers[$prev_header] .= $line;
202 202
                     }
203 203
                 }
204
-            }else{
204
+            } else{
205 205
                 if (($pos = strpos($line, ":")) > 0) {
206 206
                     $key = trim(rtrim(strtolower(substr($line, 0, $pos))));
207 207
                     $value = trim(rtrim(substr($line, $pos + 1)));
@@ -212,7 +212,9 @@  discard block
 block discarded – undo
212 212
         }
213 213
 
214 214
         foreach($headers as $key => $values) {
215
-            if (isset($imap_headers[$key])) continue;
215
+            if (isset($imap_headers[$key])) {
216
+                continue;
217
+            }
216 218
             $value = null;
217 219
             switch($key){
218 220
                 case 'from':
@@ -349,9 +351,9 @@  discard block
 block discarded – undo
349 351
                     return EncodingAliases::get($parameter->value, $this->fallback_encoding);
350 352
                 }
351 353
             }
352
-        }elseif (property_exists($structure, 'charset')) {
354
+        } elseif (property_exists($structure, 'charset')) {
353 355
             return EncodingAliases::get($structure->charset, $this->fallback_encoding);
354
-        }elseif (is_string($structure) === true){
356
+        } elseif (is_string($structure) === true){
355 357
             return mb_detect_encoding($structure);
356 358
         }
357 359
 
@@ -382,9 +384,9 @@  discard block
 block discarded – undo
382 384
                         }
383 385
                     }
384 386
                 }
385
-            }elseif($decoder === 'iconv') {
387
+            } elseif($decoder === 'iconv') {
386 388
                 $value = iconv_mime_decode($value);
387
-            }else{
389
+            } else{
388 390
                 $value = mb_decode_mimeheader($value);
389 391
             }
390 392
 
@@ -404,7 +406,9 @@  discard block
 block discarded – undo
404 406
      * Try to extract the priority from a given raw header string
405 407
      */
406 408
     private function findPriority() {
407
-        if(($priority = $this->get("x-priority")) === null) return;
409
+        if(($priority = $this->get("x-priority")) === null) {
410
+            return;
411
+        }
408 412
         switch($priority){
409 413
             case IMAP::MESSAGE_PRIORITY_HIGHEST;
410 414
                 $priority = IMAP::MESSAGE_PRIORITY_HIGHEST;
Please login to merge, or discard this patch.