Passed
Push — master ( c4fc9a...ad6b77 )
by Malte
02:37
created
src/Query/Query.php 2 patches
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 
96 96
         if (ClientManager::get('options.fetch_order') === 'desc') {
97 97
             $this->fetch_order = 'desc';
98
-        } else {
98
+        }else {
99 99
             $this->fetch_order = 'asc';
100 100
         }
101 101
 
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
                 break;
127 127
         }
128 128
 
129
-        return (string)$value;
129
+        return (string) $value;
130 130
     }
131 131
 
132 132
     /**
@@ -158,11 +158,11 @@  discard block
 block discarded – undo
158 158
         $this->query->each(function($statement) use (&$query) {
159 159
             if (count($statement) == 1) {
160 160
                 $query .= $statement[0];
161
-            } else {
161
+            }else {
162 162
                 if ($statement[1] === null) {
163 163
                     $query .= $statement[0];
164
-                } else {
165
-                    $query .= $statement[0] . ' "' . $statement[1] . '"';
164
+                }else {
165
+                    $query .= $statement[0].' "'.$statement[1].'"';
166 166
                 }
167 167
             }
168 168
             $query .= ' ';
@@ -247,18 +247,18 @@  discard block
 block discarded – undo
247 247
      * @throws GetMessagesFailedException
248 248
      * @throws ReflectionException
249 249
      */
