Passed
Push — master ( 01984b...00f43d )
by Malte
03:00
created
src/IMAP/Client.php 2 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
      *
115 115
      * @var array $validConfigKeys
116 116
      */
117
-    protected $validConfigKeys = ['host', 'port', 'encryption', 'validate_cert', 'username', 'password','protocol'];
117
+    protected $validConfigKeys = ['host', 'port', 'encryption', 'validate_cert', 'username', 'password', 'protocol'];
118 118
 
119 119
     /**
120 120
      * All available timeout types
@@ -345,8 +345,8 @@  discard block
 block discarded – undo
345 345
      */
346 346
     public function createFolder($name, $expunge = true) {
347 347
         $this->checkConnection();
348
-        $status = imap_createmailbox($this->getConnection(), $this->getAddress() . imap_utf7_encode($name));
349
-        if($expunge) $this->expunge();
348
+        $status = imap_createmailbox($this->getConnection(), $this->getAddress().imap_utf7_encode($name));
349
+        if ($expunge) $this->expunge();
350 350
 
351 351
         return $status;
352 352
     }
@@ -362,8 +362,8 @@  discard block
 block discarded – undo
362 362
      */
363 363
     public function renameFolder($old_name, $new_name, $expunge = true) {
364 364
         $this->checkConnection();
365
-        $status = imap_renamemailbox($this->getConnection(), $this->getAddress() . imap_utf7_encode($old_name), $this->getAddress() . imap_utf7_encode($new_name));
366
-        if($expunge) $this->expunge();
365
+        $status = imap_renamemailbox($this->getConnection(), $this->getAddress().imap_utf7_encode($old_name), $this->getAddress().imap_utf7_encode($new_name));
366
+        if ($expunge) $this->expunge();
367 367
 
368 368
         return $status;
369 369
     }
@@ -378,8 +378,8 @@  discard block
 block discarded – undo
378 378
      */
379 379
     public function deleteFolder($name, $expunge = true) {
380 380
         $this->checkConnection();
381
-        $status = imap_deletemailbox($this->getConnection(), $this->getAddress() . imap_utf7_encode($name));
382
-        if($expunge) $this->expunge();
381
+        $status = imap_deletemailbox($this->getConnection(), $this->getAddress().imap_utf7_encode($name));
382
+        if ($expunge) $this->expunge();
383 383
 
384 384
         return $status;
385 385
     }
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
         if (!$this->validate_cert) {
473 473
             $address .= '/novalidate-cert';
474 474
         }
