Passed
Pull Request — master (#219)
by
unknown
04:23
created
src/IMAP/Query/WhereQuery.php 2 patches
Braces   +9 added lines, -5 removed lines patch added patch discarded remove patch
@@ -77,17 +77,17 @@  discard block
 block discarded – undo
77 77
             foreach($criteria as $arguments){
78 78
                 if(count($arguments) == 1){
79 79
                     $this->where($arguments[0]);
80
-                }elseif(count($arguments) == 2){
80
+                } elseif(count($arguments) == 2){
81 81
                     $this->where($arguments[0], $arguments[1]);
82 82
                 }
83 83
             }
84
-        }else{
84
+        } else{
85 85
             $criteria = $this->validate_criteria($criteria);
86 86
             $value = $this->parse_value($value);
87 87
 
88 88
             if($value === null || $value === ''){
89 89
                 $this->query->push([$criteria]);
90
-            }else{
90
+            } else{
91 91
                 $this->query->push([$criteria, $value]);
92 92
             }
93 93
         }
@@ -102,7 +102,9 @@  discard block
 block discarded – undo
102 102
      */
103 103
     public function orWhere(\Closure $closure = null) {
104 104
         $this->query->push(['OR']);
105
-        if($closure !== null) $closure($this);
105
+        if($closure !== null) {
106
+            $closure($this);
107
+        }
106 108
 
107 109
         return $this;
108 110
     }
@@ -114,7 +116,9 @@  discard block
 block discarded – undo
114 116
      */
115 117
     public function andWhere(\Closure $closure = null) {
116 118
         $this->query->push(['AND']);
117
-        if($closure !== null) $closure($this);
119
+        if($closure !== null) {
120
+            $closure($this);
121
+        }
118 122
 
119 123
         return $this;
120 124
     }
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -75,13 +75,13 @@  discard block
 block discarded – undo
75 75
 
76 76
         $name = camel_case($name);
77 77
 