250
-    protected function make($uid, $msglist, $header, $content, $flags){
250
+    protected function make($uid, $msglist, $header, $content, $flags) {
251 251
         try {
252 252
             return Message::make($uid, $msglist, $this->getClient(), $header, $content, $flags, $this->getFetchOptions(), $this->sequence);
253
-        }catch (MessageNotFoundException $e) {
253
+        } catch (MessageNotFoundException $e) {
254 254
             $this->setError($uid, $e);
255
-        }catch (RuntimeException $e) {
255
+        } catch (RuntimeException $e) {
256 256
             $this->setError($uid, $e);
257
-        }catch (MessageFlagException $e) {
257
+        } catch (MessageFlagException $e) {
258 258
             $this->setError($uid, $e);
259
-        }catch (InvalidMessageDateException $e) {
259
+        } catch (InvalidMessageDateException $e) {
260 260
             $this->setError($uid, $e);
261
-        }catch (MessageContentFetchingException $e) {
261
+        } catch (MessageContentFetchingException $e) {
262 262
             $this->setError($uid, $e);
263 263
         }
264 264
 
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
      *
276 276
      * @return string
277 277
      */
278
-    protected function getMessageKey($message_key, $msglist, $message){
278
+    protected function getMessageKey($message_key, $msglist, $message) {
279 279
         switch ($message_key) {
280 280
             case 'number':
281 281
                 $key = $message->getMessageNo();
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
                 $key = $message->getMessageId();
291 291
                 break;
292 292
         }
293
-        return (string)$key;
293
+        return (string) $key;
294 294
     }
295 295
 
296 296
     /**
@@ -782,7 +782,7 @@  discard block
 block discarded – undo
782 782
      *
783 783
      * @return boolean
784 784
      */
785
-    public function hasErrors($uid = null){
785
+    public function hasErrors($uid = null) {
786 786
         if ($uid !== null) {
787 787
             return $this->hasError($uid);
788 788
         }
@@ -795,7 +795,7 @@  discard block
 block discarded – undo
795 795
      *
796 796
      * @return boolean
797 797
      */
798
-    public function hasError($uid){
798
+    public function hasError($uid) {
799 799
         return isset($this->errors[$uid]);
800 800
     }
801 801
 
@@ -804,7 +804,7 @@  discard block
 block discarded – undo
804 804
      *
805 805
      * @return array
806 806
      */
807
-    public function errors(){
807
+    public function errors() {
808 808
         return $this->getErrors();
809 809
     }
810 810
 
@@ -813,7 +813,7 @@  discard block
 block discarded – undo
813 813
      *
814 814
      * @return array
815 815
      */
816
-    public function getErrors(){
816
+    public function getErrors() {
817 817
         return $this->errors;
818 818
     }
819 819
 
@@ -823,7 +823,7 @@  discard block
 block discarded – undo
823 823
      *
824 824
      * @return Exception|null
825 825
      */
826
-    public function error($uid){
826
+    public function error($uid) {
827 827
         return $this->getError($uid);
828 828
     }
829 829
 
@@ -833,7 +833,7 @@  discard block
 block discarded – undo
833 833
      *
834 834
      * @return Exception|null
835 835
      */
836
-    public function getError($uid){
836
+    public function getError($uid) {
837 837
         if ($this->hasError($uid)) {
838 838
             return $this->errors[$uid];
839 839
         }
Please login to merge, or discard this patch.
Braces   +14 added lines, -8 removed lines patch added patch discarded remove patch
@@ -91,7 +91,9 @@  discard block
 block discarded – undo
91 91
         $this->setClient($client);
92 92
 
93 93
         $this->sequence = ClientManager::get('options.sequence', IMAP::ST_MSGN);
94
-        if (ClientManager::get('options.fetch') === IMAP::FT_PEEK) $this->leaveUnread();
94
+        if (ClientManager::get('options.fetch') === IMAP::FT_PEEK) {
95
+            $this->leaveUnread();
96
+        }
95 97
 
96 98
         if (ClientManager::get('options.fetch_order') === 'desc') {
97 99
             $this->fetch_order = 'desc';
@@ -137,7 +139,9 @@  discard block
 block discarded – undo
137 139
      * @throws MessageSearchValidationException
138 140
      */
139 141
     protected function parse_date($date) {
140
-        if ($date instanceof Carbon) return $date;
142
+        if ($date instanceof Carbon) {
143
+            return $date;
144
+        }
141 145
 
142 146
         try {
143 147
             $date = Carbon::parse($date);
@@ -250,15 +254,15 @@  discard block
 block discarded – undo
250 254
     protected function make($uid, $msglist, $header, $content, $flags){
251 255
         try {
252 256
             return Message::make($uid, $msglist, $this->getClient(), $header, $content, $flags, $this->getFetchOptions(), $this->sequence);
253
-        }catch (MessageNotFoundException $e) {
257
+        } catch (MessageNotFoundException $e) {
254 258
             $this->setError($uid, $e);
255
-        }catch (RuntimeException $e) {
259
+        } catch (RuntimeException $e) {
256 260
             $this->setError($uid, $e);
257
-        }catch (MessageFlagException $e) {
261
+        } catch (MessageFlagException $e) {
258 262
             $this->setError($uid, $e);
259
-        }catch (InvalidMessageDateException $e) {
263
+        } catch (InvalidMessageDateException $e) {
260 264
             $this->setError($uid, $e);
261
-        }catch (MessageContentFetchingException $e) {
265
+        } catch (MessageContentFetchingException $e) {
262 266
             $this->setError($uid, $e);
263 267
         }
264 268
 
@@ -511,7 +515,9 @@  discard block
 block discarded – undo
511 515
      * @return $this
512 516
      */
513 517
     public function limit($limit, $page = 1) {
514
-        if ($page >= 1) $this->page = $page;
518
+        if ($page >= 1) {
519
+            $this->page = $page;
520
+        }
515 521
         $this->limit = $limit;
516 522
 
517 523
         return $this;
Please login to merge, or discard this patch.
src/Attribute.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
      *
58 58
      * @return string
59 59
      */
60
-    public function toString(){
60
+    public function toString() {
61 61
         return $this->__toString();
62 62
     }
63 63
 
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
      *
67 67
      * @return array
68 68
      */
69
-    public function __serialize(){
69
+    public function __serialize() {
70 70
         return $this->values;
71 71
     }
72 72
 
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
      *
76 76
      * @return array
77 77
      */
78
-    public function toArray(){
78
+    public function toArray() {
79 79
         return $this->__serialize();
80 80
     }
81 81
 
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
      *
85 85
      * @return Carbon|null
86 86
      */
87
-    public function toDate(){
87
+    public function toDate() {
88 88
         $date = $this->first();
89 89
         if ($date instanceof Carbon) return $date;
90 90
 
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
     public function offsetSet($key, $value) {
122 122
         if (is_null($key)) {
123 123
             $this->values[] = $value;
124
-        } else {
124
+        }else {
125 125
             $this->values[$key] = $value;
126 126
         }
127 127
     }
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
             if ($this->contains($value) === false) {
196 196
                 $this->values[] = $value;
197 197
             }
198
-        }else{
198
+        }else {
199 199
             $this->values[] = $value;
200 200
         }
201 201
     }
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
      *
207 207
      * @return Attribute
208 208
      */
209
-    public function setName($name){
209
+    public function setName($name) {
210 210
         $this->name = $name;
211 211
 
212 212
         return $this;
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
      *
218 218
      * @return string
219 219
      */
220
-    public function getName(){
220
+    public function getName() {
221 221
         return $this->name;
222 222
     }
223 223
 
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
      *
227 227
      * @return array
228 228
      */
229
-    public function get(){
229
+    public function get() {
230 230
         return $this->values;
231 231
     }
232 232
 
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
      *
236 236
      * @return array
237 237
      */
238
-    public function all(){
238
+    public function all() {
239 239
         return $this->get();
240 240
     }
241 241
 
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
      *
245 245
      * @return mixed|null
246 246
      */
247
-    public function first(){
247
+    public function first() {
248 248
         if ($this->offsetExists(0)) {
249 249
             return $this->values[0];
250 250
         }
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
      *
257 257
      * @return mixed|null
258 258
      */
259
-    public function last(){
259
+    public function last() {
260 260
         if (($cnt = $this->count()) > 0) {
261 261
             return $this->values[$cnt - 1];
262 262
         }
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
      *
269 269
      * @return int
270 270
      */
271
-    public function count(){
271
+    public function count() {
272 272
         return count($this->values);
273 273
     }
274 274
 }
275 275
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +5 added lines, -3 removed lines patch added patch discarded remove patch
@@ -86,7 +86,9 @@  discard block
 block discarded – undo
86 86
      */
87 87
     public function toDate(){
88 88
         $date = $this->first();
89
-        if ($date instanceof Carbon) return $date;
89
+        if ($date instanceof Carbon) {
90
+            return $date;
91
+        }
90 92
 
91 93
         return Carbon::parse($date);
92 94
     }
@@ -146,7 +148,7 @@  discard block
 block discarded – undo
146 148
     public function add($value, $strict = false) {
147 149
         if (is_array($value)) {
148 150
             return $this->merge($value, $strict);
149
-        }elseif ($value !== null) {
151
+        } elseif ($value !== null) {
150 152
             $this->attach($value, $strict);
151 153
         }
152 154
 
@@ -195,7 +197,7 @@  discard block
 block discarded – undo
195 197
             if ($this->contains($value) === false) {
196 198
                 $this->values[] = $value;
197 199
             }
198
-        }else{
200
+        } else{
199 201
             $this->values[] = $value;
200 202
         }
201 203
     }
Please login to merge, or discard this patch.
src/Client.php 2 patches
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -203,11 +203,11 @@  discard block
 block discarded – undo
203 203
      * @param array $config
204 204
      * @param array $default_config
205 205
      */
206
-    private function setAccountConfig($key, $config, $default_config){
206
+    private function setAccountConfig($key, $config, $default_config) {
207 207
         $value = $this->default_account_config[$key];
208
-        if(isset($config[$key])) {
208
+        if (isset($config[$key])) {
209 209
             $value = $config[$key];
210
-        }elseif(isset($default_config[$key])) {
210
+        }elseif (isset($default_config[$key])) {
211 211
             $value = $default_config[$key];
212 212
         }
213 213
         $this->$key = $value;
@@ -219,8 +219,8 @@  discard block
 block discarded – undo
219 219
      */
220 220
     protected function setEventsFromConfig($config) {
221 221
         $this->events = ClientManager::get("events");
222
-        if(isset($config['events'])){
223
-            foreach($config['events'] as $section => $events) {
222
+        if (isset($config['events'])) {
223
+            foreach ($config['events'] as $section => $events) {
224 224
                 $this->events[$section] = array_merge($this->events[$section], $events);
225 225
             }
226 226
         }
@@ -233,45 +233,45 @@  discard block
 block discarded – undo
233 233
      * @throws MaskNotFoundException
234 234
      */
235 235
     protected function setMaskFromConfig($config) {
236
-        $default_config  = ClientManager::get("masks");
236
+        $default_config = ClientManager::get("masks");
237 237
 
238
-        if(isset($config['masks'])){
239
-            if(isset($config['masks']['message'])) {
240
-                if(class_exists($config['masks']['message'])) {
238
+        if (isset($config['masks'])) {
239
+            if (isset($config['masks']['message'])) {
240
+                if (class_exists($config['masks']['message'])) {
241 241
                     $this->default_message_mask = $config['masks']['message'];
242
-                }else{
242
+                }else {
243 243
                     throw new MaskNotFoundException("Unknown mask provided: ".$config['masks']['message']);
244 244
                 }
245
-            }else{
246
-                if(class_exists($default_config['message'])) {
245
+            }else {
246
+                if (class_exists($default_config['message'])) {
247 247
                     $this->default_message_mask = $default_config['message'];
248
-                }else{
248
+                }else {
249 249
                     throw new MaskNotFoundException("Unknown mask provided: ".$default_config['message']);
250 250
                 }
251 251
             }
252
-            if(isset($config['masks']['attachment'])) {
253
-                if(class_exists($config['masks']['attachment'])) {
252
+            if (isset($config['masks']['attachment'])) {
253
+                if (class_exists($config['masks']['attachment'])) {
254 254
                     $this->default_attachment_mask = $config['masks']['attachment'];
255
-                }else{
255
+                }else {
256 256
                     throw new MaskNotFoundException("Unknown mask provided: ".$config['masks']['attachment']);
257 257
                 }
258
-            }else{
259
-                if(class_exists($default_config['attachment'])) {
258
+            }else {
259
+                if (class_exists($default_config['attachment'])) {
260 260
                     $this->default_attachment_mask = $default_config['attachment'];
261
-                }else{
261
+                }else {
262 262
                     throw new MaskNotFoundException("Unknown mask provided: ".$default_config['attachment']);
263 263
                 }
264 264
             }
265
-        }else{
266
-            if(class_exists($default_config['message'])) {
265
+        }else {
266
+            if (class_exists($default_config['message'])) {
267 267
                 $this->default_message_mask = $default_config['message'];
268
-            }else{
268
+            }else {
269 269
                 throw new MaskNotFoundException("Unknown mask provided: ".$default_config['message']);
270 270
             }
271 271
 
272
-            if(class_exists($default_config['attachment'])) {
272
+            if (class_exists($default_config['attachment'])) {
273 273
                 $this->default_attachment_mask = $default_config['attachment'];
274
-            }else{
274
+            }else {
275 275
                 throw new MaskNotFoundException("Unknown mask provided: ".$default_config['attachment']);
276 276
             }
277 277
         }
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
             $this->connection = new ImapProtocol($this->validate_cert, $this->encryption);
336 336
             $this->connection->setConnectionTimeout($this->timeout);
337 337
             $this->connection->setProxy($this->proxy);
338
-        }else{
338
+        }else {
339 339
             if (extension_loaded('imap') === false) {
340 340
                 throw new ConnectionFailedException("connection setup failed", 0, new ProtocolNotSupportedException($protocol." is an unsupported protocol"));
341 341
             }
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
 
409 409
         // Set delimiter to false to force selection via getFolderByName (maybe useful for uncommon folder names)
410 410
         $delimiter = is_null($delimiter) ? ClientManager::get('options.delimiter', "/") : $delimiter;
411
-        if (strpos($folder_name, (string)$delimiter) !== false) {
411
+        if (strpos($folder_name, (string) $delimiter) !== false) {
412 412
             return $this->getFolderByPath($folder_name);
413 413
         }
414 414
 
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
         $pattern = $parent_folder.($hierarchical ? '%' : '*');
461 461
         $items = $this->connection->folders('', $pattern);
462 462
 
463
-        if(is_array($items)){
463
+        if (is_array($items)) {
464 464
             foreach ($items as $folder_name => $item) {
465 465
                 $folder = new Folder($this, $folder_name, $item["delimiter"], $item["flags"]);
466 466
 
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
             }
476 476
 
477 477
             return $folders;
478
-        }else{
478
+        }else {
479 479
             throw new FolderFetchingException("failed to fetch any folders");
480 480
         }
481 481
     }
@@ -513,10 +513,10 @@  discard block
 block discarded – undo
513 513
         $this->checkConnection();
514 514
         $status = $this->connection->createFolder($folder);
515 515
 
516
-        if($expunge) $this->expunge();
516
+        if ($expunge) $this->expunge();
517 517
 
518 518
         $folder = $this->getFolder($folder);
519
-        if($status && $folder) {
519
+        if ($status && $folder) {
520 520
             $event = $this->getEvent("folder", "new");
521 521
             $event::dispatch($folder);
522 522
         }
@@ -542,7 +542,7 @@  discard block
 block discarded – undo
542 542
      *
543 543
      * @return string
544 544
      */
545
-    public function getFolderPath(){
545
+    public function getFolderPath() {
546 546
         return $this->active_folder;
547 547
     }
548 548
 
@@ -600,7 +600,7 @@  discard block
 block discarded – undo
600 600
      * @return int
601 601
      * @throws ConnectionFailedException
602 602
      */
603
-    public function getTimeout(){
603
+    public function getTimeout() {
604 604
         $this->checkConnection();
605 605
         return $this->connection->getConnectionTimeout();
606 606
     }
@@ -610,7 +610,7 @@  discard block
 block discarded – undo
610 610
      *
611 611
      * @return string
612 612
      */
613
-    public function getDefaultMessageMask(){
613
+    public function getDefaultMessageMask() {
614 614
         return $this->default_message_mask;
615 615
     }
616 616
 
@@ -620,7 +620,7 @@  discard block
 block discarded – undo
620 620
      *
621 621
      * @return array
622 622
      */
623
-    public function getDefaultEvents($section){
623
+    public function getDefaultEvents($section) {
624 624
         return $this->events[$section];
625 625
     }
626 626
 
@@ -632,7 +632,7 @@  discard block
 block discarded – undo
632 632
      * @throws MaskNotFoundException
633 633
      */
634 634
     public function setDefaultMessageMask($mask) {
635
-        if(class_exists($mask)) {
635
+        if (class_exists($mask)) {
636 636
             $this->default_message_mask = $mask;
637 637
 
638 638
             return $this;
@@ -646,7 +646,7 @@  discard block
 block discarded – undo
646 646
      *
647 647
      * @return string
648 648
      */
649
-    public function getDefaultAttachmentMask(){
649
+    public function getDefaultAttachmentMask() {
650 650
         return $this->default_attachment_mask;
651 651
     }
652 652
 
@@ -658,7 +658,7 @@  discard block
 block discarded – undo
658 658
      * @throws MaskNotFoundException
659 659
      */
660 660
     public function setDefaultAttachmentMask($mask) {
661
-        if(class_exists($mask)) {
661
+        if (class_exists($mask)) {
662 662
             $this->default_attachment_mask = $mask;
663 663
 
664 664
             return $this;
Please login to merge, or discard this patch.
Braces   +15 added lines, -13 removed lines patch added patch discarded remove patch
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
         $value = $this->default_account_config[$key];
208 208
         if(isset($config[$key])) {
209 209
             $value = $config[$key];
210
-        }elseif(isset($default_config[$key])) {
210
+        } elseif(isset($default_config[$key])) {
211 211
             $value = $default_config[$key];
212 212
         }
213 213
         $this->$key = $value;
@@ -239,39 +239,39 @@  discard block
 block discarded – undo
239 239
             if(isset($config['masks']['message'])) {
240 240
                 if(class_exists($config['masks']['message'])) {
241 241
                     $this->default_message_mask = $config['masks']['message'];
242
-                }else{
242
+                } else{
243 243
                     throw new MaskNotFoundException("Unknown mask provided: ".$config['masks']['message']);
244 244
                 }
245
-            }else{
245
+            } else{
246 246
                 if(class_exists($default_config['message'])) {
247 247
                     $this->default_message_mask = $default_config['message'];
248
-                }else{
248
+                } else{
249 249
                     throw new MaskNotFoundException("Unknown mask provided: ".$default_config['message']);
250 250
                 }
251 251
             }
252 252
             if(isset($config['masks']['attachment'])) {
253 253
                 if(class_exists($config['masks']['attachment'])) {
254 254
                     $this->default_attachment_mask = $config['masks']['attachment'];
255
-                }else{
255
+                } else{
256 256
                     throw new MaskNotFoundException("Unknown mask provided: ".$config['masks']['attachment']);
257 257
                 }
258
-            }else{
258
+            } else{
259 259
                 if(class_exists($default_config['attachment'])) {
260 260
                     $this->default_attachment_mask = $default_config['attachment'];
261
-                }else{
261
+                } else{
262 262
                     throw new MaskNotFoundException("Unknown mask provided: ".$default_config['attachment']);
263 263
                 }
264 264
             }
265
-        }else{
265
+        } else{
266 266
             if(class_exists($default_config['message'])) {
267 267
                 $this->default_message_mask = $default_config['message'];
268
-            }else{
268
+            } else{
269 269
                 throw new MaskNotFoundException("Unknown mask provided: ".$default_config['message']);
270 270
             }
271 271
 
272 272
             if(class_exists($default_config['attachment'])) {
273 273
                 $this->default_attachment_mask = $default_config['attachment'];
274
-            }else{
274
+            } else{
275 275
                 throw new MaskNotFoundException("Unknown mask provided: ".$default_config['attachment']);
276 276
             }
277 277
         }
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
             $this->connection = new ImapProtocol($this->validate_cert, $this->encryption);
336 336
             $this->connection->setConnectionTimeout($this->timeout);
337 337
             $this->connection->setProxy($this->proxy);
338
-        }else{
338
+        } else{
339 339
             if (extension_loaded('imap') === false) {
340 340
                 throw new ConnectionFailedException("connection setup failed", 0, new ProtocolNotSupportedException($protocol." is an unsupported protocol"));
341 341
             }
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
             }
476 476
 
477 477
             return $folders;
478
-        }else{
478
+        } else{
479 479
             throw new FolderFetchingException("failed to fetch any folders");
480 480
         }
481 481
     }
@@ -513,7 +513,9 @@  discard block
 block discarded – undo
513 513
         $this->checkConnection();
514 514
         $status = $this->connection->createFolder($folder);
515 515
 
516
-        if($expunge) $this->expunge();
516
+        if($expunge) {
517
+            $this->expunge();
518
+        }
517 519
 
518 520
         $folder = $this->getFolder($folder);
519 521
         if($status && $folder) {
Please login to merge, or discard this patch.