Passed
Push — master ( 7e0890...031db5 )
by Malte
04:30
created
src/IMAP/Client.php 2 patches
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -173,45 +173,45 @@  discard block
 block discarded – undo
173 173
      * @throws MaskNotFoundException
174 174
      */
175 175
     protected function setMaskFromConfig($config) {
176
-        $default_config  = config("imap.masks");
176
+        $default_config = config("imap.masks");
177 177
 
178
-        if(isset($config['masks'])){
179
-            if(isset($config['masks']['message'])) {
180
-                if(class_exists($config['masks']['message'])) {
178
+        if (isset($config['masks'])) {
179
+            if (isset($config['masks']['message'])) {
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{
186
-                if(class_exists($default_config['message'])) {
185
+            } else {
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
-            if(isset($config['masks']['attachment'])) {
193
-                if(class_exists($config['masks']['attachment'])) {
192
+            if (isset($config['masks']['attachment'])) {
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{
199
-                if(class_exists($default_config['attachment'])) {
198
+            } else {
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{
206
-            if(class_exists($default_config['message'])) {
205
+        } else {
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
-            if(class_exists($default_config['attachment'])) {
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
         }
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
         $pattern = $parent_folder.($hierarchical ? '%' : '*');
359 359
 
360 360
         $items = imap_getmailboxes($this->connection, $this->getAddress(), $pattern);
361
-        if(is_array($items)){
361
+        if (is_array($items)) {
362 362
             foreach ($items as $item) {
363 363
                 $folder = new Folder($this, $item);
364 364
 
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
             }
374 374
 
375 375
             return $folders;
376
-        }else{
376
+        } else {
377 377
             throw new MailboxFetchingException($this->getLastError());
378 378
         }
379 379
     }
@@ -406,8 +406,8 @@  discard block
 block discarded – undo
406 406
      */
407 407
     public function createFolder($name, $expunge = true) {
408 408
         $this->checkConnection();
409
-        $status = imap_createmailbox($this->getConnection(), $this->getAddress() . imap_utf7_encode($name));
410
-        if($expunge) $this->expunge();
409
+        $status = imap_createmailbox($this->getConnection(), $this->getAddress().imap_utf7_encode($name));
410
+        if ($expunge) $this->expunge();
411 411
 
412 412
         return $status;
413 413
     }
@@ -423,8 +423,8 @@  discard block
 block discarded – undo
423 423
      */
424 424
     public function renameFolder($old_name, $new_name, $expunge = true) {
425 425
         $this->checkConnection();
426
-        $status = imap_renamemailbox($this->getConnection(), $this->getAddress() . imap_utf7_encode($old_name), $this->getAddress() . imap_utf7_encode($new_name));
427
-        if($expunge) $this->expunge();
426
+        $status = imap_renamemailbox($this->getConnection(), $this->getAddress().imap_utf7_encode($old_name), $this->getAddress().imap_utf7_encode($new_name));
427
+        if ($expunge) $this->expunge();
428 428
 
429 429
         return $status;
430 430
     }
@@ -439,8 +439,8 @@  discard block
 block discarded – undo
439 439
      */
440 440
     public function deleteFolder($name, $expunge = true) {
441 441
         $this->checkConnection();
442
-        $status = imap_deletemailbox($this->getConnection(), $this->getAddress() . imap_utf7_encode($name));
443
-        if($expunge) $this->expunge();
442
+        $status = imap_deletemailbox($this->getConnection(), $this->getAddress().imap_utf7_encode($name));
443
+        if ($expunge) $this->expunge();
444 444
 
445 445
         return $status;
446 446
     }
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
         if (!$this->validate_cert) {
535 535
             $address .= '/novalidate-cert';
536 536
         }
537
-        if (in_array($this->encryption,['tls','ssl'])) {
537
+        if (in_array($this->encryption, ['tls', 'ssl'])) {
538 538
             $address .= '/'.$this->encryption;
539 539
         }
540 540
 
@@ -655,7 +655,7 @@  discard block
 block discarded – undo
655 655
      * @throws InvalidImapTimeoutTypeException
656 656
      */
657 657
     public function setTimeout($type, $timeout) {
658
-        if(0 <= $type && $type <= 4) {
658
+        if (0 <= $type && $type <= 4) {
659 659
             return imap_timeout($type, $timeout);
660 660
         }
661 661
 
@@ -669,8 +669,8 @@  discard block
 block discarded – undo
669 669
      * @return mixed
670 670
      * @throws InvalidImapTimeoutTypeException
671 671
      */
672
-    public function getTimeout($type){
673
-        if(0 <= $type && $type <= 4) {
672
+    public function getTimeout($type) {
673
+        if (0 <= $type && $type <= 4) {
674 674
             return imap_timeout($type);
675 675
         }
676 676
 
@@ -680,7 +680,7 @@  discard block
 block discarded – undo
680 680
     /**
681 681
      * @return string
682 682
      */
683
-    public function getDefaultMessageMask(){
683
+    public function getDefaultMessageMask() {
684 684
         return $this->default_message_mask;
685 685
     }
686 686
 
@@ -691,7 +691,7 @@  discard block
 block discarded – undo
691 691
      * @throws MaskNotFoundException
692 692
      */
693 693
     public function setDefaultMessageMask($mask) {
694
-        if(class_exists($mask)) {
694
+        if (class_exists($mask)) {
695 695
             $this->default_message_mask = $mask;
696 696
 
697 697
             return $this;
@@ -703,7 +703,7 @@  discard block
 block discarded – undo
703 703
     /**
704 704
      * @return string
705 705
      */
706
-    public function getDefaultAttachmentMask(){
706
+    public function getDefaultAttachmentMask() {
707 707
         return $this->default_attachment_mask;
708 708
     }
709 709
 
@@ -714,7 +714,7 @@  discard block
 block discarded – undo
714 714
      * @throws MaskNotFoundException
715 715
      */
716 716
     public function setDefaultAttachmentMask($mask) {
717
-        if(class_exists($mask)) {
717
+        if (class_exists($mask)) {
718 718
             $this->default_attachment_mask = $mask;
719 719
 
720 720
             return $this;
Please login to merge, or discard this 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
         }
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
             }
374 374
 
375 375
             return $folders;
376
-        }else{
376
+        } else{
377 377
             throw new MailboxFetchingException($this->getLastError());
378 378
         }
379 379
     }
@@ -407,7 +407,9 @@  discard block
 block discarded – undo
407 407
     public function createFolder($name, $expunge = true) {
408 408
         $this->checkConnection();
409 409
         $status = imap_createmailbox($this->getConnection(), $this->getAddress() . imap_utf7_encode($name));
410
-        if($expunge) $this->expunge();
410
+        if($expunge) {
411
+            $this->expunge();
412
+        }
411 413
 
412 414
         return $status;
413 415
     }
@@ -424,7 +426,9 @@  discard block
 block discarded – undo
424 426
     public function renameFolder($old_name, $new_name, $expunge = true) {
425 427
         $this->checkConnection();
426 428
         $status = imap_renamemailbox($this->getConnection(), $this->getAddress() . imap_utf7_encode($old_name), $this->getAddress() . imap_utf7_encode($new_name));
427
-        if($expunge) $this->expunge();
429
+        if($expunge) {
430
+            $this->expunge();
431
+        }
428 432
 
429 433
         return $status;
430 434
     }
@@ -440,7 +444,9 @@  discard block
 block discarded – undo
440 444
     public function deleteFolder($name, $expunge = true) {
441 445
         $this->checkConnection();
442 446
         $status = imap_deletemailbox($this->getConnection(), $this->getAddress() . imap_utf7_encode($name));
443
-        if($expunge) $this->expunge();
447
+        if($expunge) {
448
+            $this->expunge();
449
+        }
444 450
 
445 451
         return $status;
446 452
     }
Please login to merge, or discard this patch.