475
-        if (in_array($this->encryption,['tls','ssl'])) {
475
+        if (in_array($this->encryption, ['tls', 'ssl'])) {
476 476
             $address .= '/'.$this->encryption;
477 477
         }
478 478
         $address .= '}';
@@ -592,11 +592,11 @@  discard block
 block discarded – undo
592 592
      * @throws InvalidImapTimeoutTypeException
593 593
      */
594 594
     public function setTimeout($type, $timeout) {
595
-        if(is_numeric($type)) {
595
+        if (is_numeric($type)) {
596 596
             $type = (int) $type;
597
-        }elseif (isset($this->timeout_type[$type])){
597
+        }elseif (isset($this->timeout_type[$type])) {
598 598
             $type = $this->timeout_type[$type];
599
-        }else{
599
+        } else {
600 600
             throw new InvalidImapTimeoutTypeException("Invalid imap timeout type provided.");
601 601
         }
602 602
 
@@ -610,12 +610,12 @@  discard block
 block discarded – undo
610 610
      * @return mixed
611 611
      * @throws InvalidImapTimeoutTypeException
612 612
      */
613
-    public function getTimeout($type){
614
-        if(is_numeric($type)) {
613
+    public function getTimeout($type) {
614
+        if (is_numeric($type)) {
615 615
             $type = (int) $type;
616
-        }elseif (isset($this->timeout_type[$type])){
616
+        }elseif (isset($this->timeout_type[$type])) {
617 617
             $type = $this->timeout_type[$type];
618
-        }else{
618
+        } else {
619 619
             throw new InvalidImapTimeoutTypeException("Invalid imap timeout type provided.");
620 620
         }
621 621
 
Please login to merge, or discard this patch.
Braces   +13 added lines, -7 removed lines patch added patch discarded remove patch
@@ -346,7 +346,9 @@  discard block
 block discarded – undo
346 346
     public function createFolder($name, $expunge = true) {
347 347
         $this->checkConnection();
348 348
         $status = imap_createmailbox($this->getConnection(), $this->getAddress() . imap_utf7_encode($name));
349
-        if($expunge) $this->expunge();
349
+        if($expunge) {
350
+            $this->expunge();
351
+        }
350 352
 
351 353
         return $status;
352 354
     }
@@ -363,7 +365,9 @@  discard block
 block discarded – undo
363 365
     public function renameFolder($old_name, $new_name, $expunge = true) {
364 366
         $this->checkConnection();
365 367
         $status = imap_renamemailbox($this->getConnection(), $this->getAddress() . imap_utf7_encode($old_name), $this->getAddress() . imap_utf7_encode($new_name));
366
-        if($expunge) $this->expunge();
368
+        if($expunge) {
369
+            $this->expunge();
370
+        }
367 371
 
368 372
         return $status;
369 373
     }
@@ -379,7 +383,9 @@  discard block
 block discarded – undo
379 383
     public function deleteFolder($name, $expunge = true) {
380 384
         $this->checkConnection();
381 385
         $status = imap_deletemailbox($this->getConnection(), $this->getAddress() . imap_utf7_encode($name));
382
-        if($expunge) $this->expunge();
386
+        if($expunge) {
387
+            $this->expunge();
388
+        }
383 389
 
384 390
         return $status;
385 391
     }
@@ -594,9 +600,9 @@  discard block
 block discarded – undo
594 600
     public function setTimeout($type, $timeout) {
595 601
         if(is_numeric($type)) {
596 602
             $type = (int) $type;
597
-        }elseif (isset($this->timeout_type[$type])){
603
+        } elseif (isset($this->timeout_type[$type])){
598 604
             $type = $this->timeout_type[$type];
599
-        }else{
605
+        } else{
600 606
             throw new InvalidImapTimeoutTypeException("Invalid imap timeout type provided.");
601 607
         }
602 608
 
@@ -613,9 +619,9 @@  discard block
 block discarded – undo
613 619
     public function getTimeout($type){
614 620
         if(is_numeric($type)) {
615 621
             $type = (int) $type;
616
-        }elseif (isset($this->timeout_type[$type])){
622
+        } elseif (isset($this->timeout_type[$type])){
617 623
             $type = $this->timeout_type[$type];
618
-        }else{
624
+        } else{
619 625
             throw new InvalidImapTimeoutTypeException("Invalid imap timeout type provided.");
620 626
         }
621 627
 
Please login to merge, or discard this patch.
src/IMAP/Attachment.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -227,9 +227,9 @@  discard block
 block discarded – undo
227 227
      * @param $name
228 228
      */
229 229
     public function setName($name) {
230
-        if($this->config['decoder']['message']['subject'] === 'utf-8') {
230
+        if ($this->config['decoder']['message']['subject'] === 'utf-8') {
231 231
             $this->name = imap_utf8($name);
232
-        }else{
232
+        } else {
233 233
             $this->name = mb_decode_mimeheader($name);
234 234
         }
235 235
     }
@@ -261,14 +261,14 @@  discard block
 block discarded – undo
261 261
     /**
262 262
      * @return string|null
263 263
      */
264
-    public function getMimeType(){
264
+    public function getMimeType() {
265 265
         return (new \finfo())->buffer($this->getContent(), FILEINFO_MIME_TYPE);
266 266
     }
267 267
 
268 268
     /**
269 269
      * @return string|null
270 270
      */
271
-    public function getExtension(){
271
+    public function getExtension() {
272 272
         return ExtensionGuesser::getInstance()->guess($this->getMimeType());
273 273
     }
274 274
 }
275 275
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -229,7 +229,7 @@
 block discarded – undo
229 229
     public function setName($name) {
230 230
         if($this->config['decoder']['message']['subject'] === 'utf-8') {
231 231
             $this->name = imap_utf8($name);
232
-        }else{
232
+        } else{
233 233
             $this->name = mb_decode_mimeheader($name);
234 234
         }
235 235
     }
Please login to merge, or discard this patch.
src/IMAP/Message.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
         $this->msglist = $msglist;
195 195
         $this->client = $client;
196 196
 
197
-        $this->uid =  ($this->fetch_options == FT_UID) ? $uid : $uid;
197
+        $this->uid = ($this->fetch_options == FT_UID) ? $uid : $uid;
198 198
         $this->msgn = ($this->fetch_options == FT_UID) ? imap_msgno($this->client->getConnection(), $uid) : $uid;
199 199
 
200 200
         $this->parseHeader();
@@ -303,9 +303,9 @@  discard block
 block discarded – undo
303 303
             $header = imap_rfc822_parse_headers($this->header);
304 304
         }
305 305
 
306
-        if(preg_match('/x\-priority\:.*([0-9]{1,2})/i', $this->header, $priority)){
306
+        if (preg_match('/x\-priority\:.*([0-9]{1,2})/i', $this->header, $priority)) {
307 307
             $priority = isset($priority[1]) ? (int) $priority[1] : 0;
308
-            switch($priority){
308
+            switch ($priority) {
309 309
                 case self::PRIORITY_HIGHEST;
310 310
                     $this->priority = self::PRIORITY_HIGHEST;
311 311
                     break;
@@ -328,9 +328,9 @@  discard block
 block discarded – undo
328 328
         }
329 329
 
330 330
         if (property_exists($header, 'subject')) {
331
-            if($this->config['decoder']['message']['subject'] === 'utf-8') {
331
+            if ($this->config['decoder']['message']['subject'] === 'utf-8') {
332 332
                 $this->subject = imap_utf8($header->subject);
333
-            }else{
333
+            } else {
334 334
                 $this->subject = mb_decode_mimeheader($header->subject);
335 335
             }
336 336
         }
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
              * Please report any new invalid timestamps to [#45](https://github.com/Webklex/laravel-imap/issues/45)
390 390
              */
391 391
 
392
-            if(preg_match('/\+0580/', $date)) {
392
+            if (preg_match('/\+0580/', $date)) {
393 393
                 $date = str_replace('+0580', '+0530', $date);
394 394
             }
395 395
 
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
                         $date .= 'C';
411 411
                         break;
412 412
                 }
413
-                try{
413
+                try {
414 414
                     $this->date = Carbon::parse($date);
415 415
                 } catch (\Exception $_e) {
416 416
                     throw new InvalidMessageDateException("Invalid message date. ID:".$this->getMessageId(), 1000, $e);
@@ -512,12 +512,12 @@  discard block
 block discarded – undo
512 512
     public function parseBody() {
513 513
         $structure = imap_fetchstructure($this->client->getConnection(), $this->uid, FT_UID);
514 514
 
515
-        if(property_exists($structure, 'parts')){
515
+        if (property_exists($structure, 'parts')) {
516 516
             $parts = $structure->parts;
517 517
 
518
-            foreach ($parts as $part)  {
519
-                foreach ($part->parameters as $parameter)  {
520
-                    if($parameter->attribute == "charset")  {
518
+            foreach ($parts as $part) {
519
+                foreach ($part->parameters as $parameter) {
520
+                    if ($parameter->attribute == "charset") {
521 521
                         $encoding = $parameter->value;
522 522
 
523 523
                         $encoding = preg_replace('/Content-Transfer-Encoding/', '', $encoding);
@@ -788,7 +788,7 @@  discard block
 block discarded – undo
788 788
                     return EncodingAliases::get($parameter->value);
789 789
                 }
790 790
             }
791
-        }elseif (is_string($structure) === true){
791
+        }elseif (is_string($structure) === true) {
792 792
             return mb_detect_encoding($structure);
793 793
         }
794 794
 
@@ -859,7 +859,7 @@  discard block
 block discarded – undo
859 859
      */
860 860
     public function delete($expunge = true) {
861 861
         $status = imap_delete($this->client->getConnection(), $this->uid, FT_UID);
862
-        if($expunge) $this->client->expunge();
862
+        if ($expunge) $this->client->expunge();
863 863
 
864 864
         return $status;
865 865
     }
@@ -873,7 +873,7 @@  discard block
 block discarded – undo
873 873
      */
874 874
     public function restore($expunge = true) {
875 875
         $status = imap_undelete($this->client->getConnection(), $this->uid, FT_UID);
876
-        if($expunge) $this->client->expunge();
876
+        if ($expunge) $this->client->expunge();
877 877
 
878 878
         return $status;
879 879
     }
Please login to merge, or discard this patch.
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
         if (property_exists($header, 'subject')) {
331 331
             if($this->config['decoder']['message']['subject'] === 'utf-8') {
332 332
                 $this->subject = imap_utf8($header->subject);
333
-            }else{
333
+            } else{
334 334
                 $this->subject = mb_decode_mimeheader($header->subject);
335 335
             }
336 336
         }
@@ -788,7 +788,7 @@  discard block
 block discarded – undo
788 788
                     return EncodingAliases::get($parameter->value);
789 789
                 }
790 790
             }
791
-        }elseif (is_string($structure) === true){
791
+        } elseif (is_string($structure) === true){
792 792
             return mb_detect_encoding($structure);
793 793
         }
794 794
 
@@ -859,7 +859,9 @@  discard block
 block discarded – undo
859 859
      */
860 860
     public function delete($expunge = true) {
861 861
         $status = imap_delete($this->client->getConnection(), $this->uid, FT_UID);
862
-        if($expunge) $this->client->expunge();
862
+        if($expunge) {
863
+            $this->client->expunge();
864
+        }
863 865
 
864 866
         return $status;
865 867
     }
@@ -873,7 +875,9 @@  discard block
 block discarded – undo
873 875
      */
874 876
     public function restore($expunge = true) {
875 877
         $status = imap_undelete($this->client->getConnection(), $this->uid, FT_UID);
876
-        if($expunge) $this->client->expunge();
878
+        if($expunge) {
879
+            $this->client->expunge();
880
+        }
877 881
 
878 882
         return $status;
879 883
     }
Please login to merge, or discard this patch.