Passed
Push — master ( aad7db...4b5f38 )
by Malte
04:57 queued 02:17
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/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/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.
src/Message.php 1 patch
Braces   +16 added lines, -8 removed lines patch added patch discarded remove patch
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
         if(strtolower(substr($method, 0, 3)) === 'get') {
245 245
             $name = Str::snake(substr($method, 3));
246 246
             return $this->get($name);
247
-        }elseif (strtolower(substr($method, 0, 3)) === 'set') {
247
+        } elseif (strtolower(substr($method, 0, 3)) === 'set') {
248 248
             $name = Str::snake(substr($method, 3));
249 249
 
250 250
             if(in_array($name, array_keys($this->attributes))) {
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
 
441 441
         if ($part->isAttachment()) {
442 442
             $this->fetchAttachment($part);
443
-        }else{
443
+        } else{
444 444
             $encoding = $this->getEncoding($part);
445 445
 
446 446
             $content = $this->decodeString($part->content, $part->encoding);
@@ -616,9 +616,9 @@  discard block
 block discarded – undo
616 616
                     return EncodingAliases::get($parameter->value);
617 617
                 }
618 618
             }
619
-        }elseif (property_exists($structure, 'charset')){
619
+        } elseif (property_exists($structure, 'charset')){
620 620
             return EncodingAliases::get($structure->charset);
621
-        }elseif (is_string($structure) === true){
621
+        } elseif (is_string($structure) === true){
622 622
             return mb_detect_encoding($structure);
623 623
         }
624 624
 
@@ -719,7 +719,9 @@  discard block
 block discarded – undo
719 719
 
720 720
             $this->client->openFolder($this->folder_path);
721 721
             if ($this->client->getConnection()->copyMessage($folder->path, $this->msgn) == true) {
722
-                if($expunge) $this->client->expunge();
722
+                if($expunge) {
723
+                    $this->client->expunge();
724
+                }
723 725
 
724 726
                 $this->client->openFolder($folder->path);
725 727
                 $message_num = $this->client->getConnection()->getMessageNumber($next_uid);
@@ -761,7 +763,9 @@  discard block
 block discarded – undo
761 763
 
762 764
             $this->client->openFolder($this->folder_path);
763 765
             if ($this->client->getConnection()->moveMessage($folder->path, $this->msgn) == true) {
764
-                if($expunge) $this->client->expunge();
766
+                if($expunge) {
767
+                    $this->client->expunge();
768
+                }
765 769
 
766 770
                 $this->client->openFolder($folder->path);
767 771
                 $message_num = $this->client->getConnection()->getMessageNumber($next_uid);
@@ -788,7 +792,9 @@  discard block
 block discarded – undo
788 792
      */
789 793
     public function delete($expunge = true) {
790 794
         $status = $this->setFlag("Deleted");
791
-        if($expunge) $this->client->expunge();
795
+        if($expunge) {
796
+            $this->client->expunge();
797
+        }
792 798
 
793 799
         $event = $this->getEvent("message", "deleted");
794 800
         $event::dispatch($this);
@@ -807,7 +813,9 @@  discard block
 block discarded – undo
807 813
      */
808 814
     public function restore($expunge = true) {
809 815
         $status = $this->unsetFlag("Deleted");
810
-        if($expunge) $this->client->expunge();
816
+        if($expunge) {
817
+            $this->client->expunge();
818
+        }
811 819
 
812 820
         $event = $this->getEvent("message", "restored");
813 821
         $event::dispatch($this);
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
@@ -76,7 +76,9 @@  discard block
 block discarded – undo
76 76
     public function __construct(Client $client, $charset = 'UTF-8') {
77 77
         $this->setClient($client);
78 78
 
79
-        if(ClientManager::get('options.fetch') === IMAP::FT_PEEK) $this->leaveUnread();
79
+        if(ClientManager::get('options.fetch') === IMAP::FT_PEEK) {
80
+            $this->leaveUnread();
81
+        }
80 82
 
81 83
         if (ClientManager::get('options.fetch_order') === 'desc') {
82 84
             $this->fetch_order = 'desc';
@@ -120,7 +122,9 @@  discard block
 block discarded – undo
120 122
      * @throws MessageSearchValidationException
121 123
      */
122 124
     protected function parse_date($date) {
123
-        if($date instanceof \Carbon\Carbon) return $date;
125
+        if($date instanceof \Carbon\Carbon) {
126
+            return $date;
127
+        }
124 128
 
125 129
         try {
126 130
             $date = Carbon::parse($date);
@@ -287,7 +291,7 @@  discard block
 block discarded – undo
287 291
             } else {
288 292
                 if($statement[1] === null){
289 293
                     $query .= $statement[0];
290
-                }else{
294
+                } else{
291 295
                     $query .= $statement[0].' "'.$statement[1].'"';
292 296
                 }
293 297
             }
@@ -317,7 +321,9 @@  discard block
 block discarded – undo
317 321
      * @return $this
318 322
      */
319 323
     public function limit($limit, $page = 1) {
320
-        if($page >= 1) $this->page = $page;
324
+        if($page >= 1) {
325
+            $this->page = $page;
326
+        }
321 327
         $this->limit = $limit;
322 328
 
323 329
         return $this;
Please login to merge, or discard this patch.