78
-        if(strtolower(substr($name, 0, 3)) === 'not') {
78
+        if (strtolower(substr($name, 0, 3)) === 'not') {
79 79
             $that = $that->whereNot();
80 80
             $name = substr($name, 3);
81 81
         }
82 82
 
83 83
         $method = 'where'.ucfirst($name);
84
-        if(method_exists($this, $method) === true){
84
+        if (method_exists($this, $method) === true) {
85 85
             return call_user_func_array([$that, $method], $arguments);
86 86
         }
87 87
 
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
     protected function validate_criteria($criteria) {
99 99
         $criteria = strtoupper($criteria);
100 100
 
101
-        if(in_array($criteria, $this->available_criteria) === false) {
101
+        if (in_array($criteria, $this->available_criteria) === false) {
102 102
             throw new InvalidWhereQueryCriteriaException();
103 103
         }
104 104
 
@@ -113,21 +113,21 @@  discard block
 block discarded – undo
113 113
      * @throws InvalidWhereQueryCriteriaException
114 114
      */
115 115
     public function where($criteria, $value = null) {
116
-        if(is_array($criteria)){
117
-            foreach($criteria as $arguments){
118
-                if(count($arguments) == 1){
116
+        if (is_array($criteria)) {
117
+            foreach ($criteria as $arguments) {
118
+                if (count($arguments) == 1) {
119 119
                     $this->where($arguments[0]);
120
-                }elseif(count($arguments) == 2){
120
+                }elseif (count($arguments) == 2) {
121 121
                     $this->where($arguments[0], $arguments[1]);
122 122
                 }
123 123
             }
124
-        }else{
124
+        } else {
125 125
             $criteria = $this->validate_criteria($criteria);
126 126
             $value = $this->parse_value($value);
127 127
 
128
-            if($value === null || $value === ''){
128
+            if ($value === null || $value === '') {
129 129
                 $this->query->push([$criteria]);
130
-            }else{
130
+            } else {
131 131
                 $this->query->push([$criteria, $value]);
132 132
             }
133 133
         }
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
      */
143 143
     public function orWhere(\Closure $closure = null) {
144 144
         $this->query->push(['OR']);
145
-        if($closure !== null) $closure($this);
145
+        if ($closure !== null) $closure($this);
146 146
 
147 147
         return $this;
148 148
     }
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
      */
155 155
     public function andWhere(\Closure $closure = null) {
156 156
         $this->query->push(['AND']);
157
-        if($closure !== null) $closure($this);
157
+        if ($closure !== null) $closure($this);
158 158
 
159 159
         return $this;
160 160
     }
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
      * @return WhereQuery
405 405
      * @throws InvalidWhereQueryCriteriaException
406 406
      */
407
-    public function whereNoXSpam(){
407
+    public function whereNoXSpam() {
408 408
         return $this->where("X-Spam-Flag NO");
409 409
     }
410 410
 
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
      * @return WhereQuery
413 413
      * @throws InvalidWhereQueryCriteriaException
414 414
      */
415
-    public function whereIsXSpam(){
415
+    public function whereIsXSpam() {
416 416
         return $this->where("X-Spam-Flag YES");
417 417
     }
418 418
 
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
      * @return WhereQuery
423 423
      * @throws InvalidWhereQueryCriteriaException
424 424
      */
425
-    public function whereLanguage($country_code){
425
+    public function whereLanguage($country_code) {
426 426
         return $this->where("Content-Language $country_code");
427 427
     }
428 428
 }
429 429
\ No newline at end of file
Please login to merge, or discard this patch.
src/IMAP/Providers/LaravelServiceProvider.php 2 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
      * If however the default account is missing a parameter the package default account parameter will be used.
59 59
      * This can be disabled by setting imap.default in your config file to 'false'
60 60
      */
61
-    private function setVendorConfig(){
61
+    private function setVendorConfig() {
62 62
 
63 63
         $config_key = 'imap';
64 64
         $path = __DIR__.'/../../config/'.$config_key.'.php';
@@ -70,17 +70,17 @@  discard block
 block discarded – undo
70 70
 
71 71
         $config = $this->app['config']->get($config_key);
72 72
 
73
-        if(is_array($config)){
74
-            if(isset($config['default'])){
75
-                if(isset($config['accounts']) && $config['default'] != false){
73
+        if (is_array($config)) {
74
+            if (isset($config['default'])) {
75
+                if (isset($config['accounts']) && $config['default'] != false) {
76 76
 
77 77
                     $default_config = $vendor_config['accounts']['default'];
78
-                    if(isset($config['accounts'][$config['default']])){
78
+                    if (isset($config['accounts'][$config['default']])) {
79 79
                         $default_config = array_merge($default_config, $config['accounts'][$config['default']]);
80 80
                     }
81 81
 
82
-                    if(is_array($config['accounts'])){
83
-                        foreach($config['accounts'] as $account_key => $account){
82
+                    if (is_array($config['accounts'])) {
83
+                        foreach ($config['accounts'] as $account_key => $account) {
84 84
                             $config['accounts'][$account_key] = array_merge($default_config, $account);
85 85
                         }
86 86
                     }
@@ -114,23 +114,23 @@  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)) $base = empty($base) ? array() : array($base);
118 118
 
119
-        foreach($arrays as $append) {
119
+        foreach ($arrays as $append) {
120 120
 
121
-            if(!is_array($append)) $append = array($append);
121
+            if (!is_array($append)) $append = array($append);
122 122
 
123
-            foreach($append as $key => $value) {
123
+            foreach ($append as $key => $value) {
124 124
 
125
-                if(!array_key_exists($key, $base) and !is_numeric($key)) {
125
+                if (!array_key_exists($key, $base) and !is_numeric($key)) {
126 126
                     $base[$key] = $append[$key];
127 127
                     continue;
128 128
                 }
129 129
 
130
-                if(is_array($value) or is_array($base[$key])) {
130
+                if (is_array($value) or is_array($base[$key])) {
131 131
                     $base[$key] = $this->array_merge_recursive_distinct($base[$key], $append[$key]);
132
-                } else if(is_numeric($key)) {
133
-                    if(!in_array($value, $base)) $base[] = $value;
132
+                } else if (is_numeric($key)) {
133
+                    if (!in_array($value, $base)) $base[] = $value;
134 134
                 } else {
135 135
                     $base[$key] = $value;
136 136
                 }
Please login to merge, or discard this 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/Client.php 3 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -355,14 +355,14 @@
 block discarded – undo
355 355
         return $status;
356 356
     }
357 357
     
358
-     /**
359
-     * Delete Folder
360
-     * @param string $name
361
-      * @param boolean $expunge
362
-     *
363
-     * @return bool
364
-     * @throws ConnectionFailedException
365
-     */
358
+        /**
359
+         * Delete Folder
360
+         * @param string $name
361
+         * @param boolean $expunge
362
+         *
363
+         * @return bool
364
+         * @throws ConnectionFailedException
365
+         */
366 366
     public function deleteFolder($name, $expunge = true) {
367 367
         $this->checkConnection();
368 368
         $status = imap_deletemailbox($this->getConnection(), $this->getAddress() . imap_utf7_encode($name));
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.
Spacing   +37 added lines, -37 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
     }
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
     public function openFolder($folder_path, $attempts = 3) {
390 390
         $this->checkConnection();
391 391
 
392
-        if(property_exists($folder_path, 'path')) {
392
+        if (property_exists($folder_path, 'path')) {
393 393
             $folder_path = $folder_path->path;
394 394
         }
395 395
 
@@ -410,8 +410,8 @@  discard block
 block discarded – undo
410 410
      */
411 411
     public function createFolder($name, $expunge = true) {
412 412
         $this->checkConnection();
413
-        $status = imap_createmailbox($this->getConnection(), $this->getAddress() . imap_utf7_encode($name));
414
-        if($expunge) $this->expunge();
413
+        $status = imap_createmailbox($this->getConnection(), $this->getAddress().imap_utf7_encode($name));
414
+        if ($expunge) $this->expunge();
415 415
 
416 416
         return $status;
417 417
     }
@@ -427,8 +427,8 @@  discard block
 block discarded – undo
427 427
      */
428 428
     public function renameFolder($old_name, $new_name, $expunge = true) {
429 429
         $this->checkConnection();
430
-        $status = imap_renamemailbox($this->getConnection(), $this->getAddress() . imap_utf7_encode($old_name), $this->getAddress() . imap_utf7_encode($new_name));
431
-        if($expunge) $this->expunge();
430
+        $status = imap_renamemailbox($this->getConnection(), $this->getAddress().imap_utf7_encode($old_name), $this->getAddress().imap_utf7_encode($new_name));
431
+        if ($expunge) $this->expunge();
432 432
 
433 433
         return $status;
434 434
     }
@@ -443,8 +443,8 @@  discard block
 block discarded – undo
443 443
      */
444 444
     public function deleteFolder($name, $expunge = true) {
445 445
         $this->checkConnection();
446
-        $status = imap_deletemailbox($this->getConnection(), $this->getAddress() . imap_utf7_encode($name));
447
-        if($expunge) $this->expunge();
446
+        $status = imap_deletemailbox($this->getConnection(), $this->getAddress().imap_utf7_encode($name));
447
+        if ($expunge) $this->expunge();
448 448
 
449 449
         return $status;
450 450
     }
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
         if (!$this->validate_cert) {
539 539
             $address .= '/novalidate-cert';
540 540
         }
541
-        if (in_array($this->encryption,['tls', 'notls', 'ssl'])) {
541
+        if (in_array($this->encryption, ['tls', 'notls', 'ssl'])) {
542 542
             $address .= '/'.$this->encryption;
543 543
         }
544 544
 
@@ -659,7 +659,7 @@  discard block
 block discarded – undo
659 659
      * @throws InvalidImapTimeoutTypeException
660 660
      */
661 661
     public function setTimeout($type, $timeout) {
662
-        if(0 <= $type && $type <= 4) {
662
+        if (0 <= $type && $type <= 4) {
663 663
             return imap_timeout($type, $timeout);
664 664
         }
665 665
 
@@ -673,8 +673,8 @@  discard block
 block discarded – undo
673 673
      * @return mixed
674 674
      * @throws InvalidImapTimeoutTypeException
675 675
      */
676
-    public function getTimeout($type){
677
-        if(0 <= $type && $type <= 4) {
676
+    public function getTimeout($type) {
677
+        if (0 <= $type && $type <= 4) {
678 678
             return imap_timeout($type);
679 679
         }
680 680
 
@@ -684,7 +684,7 @@  discard block
 block discarded – undo
684 684
     /**
685 685
      * @return string
686 686
      */
687
-    public function getDefaultMessageMask(){
687
+    public function getDefaultMessageMask() {
688 688
         return $this->default_message_mask;
689 689
     }
690 690
 
@@ -695,7 +695,7 @@  discard block
 block discarded – undo
695 695
      * @throws MaskNotFoundException
696 696
      */
697 697
     public function setDefaultMessageMask($mask) {
698
-        if(class_exists($mask)) {
698
+        if (class_exists($mask)) {
699 699
             $this->default_message_mask = $mask;
700 700
 
701 701
             return $this;
@@ -707,7 +707,7 @@  discard block
 block discarded – undo
707 707
     /**
708 708
      * @return string
709 709
      */
710
-    public function getDefaultAttachmentMask(){
710
+    public function getDefaultAttachmentMask() {
711 711
         return $this->default_attachment_mask;
712 712
     }
713 713
 
@@ -718,7 +718,7 @@  discard block
 block discarded – undo
718 718
      * @throws MaskNotFoundException
719 719
      */
720 720
     public function setDefaultAttachmentMask($mask) {
721
-        if(class_exists($mask)) {
721
+        if (class_exists($mask)) {
722 722
             $this->default_attachment_mask = $mask;
723 723
 
724 724
             return $this;
@@ -732,7 +732,7 @@  discard block
 block discarded – undo
732 732
      *
733 733
      * @return Folder
734 734
      */
735
-    public function getFolderPath(){
735
+    public function getFolderPath() {
736 736
         return $this->active_folder;
737 737
     }
738 738
 }
Please login to merge, or discard this patch.
src/IMAP/Folder.php 2 patches
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -370,7 +370,9 @@  discard block
 block discarded – undo
370 370
      */
371 371
     public function delete($expunge = true) {
372 372
         $status = imap_deletemailbox($this->client->getConnection(), $this->path);
373
-        if($expunge) $this->client->expunge();
373
+        if($expunge) {
374
+            $this->client->expunge();
375
+        }
374 376
 
375 377
         return $status;
376 378
     }
@@ -387,7 +389,9 @@  discard block
 block discarded – undo
387 389
      */
388 390
     public function move($target_mailbox, $expunge = true) {
389 391
         $status = imap_renamemailbox($this->client->getConnection(), $this->path, $target_mailbox);
390
-        if($expunge) $this->client->expunge();
392
+        if($expunge) {
393
+            $this->client->expunge();
394
+        }
391 395
 
392 396
         return $status;
393 397
     }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 
119 119
         $this->setDelimiter($structure->delimiter);
120 120
         $this->path      = $structure->name;
121
-        $this->full_name  = $this->decodeName($structure->name);
121
+        $this->full_name = $this->decodeName($structure->name);
122 122
         $this->name      = $this->getSimpleName($this->delimiter, $this->full_name);
123 123
 
124 124
         $this->parseAttributes($structure->attributes);
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
      * @return WhereQuery
132 132
      * @throws Exceptions\ConnectionFailedException
133 133
      */
134
-    public function query($charset = 'UTF-8'){
134
+    public function query($charset = 'UTF-8') {
135 135
         $this->getClient()->checkConnection();
136 136
         $this->getClient()->openFolder($this->path);
137 137
 
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
      * @inheritdoc self::query($charset = 'UTF-8')
143 143
      * @throws Exceptions\ConnectionFailedException
144 144
      */
145
-    public function search($charset = 'UTF-8'){
145
+    public function search($charset = 'UTF-8') {
146 146
         return $this->query($charset);
147 147
     }
148 148
 
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
      * @inheritdoc self::query($charset = 'UTF-8')
151 151
      * @throws Exceptions\ConnectionFailedException
152 152
      */
153
-    public function messages($charset = 'UTF-8'){
153
+    public function messages($charset = 'UTF-8') {
154 154
         return $this->query($charset);
155 155
     }
156 156
 
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
      * @deprecated 1.2.1:2.0.0 No longer needed. Use Folder::query() instead
316 316
      * @see Folder::query()
317 317
      */
318
-    public function searchMessages(array $where, $fetch_options = null, $fetch_body = true,  $fetch_attachment = true, $fetch_flags = true, $limit = null, $page = 1, $charset = "UTF-8") {
318
+    public function searchMessages(array $where, $fetch_options = null, $fetch_body = true, $fetch_attachment = true, $fetch_flags = true, $limit = null, $page = 1, $charset = "UTF-8") {
319 319
         $this->getClient()->checkConnection();
320 320
 
321 321
         return $this->query($charset)->where($where)->setFetchOptions($fetch_options)->setFetchBody($fetch_body)
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
      */
375 375
     public function delete($expunge = true) {
376 376
         $status = imap_deletemailbox($this->client->getConnection(), $this->path);
377
-        if($expunge) $this->client->expunge();
377
+        if ($expunge) $this->client->expunge();
378 378
 
379 379
         return $status;
380 380
     }
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
      */
392 392
     public function move($target_mailbox, $expunge = true) {
393 393
         $status = imap_renamemailbox($this->client->getConnection(), $this->path, $target_mailbox);
394
-        if($expunge) $this->client->expunge();
394
+        if ($expunge) $this->client->expunge();
395 395
 
396 396
         return $status;
397 397
     }
@@ -440,8 +440,8 @@  discard block
 block discarded – undo
440 440
     /**
441 441
      * @param $delimiter
442 442
      */
443
-    public function setDelimiter($delimiter){
444
-        if(in_array($delimiter, [null, '', ' ', false]) === true) {
443
+    public function setDelimiter($delimiter) {
444
+        if (in_array($delimiter, [null, '', ' ', false]) === true) {
445 445
             $delimiter = config('imap.options.delimiter', '/');
446 446
         }
447 447
 
Please login to merge, or discard this patch.
src/IMAP/Attachment.php 2 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
         $this->part_number = ($part_number) ? $part_number : $this->part_number;
94 94
 
95 95
         $default_mask = $this->oMessage->getClient()->getDefaultAttachmentMask();
96
-        if($default_mask != null) {
96
+        if ($default_mask != null) {
97 97
             $this->mask = $default_mask;
98 98
         }
99 99
 
@@ -110,10 +110,10 @@  discard block
 block discarded – undo
110 110
      * @throws MethodNotFoundException
111 111
      */
112 112
     public function __call($method, $arguments) {
113
-        if(strtolower(substr($method, 0, 3)) === 'get') {
113
+        if (strtolower(substr($method, 0, 3)) === 'get') {
114 114
             $name = snake_case(substr($method, 3));
115 115
 
116
-            if(isset($this->attributes[$name])) {
116
+            if (isset($this->attributes[$name])) {
117 117
                 return $this->attributes[$name];
118 118
             }
119 119
 
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
      * @return mixed|null
148 148
      */
149 149
     public function __get($name) {
150
-        if(isset($this->attributes[$name])) {
150
+        if (isset($this->attributes[$name])) {
151 151
             return $this->attributes[$name];
152 152
         }
153 153
 
@@ -255,9 +255,9 @@  discard block
 block discarded – undo
255 255
      * @param $name
256 256
      */
257 257
     public function setName($name) {
258
-        if($this->config['decoder']['message']['subject'] === 'utf-8') {
258
+        if ($this->config['decoder']['message']['subject'] === 'utf-8') {
259 259
             $this->name = imap_utf8($name);
260
-        }else{
260
+        } else {
261 261
             $this->name = mb_decode_mimeheader($name);
262 262
         }
263 263
     }
@@ -277,28 +277,28 @@  discard block
 block discarded – undo
277 277
     /**
278 278
      * @return string|null
279 279
      */
280
-    public function getMimeType(){
280
+    public function getMimeType() {
281 281
         return (new \finfo())->buffer($this->getContent(), FILEINFO_MIME_TYPE);
282 282
     }
283 283
 
284 284
     /**
285 285
      * @return string|null
286 286
      */
287
-    public function getExtension(){
287
+    public function getExtension() {
288 288
         return ExtensionGuesser::getInstance()->guess($this->getMimeType());
289 289
     }
290 290
 
291 291
     /**
292 292
      * @return array
293 293
      */
294
-    public function getAttributes(){
294
+    public function getAttributes() {
295 295
         return $this->attributes;
296 296
     }
297 297
 
298 298
     /**
299 299
      * @return Message
300 300
      */
301
-    public function getMessage(){
301
+    public function getMessage() {
302 302
         return $this->oMessage;
303 303
     }
304 304
 
@@ -306,8 +306,8 @@  discard block
 block discarded – undo
306 306
      * @param $mask
307 307
      * @return $this
308 308
      */
309
-    public function setMask($mask){
310
-        if(class_exists($mask)){
309
+    public function setMask($mask) {
310
+        if (class_exists($mask)) {
311 311
             $this->mask = $mask;
312 312
         }
313 313
 
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
     /**
318 318
      * @return string
319 319
      */
320
-    public function getMask(){
320
+    public function getMask() {
321 321
         return $this->mask;
322 322
     }
323 323
 
@@ -328,9 +328,9 @@  discard block
 block discarded – undo
328 328
      * @return mixed
329 329
      * @throws MaskNotFoundException
330 330
      */
331
-    public function mask($mask = null){
331
+    public function mask($mask = null) {
332 332
         $mask = $mask !== null ? $mask : $this->mask;
333
-        if(class_exists($mask)){
333
+        if (class_exists($mask)) {
334 334
             return new $mask($this);
335 335
         }
336 336
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
             }
119 119
 
120 120
             return null;
121
-        }elseif (strtolower(substr($method, 0, 3)) === 'set') {
121
+        } elseif (strtolower(substr($method, 0, 3)) === 'set') {
122 122
             $name = snake_case(substr($method, 3));
123 123
 
124 124
             $this->attributes[$name] = array_pop($arguments);
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
     public function setName($name) {
258 258
         if($this->config['decoder']['message']['subject'] === 'utf-8') {
259 259
             $this->name = imap_utf8($name);
260
-        }else{
260
+        } else{
261 261
             $this->name = mb_decode_mimeheader($name);
262 262
         }
263 263
     }
Please login to merge, or discard this patch.
src/IMAP/Support/Masks/Mask.php 2 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@
 block discarded – undo
60 60
                 return $this->attributes[$name];
61 61
             }
62 62
 
63
-        }elseif (strtolower(substr($method, 0, 3)) === 'set') {
63
+        } elseif (strtolower(substr($method, 0, 3)) === 'set') {
64 64
             $name = snake_case(substr($method, 3));
65 65
 
66 66
             if(isset($this->attributes[$name])) {
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
     public function __construct($parent) {
39 39
         $this->parent = $parent;
40 40
 
41
-        if(method_exists($this->parent, 'getAttributes')){
41
+        if (method_exists($this->parent, 'getAttributes')) {
42 42
             $this->attributes = array_merge($this->attributes, $this->parent->getAttributes());
43 43
         }
44 44
 
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
     /**
49 49
      * Boot method made to be used by any custom mask
50 50
      */
51
-    protected function boot(){}
51
+    protected function boot() {}
52 52
 
53 53
     /**
54 54
      * Call dynamic attribute setter and getter methods and inherit the parent calls
@@ -59,17 +59,17 @@  discard block
 block discarded – undo
59 59
      * @throws MethodNotFoundException
60 60
      */
61 61
     public function __call($method, $arguments) {
62
-        if(strtolower(substr($method, 0, 3)) === 'get') {
62
+        if (strtolower(substr($method, 0, 3)) === 'get') {
63 63
             $name = snake_case(substr($method, 3));
64 64
 
65
-            if(isset($this->attributes[$name])) {
65
+            if (isset($this->attributes[$name])) {
66 66
                 return $this->attributes[$name];
67 67
             }
68 68
 
69 69
         }elseif (strtolower(substr($method, 0, 3)) === 'set') {
70 70
             $name = snake_case(substr($method, 3));
71 71
 
72
-            if(isset($this->attributes[$name])) {
72
+            if (isset($this->attributes[$name])) {
73 73
                 $this->attributes[$name] = array_pop($arguments);
74 74
 
75 75
                 return $this->attributes[$name];
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 
78 78
         }
79 79
 
80
-        if(method_exists($this->parent, $method) === true){
80
+        if (method_exists($this->parent, $method) === true) {
81 81
             return call_user_func_array([$this->parent, $method], $arguments);
82 82
         }
83 83
 
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
      * @return mixed|null
103 103
      */
104 104
     public function __get($name) {
105
-        if(isset($this->attributes[$name])) {
105
+        if (isset($this->attributes[$name])) {
106 106
             return $this->attributes[$name];
107 107
         }
108 108
 
@@ -112,14 +112,14 @@  discard block
 block discarded – undo
112 112
     /**
113 113
      * @return mixed
114 114
      */
115
-    public function getParent(){
115
+    public function getParent() {
116 116
         return $this->parent;
117 117
     }
118 118
 
119 119
     /**
120 120
      * @return array
121 121
      */
122
-    public function getAttributes(){
122
+    public function getAttributes() {
123 123
         return $this->attributes;
124 124
     }
125 125
 
Please login to merge, or discard this patch.
src/IMAP/Support/Masks/MessageMask.php 2 patches
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.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
      * Get the message html body
30 30
      * @return null
31 31
      */
32
-    public function getHtmlBody(){
32
+    public function getHtmlBody() {
33 33
         $bodies = $this->parent->getBodies();
34 34
         if (!isset($bodies['html'])) {
35 35
             return null;
@@ -46,15 +46,15 @@  discard block
 block discarded – undo
46 46
      */
47 47
     public function getCustomHTMLBody($callback = false) {
48 48
         $body = $this->getHtmlBody();
49
-        if($body === null) return null;
49
+        if ($body === null) return null;
50 50
 
51 51
         if ($callback !== false) {
52 52
             $aAttachment = $this->parent->getAttachments();
53 53
             $aAttachment->each(function($oAttachment) use(&$body, $callback) {
54 54
                 /** @var Attachment $oAttachment */
55
-                if(is_callable($callback)) {
55
+                if (is_callable($callback)) {
56 56
                     $body = $callback($body, $oAttachment);
57
-                }elseif(is_string($callback)) {
57
+                }elseif (is_string($callback)) {
58 58
                     call_user_func($callback, [$body, $oAttachment]);
59 59
                 }
60 60
             });
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
      * @return string|null
71 71
      */
72 72
     public function getHTMLBodyWithEmbeddedBase64Images() {
73
-        return $this->getCustomHTMLBody(function($body, $oAttachment){
73
+        return $this->getCustomHTMLBody(function($body, $oAttachment) {
74 74
             /** @var \Webklex\IMAP\Attachment $oAttachment */
75 75
             if ($oAttachment->id && $oAttachment->getImgSrc() != null) {
76 76
                 $body = str_replace('cid:'.$oAttachment->id, $oAttachment->getImgSrc(), $body);
Please login to merge, or discard this patch.
src/IMAP/Query/Query.php 2 patches
Braces   +11 added lines, -5 removed lines patch added patch discarded remove patch
@@ -65,7 +65,9 @@  discard block
 block discarded – undo
65 65
     public function __construct(Client $client, $charset = 'UTF-8') {
66 66
         $this->setClient($client);
67 67
 
68
-        if(config('imap.options.fetch') === IMAP::FT_PEEK) $this->leaveUnread();
68
+        if(config('imap.options.fetch') === IMAP::FT_PEEK) {
69
+            $this->leaveUnread();
70
+        }
69 71
 
70 72
         $this->charset = $charset;
71 73
         $this->query = collect();
@@ -101,7 +103,9 @@  discard block
 block discarded – undo
101 103
      * @throws MessageSearchValidationException
102 104
      */
103 105
     protected function parse_date($date) {
104
-        if($date instanceof \Carbon\Carbon) return $date;
106
+        if($date instanceof \Carbon\Carbon) {
107
+            return $date;
108
+        }
105 109
 
106 110
         try {
107 111
             $date = Carbon::parse($date);
@@ -152,7 +156,7 @@  discard block
 block discarded – undo
152 156
              */
153 157
             if($this->getCharset() === null){
154 158
                 $available_messages = imap_search($this->getClient()->getConnection(), $this->getRawQuery(), IMAP::SE_UID);
155
-            }else{
159
+            } else{
156 160
                 $available_messages = imap_search($this->getClient()->getConnection(), $this->getRawQuery(), IMAP::SE_UID, $this->getCharset());
157 161
             }
158 162
 
@@ -204,7 +208,7 @@  discard block
 block discarded – undo
204 208
             } else {
205 209
                 if($statement[1] === null){
206 210
                     $query .= $statement[0];
207
-                }else{
211
+                } else{
208 212
                     $query .= $statement[0].' "'.$statement[1].'"';
209 213
                 }
210 214
             }
@@ -234,7 +238,9 @@  discard block
 block discarded – undo
234 238
      * @return $this
235 239
      */
236 240
     public function limit($limit, $page = 1) {
237
-        if($page >= 1) $this->page = $page;
241
+        if($page >= 1) {
242
+            $this->page = $page;
243
+        }
238 244
         $this->limit = $limit;
239 245
 
240 246
         return $this;
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
     public function __construct(Client $client, $charset = 'UTF-8') {
66 66
         $this->setClient($client);
67 67
 
68
-        if(config('imap.options.fetch') === IMAP::FT_PEEK) $this->leaveUnread();
68
+        if (config('imap.options.fetch') === IMAP::FT_PEEK) $this->leaveUnread();
69 69
 
70 70
         $this->charset = $charset;
71 71
         $this->query = collect();
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
     /**
76 76
      * Instance boot method for additional functionality
77 77
      */
78
-    protected function boot(){}
78
+    protected function boot() {}
79 79
 
80 80
     /**
81 81
      * Parse a given value
@@ -83,8 +83,8 @@  discard block
 block discarded – undo
83 83
      *
84 84
      * @return string
85 85
      */
86
-    protected function parse_value($value){
87
-        switch(true){
86
+    protected function parse_value($value) {
87
+        switch (true) {
88 88
             case $value instanceof \Carbon\Carbon:
89 89
                 $value = $value->format('d M y');
90 90
                 break;
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
      * @throws MessageSearchValidationException
102 102
      */
103 103
     protected function parse_date($date) {
104
-        if($date instanceof \Carbon\Carbon) return $date;
104
+        if ($date instanceof \Carbon\Carbon) return $date;
105 105
 
106 106
         try {
107 107
             $date = Carbon::parse($date);
@@ -150,9 +150,9 @@  discard block
 block discarded – undo
150 150
              * Don't set the charset if it isn't used - prevent strange outlook mail server errors
151 151
              * @see https://github.com/Webklex/laravel-imap/issues/100
152 152
              */
153
-            if($this->getCharset() === null){
153
+            if ($this->getCharset() === null) {
154 154
                 $available_messages = imap_search($this->getClient()->getConnection(), $this->getRawQuery(), IMAP::SE_UID);
155
-            }else{
155
+            } else {
156 156
                 $available_messages = imap_search($this->getClient()->getConnection(), $this->getRawQuery(), IMAP::SE_UID, $this->getCharset());
157 157
             }
158 158
 
@@ -161,15 +161,15 @@  discard block
 block discarded – undo
161 161
                 $available_messages = collect($available_messages);
162 162
                 $options = config('imap.options');
163 163
 
164
-                if(strtolower($options['fetch_order']) === 'desc'){
164
+                if (strtolower($options['fetch_order']) === 'desc') {
165 165
                     $available_messages = $available_messages->reverse();
166 166
                 }
167 167
 
168
-                $query =& $this;
168
+                $query = & $this;
169 169
 
170 170
                 $available_messages->forPage($this->page, $this->limit)->each(function($msgno, $msglist) use(&$messages, $options, $query) {
171 171
                     $oMessage = new Message($msgno, $msglist, $query->getClient(), $query->getFetchOptions(), $query->getFetchBody(), $query->getFetchAttachment(), $query->getFetchFlags());
172
-                    switch ($options['message_key']){
172
+                    switch ($options['message_key']) {
173 173
                         case 'number':
174 174
                             $message_key = $oMessage->getMessageNo();
175 175
                             break;
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
      * @return \Illuminate\Pagination\LengthAwarePaginator
201 201
      * @throws GetMessagesFailedException
202 202
      */
203
-    public function paginate($per_page = 5, $page = null, $page_name = 'imap_page'){
203
+    public function paginate($per_page = 5, $page = null, $page_name = 'imap_page') {
204 204
         $this->page = $page > $this->page ? $page : $this->page;
205 205
         $this->limit = $per_page;
206 206
 
@@ -218,9 +218,9 @@  discard block
 block discarded – undo
218 218
             if (count($statement) == 1) {
219 219
                 $query .= $statement[0];
220 220
             } else {
221
-                if($statement[1] === null){
221
+                if ($statement[1] === null) {
222 222
                     $query .= $statement[0];
223
-                }else{
223
+                } else {
224 224
                     $query .= $statement[0].' "'.$statement[1].'"';
225 225
                 }
226 226
             }
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
      * @return $this
251 251
      */
252 252
     public function limit($limit, $page = 1) {
253
-        if($page >= 1) $this->page = $page;
253
+        if ($page >= 1) $this->page = $page;
254 254
         $this->limit = $limit;
255 255
 
256 256
         return $this;
Please login to merge, or discard this patch.
examples/custom_message_mask.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
      * New custom method which can be called through a mask
17 17
      * @return string
18 18
      */
19
-    public function token(){
19
+    public function token() {
20 20
         return implode('-', [$this->message_id, $this->uid, $this->message_no]);
21 21
     }
22 22
 
Please login to merge, or discard this patch.