Passed
Push — master ( 27cb7e...17f7bb )
by Malte
02:10
created
src/Query/WhereQuery.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -76,18 +76,18 @@  discard block
 block discarded – undo
76 76
 
77 77
         $name = Str::camel($name);
78 78
 
79
-        if(strtolower(substr($name, 0, 3)) === 'not') {
79
+        if (strtolower(substr($name, 0, 3)) === 'not') {
80 80
             $that = $that->whereNot();
81 81
             $name = substr($name, 3);
82 82
         }
83 83
 
84
-        if (strpos(strtolower($name), "where") === false){
84
+        if (strpos(strtolower($name), "where") === false) {
85 85
             $method = 'where'.ucfirst($name);
86
-        }else{
86
+        }else {
87 87
             $method = lcfirst($name);
88 88
         }
89 89
 
90
-        if(method_exists($this, $method) === true){
90
+        if (method_exists($this, $method) === true) {
91 91
             return call_user_func_array([$that, $method], $arguments);
92 92
         }
93 93
 
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
         if (substr($criteria, 0, 7) === "CUSTOM ") {
107 107
             return substr($criteria, 7);
108 108
         }
109
-        if(in_array($criteria, $this->available_criteria) === false) {
109
+        if (in_array($criteria, $this->available_criteria) === false) {
110 110
             throw new InvalidWhereQueryCriteriaException();
111 111
         }
112 112
 
@@ -121,20 +121,20 @@  discard block
 block discarded – undo
121 121
      * @throws InvalidWhereQueryCriteriaException
122 122
      */
123 123
     public function where($criteria, $value = null) {
124
-        if(is_array($criteria)){
125
-            foreach($criteria as $key => $value){
126
-                if(is_numeric($key)){
124
+        if (is_array($criteria)) {
125
+            foreach ($criteria as $key => $value) {
126
+                if (is_numeric($key)) {
127 127
                     return $this->where($value);
128 128
                 }
129 129
                 return $this->where($key, $value);
130 130
             }
131
-        }else{
131
+        }else {
132 132
             $criteria = $this->validate_criteria($criteria);
133 133
             $value = $this->parse_value($value);
134 134
 
135
-            if($value === null || $value === ''){
135
+            if ($value === null || $value === '') {
136 136
                 $this->query->push([$criteria]);
137
-            }else{
137
+            }else {
138 138
                 $this->query->push([$criteria, $value]);
139 139
             }
140 140
         }
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
      */
150 150
     public function orWhere(\Closure $closure = null) {
151 151
         $this->query->push(['OR']);
152
-        if($closure !== null) $closure($this);
152
+        if ($closure !== null) $closure($this);
153 153
 
154 154
         return $this;
155 155
     }
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
      */
162 162
     public function andWhere(\Closure $closure = null) {
163 163
         $this->query->push(['AND']);
164
-        if($closure !== null) $closure($this);
164
+        if ($closure !== null) $closure($this);
165 165
 
166 166
         return $this;
167 167
     }
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
      * @return WhereQuery
402 402
      * @throws InvalidWhereQueryCriteriaException
403 403
      */
404
-    public function whereNoXSpam(){
404
+    public function whereNoXSpam() {
405 405
         return $this->where("CUSTOM X-Spam-Flag NO");
406 406
     }
407 407
 
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
      * @return WhereQuery
410 410
      * @throws InvalidWhereQueryCriteriaException
411 411
      */
412
-    public function whereIsXSpam(){
412
+    public function whereIsXSpam() {
413 413
         return $this->where("CUSTOM X-Spam-Flag YES");
414 414
     }
415 415
 
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
      * @return WhereQuery
422 422
      * @throws InvalidWhereQueryCriteriaException
423 423
      */
424
-    public function whereHeader($header, $value){
424
+    public function whereHeader($header, $value) {
425 425
         return $this->where("CUSTOM HEADER $header $value");
426 426
     }
427 427
 
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
      * @return WhereQuery
433 433
      * @throws InvalidWhereQueryCriteriaException
434 434
      */
435
-    public function whereMessageId($messageId){
435
+    public function whereMessageId($messageId) {
436 436
         return $this->whereHeader("Message-ID", $messageId);
437 437
     }
438 438
 
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
      * @return WhereQuery
444 444
      * @throws InvalidWhereQueryCriteriaException
445 445
      */
446
-    public function whereInReplyTo($messageId){
446
+    public function whereInReplyTo($messageId) {
447 447
         return $this->whereHeader("In-Reply-To", $messageId);
448 448
     }
449 449
 
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
      * @return WhereQuery
454 454
      * @throws InvalidWhereQueryCriteriaException
455 455
      */
456
-    public function whereLanguage($country_code){
456
+    public function whereLanguage($country_code) {
457 457
         return $this->where("Content-Language $country_code");
458 458
     }
459 459
 }
460 460
\ No newline at end of file
Please login to merge, or discard this patch.
src/Connection/Protocols/LegacyProtocol.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
             throw new AuthFailedException($message);
88 88
         }
89 89
 
90
-        if(!$this->stream) {
90
+        if (!$this->stream) {
91 91
             $errors = \imap_errors();
92 92
             $message = implode("; ", (is_array($errors) ? $errors : array()));
93 93
             throw new AuthFailedException($message);
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
         if (!$this->cert_validation) {
119 119
             $address .= '/novalidate-cert';
120 120
         }
121
-        if (in_array($this->encryption,['tls', 'notls', 'ssl'])) {
121
+        if (in_array($this->encryption, ['tls', 'notls', 'ssl'])) {
122 122
             $address .= '/'.$this->encryption;
123 123
         } elseif ($this->encryption === "starttls") {
124 124
             $address .= '/tls';
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
      *
147 147
      * @return bool
148 148
      */
149
-    public function connected(){
149
+    public function connected() {
150 150
         return !$this->stream;
151 151
     }
152 152
 
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
      *
219 219
      * @return array
220 220
      */
221
-    public function headers($uids, $rfc = "RFC822", $uid = false){
221
+    public function headers($uids, $rfc = "RFC822", $uid = false) {
222 222
         $result = [];
223 223
         $uids = is_array($uids) ? $uids : [$uids];
224 224
         foreach ($uids as $uid) {
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
      *
235 235
      * @return array
236 236
      */
237
-    public function flags($uids, $uid = false){
237
+    public function flags($uids, $uid = false) {
238 238
         $result = [];
239 239
         $uids = is_array($uids) ? $uids : [$uids];
240 240
         foreach ($uids as $uid) {
@@ -242,8 +242,8 @@  discard block
 block discarded – undo
242 242
             $flags = [];
243 243
             if (is_array($raw_flags) && isset($raw_flags[0])) {
244 244
                 $raw_flags = (array) $raw_flags[0];
245
-                foreach($raw_flags as $flag => $value) {
246
-                    if ($value === 1 && in_array($flag, ["size", "uid", "msgno", "update"]) === false){
245
+                foreach ($raw_flags as $flag => $value) {
246
+                    if ($value === 1 && in_array($flag, ["size", "uid", "msgno", "update"]) === false) {
247 247
                         $flags[] = "\\".ucfirst($flag);
248 248
                     }
249 249
                 }
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
         if ($id === null) {
265 265
             $overview = $this->overview("1:*");
266 266
             $uids = [];
267
-            foreach($overview as $set){
267
+            foreach ($overview as $set) {
268 268
                 $uids[$set->msgno] = $set->uid;
269 269
             }
270 270
             return $uids;
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
      * @return array
291 291
      */
292 292
     public function overview($sequence, $uid = false) {
293
-        return \imap_fetch_overview($this->stream, $sequence,$uid ? IMAP::FT_UID : IMAP::NIL);
293
+        return \imap_fetch_overview($this->stream, $sequence, $uid ? IMAP::FT_UID : IMAP::NIL);
294 294
     }
295 295
 
296 296
     /**
@@ -305,12 +305,12 @@  discard block
 block discarded – undo
305 305
         $result = [];
306 306
 
307 307
         $items = \imap_getmailboxes($this->stream, $this->getAddress(), $reference.$folder);
308
-        if(is_array($items)){
308
+        if (is_array($items)) {
309 309
             foreach ($items as $item) {
310 310
                 $name = $this->decodeFolderName($item->name);
311 311
                 $result[$name] = ['delimiter' => $item->delimiter, 'flags' => []];
312 312
             }
313
-        }else{
313
+        }else {
314 314
             throw new RuntimeException(\imap_last_error());
315 315
         }
316 316
 
@@ -332,9 +332,9 @@  discard block
 block discarded – undo
332 332
     public function store(array $flags, $from, $to = null, $mode = null, $silent = true, $uid = false) {
333 333
         $flag = trim(is_array($flags) ? implode(" ", $flags) : $flags);
334 334
 
335
-        if ($mode == "+"){
335
+        if ($mode == "+") {
336 336
             $status = \imap_setflag_full($this->stream, $from, $flag, $uid ? IMAP::FT_UID : IMAP::NIL);
337
-        }else{
337
+        }else {
338 338
             $status = \imap_clearflag_full($this->stream, $from, $flag, $uid ? IMAP::FT_UID : IMAP::NIL);
339 339
         }
340 340
 
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
      */
357 357
     public function appendMessage($folder, $message, $flags = null, $date = null) {
358 358
         if ($date != null) {
359
-            if ($date instanceof \Carbon\Carbon){
359
+            if ($date instanceof \Carbon\Carbon) {
360 360
                 $date = $date->format('d-M-Y H:i:s O');
361 361
             }
362 362
             return \imap_append($this->stream, $folder, $message, $flags, $date);
@@ -493,14 +493,14 @@  discard block
 block discarded – undo
493 493
     /**
494 494
      * Enable the debug mode
495 495
      */
496
-    public function enableDebug(){
496
+    public function enableDebug() {
497 497
         $this->debug = true;
498 498
     }
499 499
 
500 500
     /**
501 501
      * Disable the debug mode
502 502
      */
503
-    public function disableDebug(){
503
+    public function disableDebug() {
504 504
         $this->debug = false;
505 505
     }
506 506
 
Please login to merge, or discard this patch.
src/Attribute.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
      *
61 61
      * @return string
62 62
      */
63
-    public function toString(){
63
+    public function toString() {
64 64
         return $this->__toString();
65 65
     }
66 66
 
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
      *
70 70
      * @return array
71 71
      */
72
-    public function __serialize(){
72
+    public function __serialize() {
73 73
         return $this->values;
74 74
     }
75 75
 
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
      *
79 79
      * @return array
80 80
      */
81
-    public function toArray(){
81
+    public function toArray() {
82 82
         return $this->__serialize();
83 83
     }
84 84
 
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
             if ($this->contains($value) === false) {
142 142
                 $this->values[] = $value;
143 143
             }
144
-        }else{
144
+        }else {
145 145
             $this->values[] = $value;
146 146
         }
147 147
     }
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
      *
153 153
      * @return Attribute
154 154
      */
155
-    public function setName($name){
155
+    public function setName($name) {
156 156
         $this->name = $name;
157 157
 
158 158
         return $this;
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
      *
164 164
      * @return string
165 165
      */
166
-    public function getName(){
166
+    public function getName() {
167 167
         return $this->name;
168 168
     }
169 169
 
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
      *
173 173
      * @return array
174 174
      */
175
-    public function get(){
175
+    public function get() {
176 176
         return $this->values;
177 177
     }
178 178
 
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
      *
182 182
      * @return array
183 183
      */
184
-    public function all(){
184
+    public function all() {
185 185
         return $this->get();
186 186
     }
187 187
 
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
      *
191 191
      * @return mixed|null
192 192
      */
193
-    public function first(){
193
+    public function first() {
194 194
         if (count($this->values) > 0) {
195 195
             return $this->values[0];
196 196
         }
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
      *
203 203
      * @return mixed|null
204 204
      */
205
-    public function last(){
205
+    public function last() {
206 206
         $cnt = count($this->values);
207 207
         if ($cnt > 0) {
208 208
             return $this->values[$cnt - 1];
Please login to merge, or discard this patch.
src/Message.php 1 patch
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
     public function __construct($uid, $msglist, Client $client, $fetch_options = null, $fetch_body = false, $fetch_flags = false, $sequence = null) {
203 203
 
204 204
         $default_mask = $client->getDefaultMessageMask();
205
-        if($default_mask != null) {
205
+        if ($default_mask != null) {
206 206
             $this->mask = $default_mask;
207 207
         }
208 208
         $this->events["message"] = $client->getDefaultEvents("message");
@@ -261,13 +261,13 @@  discard block
 block discarded – undo
261 261
      * @throws MessageFlagException
262 262
      * @throws Exceptions\RuntimeException
263 263
      */
264
-    public static function make($uid, $msglist, Client $client, $raw_header, $raw_body, $raw_flags, $fetch_options = null, $sequence = null){
264
+    public static function make($uid, $msglist, Client $client, $raw_header, $raw_body, $raw_flags, $fetch_options = null, $sequence = null) {
265 265
         $reflection = new \ReflectionClass(self::class);
266 266
         /** @var self $instance */
267 267
         $instance = $reflection->newInstanceWithoutConstructor();
268 268
 
269 269
         $default_mask = $client->getDefaultMessageMask();
270
-        if($default_mask != null) {
270
+        if ($default_mask != null) {
271 271
             $instance->setMask($default_mask);
272 272
         }
273 273
         $instance->setEvents([
@@ -302,13 +302,13 @@  discard block
 block discarded – undo
302 302
      * @throws MethodNotFoundException
303 303
      */
304 304
     public function __call($method, $arguments) {
305
-        if(strtolower(substr($method, 0, 3)) === 'get') {
305
+        if (strtolower(substr($method, 0, 3)) === 'get') {
306 306
             $name = Str::snake(substr($method, 3));
307 307
             return $this->get($name);
308 308
         }elseif (strtolower(substr($method, 0, 3)) === 'set') {
309 309
             $name = Str::snake(substr($method, 3));
310 310
 
311
-            if(in_array($name, array_keys($this->attributes))) {
311
+            if (in_array($name, array_keys($this->attributes))) {
312 312
                 return $this->__set($name, array_pop($arguments));
313 313
             }
314 314
 
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
      * @return mixed|null
348 348
      */
349 349
     public function get($name) {
350
-        if(isset($this->attributes[$name])) {
350
+        if (isset($this->attributes[$name])) {
351 351
             return $this->attributes[$name];
352 352
         }
353 353
 
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
      *
422 422
      * @throws InvalidMessageDateException
423 423
      */
424
-    public function parseRawHeader($raw_header){
424
+    public function parseRawHeader($raw_header) {
425 425
         $this->header = new Header($raw_header);
426 426
     }
427 427
 
@@ -432,8 +432,8 @@  discard block
 block discarded – undo
432 432
     public function parseRawFlags($raw_flags) {
433 433
         $this->flags = FlagCollection::make([]);
434 434
 
435
-        foreach($raw_flags as $flag) {
436
-            if (strpos($flag, "\\") === 0){
435
+        foreach ($raw_flags as $flag) {
436
+            if (strpos($flag, "\\") === 0) {
437 437
                 $flag = substr($flag, 1);
438 438
             }
439 439
             $flag_key = strtolower($flag);
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
      * @throws MessageFlagException
507 507
      * @throws Exceptions\RuntimeException
508 508
      */
509
-    public function peek(){
509
+    public function peek() {
510 510
         if ($this->fetch_options == IMAP::FT_PEEK) {
511 511
             if ($this->getFlags()->get("seen") == null) {
512 512
                 $this->unsetFlag("Seen");
@@ -555,7 +555,7 @@  discard block
 block discarded – undo
555 555
     private function fetchPart(Part $part) {
556 556
         if ($part->isAttachment()) {
557 557
             $this->fetchAttachment($part);
558
-        }else{
558
+        }else {
559 559
             $encoding = $this->getEncoding($part);
560 560
 
561 561
             $content = $this->decodeString($part->content, $part->encoding);
@@ -592,7 +592,7 @@  discard block
 block discarded – undo
592 592
         if ($oAttachment->getName() !== null && $oAttachment->getSize() > 0) {
593 593
             if ($oAttachment->getId() !== null) {
594 594
                 $this->attachments->put($oAttachment->getId(), $oAttachment);
595
-            } else {
595
+            }else {
596 596
                 $this->attachments->push($oAttachment);
597 597
             }
598 598
         }
@@ -726,7 +726,7 @@  discard block
 block discarded – undo
726 726
 
727 727
         if (function_exists('iconv') && $from != 'UTF-7' && $to != 'UTF-7') {
728 728
             return @iconv($from, $to.'//IGNORE', $str);
729
-        } else {
729
+        }else {
730 730
             if (!$from) {
731 731
                 return mb_convert_encoding($str, $to);
732 732
             }
@@ -747,9 +747,9 @@  discard block
 block discarded – undo
747 747
                     return EncodingAliases::get($parameter->value);
748 748
                 }
749 749
             }
750
-        }elseif (property_exists($structure, 'charset')){
750
+        }elseif (property_exists($structure, 'charset')) {
751 751
             return EncodingAliases::get($structure->charset);
752
-        }elseif (is_string($structure) === true){
752
+        }elseif (is_string($structure) === true) {
753 753
             return mb_detect_encoding($structure);
754 754
         }
755 755
 
@@ -764,7 +764,7 @@  discard block
 block discarded – undo
764 764
      * @throws Exceptions\FolderFetchingException
765 765
      * @throws Exceptions\RuntimeException
766 766
      */
767
-    public function getFolder(){
767
+    public function getFolder() {
768 768
         return $this->client->getFolder($this->folder_path);
769 769
     }
770 770
 
@@ -780,13 +780,13 @@  discard block
 block discarded – undo
780 780
      * @throws Exceptions\GetMessagesFailedException
781 781
      * @throws Exceptions\RuntimeException
782 782
      */
783
-    public function thread($sent_folder = null, &$thread = null, $folder = null){
783
+    public function thread($sent_folder = null, &$thread = null, $folder = null) {
784 784
         $thread = $thread ? $thread : MessageCollection::make([]);
785
-        $folder = $folder ? $folder :  $this->getFolder();
785
+        $folder = $folder ? $folder : $this->getFolder();
786 786
         $sent_folder = $sent_folder ? $sent_folder : $this->client->getFolder(ClientManager::get("options.common_folders.sent", "INBOX/Sent"));
787 787
 
788 788
         /** @var Message $message */
789
-        foreach($thread as $message) {
789
+        foreach ($thread as $message) {
790 790
             if ($message->message_id == $this->message_id) {
791 791
                 return $thread;
792 792
             }
@@ -797,7 +797,7 @@  discard block
 block discarded – undo
797 797
         $this->fetchThreadByInReplyTo($thread, $this->message_id, $sent_folder, $folder, $sent_folder);
798 798
 
799 799
         if (is_array($this->in_reply_to)) {
800
-            foreach($this->in_reply_to as $in_reply_to) {
800
+            foreach ($this->in_reply_to as $in_reply_to) {
801 801
                 $this->fetchThreadByMessageId($thread, $in_reply_to, $folder, $folder, $sent_folder);
802 802
                 $this->fetchThreadByMessageId($thread, $in_reply_to, $sent_folder, $folder, $sent_folder);
803 803
             }
@@ -818,7 +818,7 @@  discard block
 block discarded – undo
818 818
      * @throws Exceptions\GetMessagesFailedException
819 819
      * @throws Exceptions\RuntimeException
820 820
      */
821
-    protected function fetchThreadByInReplyTo(&$thread, $in_reply_to, $primary_folder, $secondary_folder, $sent_folder){
821
+    protected function fetchThreadByInReplyTo(&$thread, $in_reply_to, $primary_folder, $secondary_folder, $sent_folder) {
822 822
         $primary_folder->query()->inReplyTo($in_reply_to)
823 823
         ->setFetchBody($this->getFetchBodyOption())
824 824
         ->leaveUnread()->get()->each(function($message) use(&$thread, $secondary_folder, $sent_folder){
@@ -839,7 +839,7 @@  discard block
 block discarded – undo
839 839
      * @throws Exceptions\GetMessagesFailedException
840 840
      * @throws Exceptions\RuntimeException
841 841
      */
842
-    protected function fetchThreadByMessageId(&$thread, $message_id, $primary_folder, $secondary_folder, $sent_folder){
842
+    protected function fetchThreadByMessageId(&$thread, $message_id, $primary_folder, $secondary_folder, $sent_folder) {
843 843
         $primary_folder->query()->messageId($message_id)
844 844
         ->setFetchBody($this->getFetchBodyOption())
845 845
         ->leaveUnread()->get()->each(function($message) use(&$thread, $secondary_folder, $sent_folder){
@@ -932,14 +932,14 @@  discard block
 block discarded – undo
932 932
      * @throws MessageFlagException
933 933
      * @throws MessageHeaderFetchingException
934 934
      */
935
-    protected function fetchNewMail($folder, $next_uid, $event, $expunge){
936
-        if($expunge) $this->client->expunge();
935
+    protected function fetchNewMail($folder, $next_uid, $event, $expunge) {
936
+        if ($expunge) $this->client->expunge();
937 937
 
938 938
         $this->client->openFolder($folder->path);
939 939
 
940 940
         if ($this->sequence === IMAP::ST_UID) {
941 941
             $sequence_id = $next_uid;
942
-        }else{
942
+        }else {
943 943
             $sequence_id = $this->client->getConnection()->getMessageNumber($next_uid);
944 944
         }
945 945
 
@@ -962,7 +962,7 @@  discard block
 block discarded – undo
962 962
      */
963 963
     public function delete($expunge = true) {
964 964
         $status = $this->setFlag("Deleted");
965
-        if($expunge) $this->client->expunge();
965
+        if ($expunge) $this->client->expunge();
966 966
 
967 967
         $event = $this->getEvent("message", "deleted");
968 968
         $event::dispatch($this);
@@ -982,7 +982,7 @@  discard block
 block discarded – undo
982 982
      */
983 983
     public function restore($expunge = true) {
984 984
         $status = $this->unsetFlag("Deleted");
985
-        if($expunge) $this->client->expunge();
985
+        if ($expunge) $this->client->expunge();
986 986
 
987 987
         $event = $this->getEvent("message", "restored");
988 988
         $event::dispatch($this);
@@ -1087,7 +1087,7 @@  discard block
 block discarded – undo
1087 1087
      *
1088 1088
      * @return AttachmentCollection
1089 1089
      */
1090
-    public function attachments(){
1090
+    public function attachments() {
1091 1091
         return $this->getAttachments();
1092 1092
     }
1093 1093
 
@@ -1185,7 +1185,7 @@  discard block
 block discarded – undo
1185 1185
      *
1186 1186
      * @return FlagCollection
1187 1187
      */
1188
-    public function flags(){
1188
+    public function flags() {
1189 1189
         return $this->getFlags();
1190 1190
     }
1191 1191
 
@@ -1194,7 +1194,7 @@  discard block
 block discarded – undo
1194 1194
      *
1195 1195
      * @return Structure|null
1196 1196
      */
1197
-    public function getStructure(){
1197
+    public function getStructure() {
1198 1198
         return $this->structure;
1199 1199
     }
1200 1200
 
@@ -1220,7 +1220,7 @@  discard block
 block discarded – undo
1220 1220
      *
1221 1221
      * @return array
1222 1222
      */
1223
-    public function getAttributes(){
1223
+    public function getAttributes() {
1224 1224
         return array_merge($this->attributes, $this->header->getAttributes());
1225 1225
     }
1226 1226
 
@@ -1230,8 +1230,8 @@  discard block
 block discarded – undo
1230 1230
      *
1231 1231
      * @return $this
1232 1232
      */
1233
-    public function setMask($mask){
1234
-        if(class_exists($mask)){
1233
+    public function setMask($mask) {
1234
+        if (class_exists($mask)) {
1235 1235
             $this->mask = $mask;
1236 1236
         }
1237 1237
 
@@ -1243,7 +1243,7 @@  discard block
 block discarded – undo
1243 1243
      *
1244 1244
      * @return string
1245 1245
      */
1246
-    public function getMask(){
1246
+    public function getMask() {
1247 1247
         return $this->mask;
1248 1248
     }
1249 1249
 
@@ -1254,9 +1254,9 @@  discard block
 block discarded – undo
1254 1254
      * @return mixed
1255 1255
      * @throws MaskNotFoundException
1256 1256
      */
1257
-    public function mask($mask = null){
1257
+    public function mask($mask = null) {
1258 1258
         $mask = $mask !== null ? $mask : $this->mask;
1259
-        if(class_exists($mask)){
1259
+        if (class_exists($mask)) {
1260 1260
             return new $mask($this);
1261 1261
         }
1262 1262
 
@@ -1269,7 +1269,7 @@  discard block
 block discarded – undo
1269 1269
      *
1270 1270
      * @return $this
1271 1271
      */
1272
-    public function setFolderPath($folder_path){
1272
+    public function setFolderPath($folder_path) {
1273 1273
         $this->folder_path = $folder_path;
1274 1274
 
1275 1275
         return $this;
@@ -1281,7 +1281,7 @@  discard block
 block discarded – undo
1281 1281
      *
1282 1282
      * @return $this
1283 1283
      */
1284
-    public function setConfig($config){
1284
+    public function setConfig($config) {
1285 1285
         $this->config = $config;
1286 1286
 
1287 1287
         return $this;
@@ -1293,7 +1293,7 @@  discard block
 block discarded – undo
1293 1293
      *
1294 1294
      * @return $this
1295 1295
      */
1296
-    public function setAvailableFlags($available_flags){
1296
+    public function setAvailableFlags($available_flags) {
1297 1297
         $this->available_flags = $available_flags;
1298 1298
 
1299 1299
         return $this;
@@ -1305,7 +1305,7 @@  discard block
 block discarded – undo
1305 1305
      *
1306 1306
      * @return $this
1307 1307
      */
1308
-    public function setAttachments($attachments){
1308
+    public function setAttachments($attachments) {
1309 1309
         $this->attachments = $attachments;
1310 1310
 
1311 1311
         return $this;
@@ -1317,7 +1317,7 @@  discard block
 block discarded – undo
1317 1317
      *
1318 1318
      * @return $this
1319 1319
      */
1320
-    public function setFlags($flags){
1320
+    public function setFlags($flags) {
1321 1321
         $this->flags = $flags;
1322 1322
 
1323 1323
         return $this;
@@ -1331,7 +1331,7 @@  discard block
 block discarded – undo
1331 1331
      * @throws Exceptions\RuntimeException
1332 1332
      * @throws Exceptions\ConnectionFailedException
1333 1333
      */
1334
-    public function setClient($client){
1334
+    public function setClient($client) {
1335 1335
         $this->client = $client;
1336 1336
         $this->client->openFolder($this->folder_path);
1337 1337
 
@@ -1346,7 +1346,7 @@  discard block
 block discarded – undo
1346 1346
      * @throws Exceptions\RuntimeException
1347 1347
      * @return $this
1348 1348
      */
1349
-    public function setUid($uid){
1349
+    public function setUid($uid) {
1350 1350
         $this->uid = $uid;
1351 1351
         $this->msgn = $this->client->getConnection()->getMessageNumber($this->uid);
1352 1352
         $this->msglist = null;
@@ -1363,7 +1363,7 @@  discard block
 block discarded – undo
1363 1363
      * @throws Exceptions\RuntimeException
1364 1364
      * @return $this
1365 1365
      */
1366
-    public function setMsgn($msgn, $msglist = null){
1366
+    public function setMsgn($msgn, $msglist = null) {
1367 1367
         $this->msgn = $msgn;
1368 1368
         $this->msglist = $msglist;
1369 1369
         $this->uid = $this->client->getConnection()->getUid($this->msgn);
@@ -1376,7 +1376,7 @@  discard block
 block discarded – undo
1376 1376
      *
1377 1377
      * @return int
1378 1378
      */
1379
-    public function getSequence(){
1379
+    public function getSequence() {
1380 1380
         return $this->sequence;
1381 1381
     }
1382 1382
 
@@ -1385,7 +1385,7 @@  discard block
 block discarded – undo
1385 1385
      *
1386 1386
      * @return int
1387 1387
      */
1388
-    public function getSequenceId(){
1388
+    public function getSequenceId() {
1389 1389
         return $this->sequence === IMAP::ST_UID ? $this->uid : $this->msgn;
1390 1390
     }
1391 1391
 
@@ -1397,11 +1397,11 @@  discard block
 block discarded – undo
1397 1397
      * @throws Exceptions\ConnectionFailedException
1398 1398
      * @throws Exceptions\RuntimeException
1399 1399
      */
1400
-    public function setSequenceId($uid, $msglist = null){
1400
+    public function setSequenceId($uid, $msglist = null) {
1401 1401
         if ($this->getSequence() === IMAP::ST_UID) {
1402 1402
             $this->setUid($uid);
1403 1403
             $this->setMsglist($msglist);
1404
-        }else{
1404
+        }else {
1405 1405
             $this->setMsgn($uid, $msglist);
1406 1406
         }
1407 1407
     }
Please login to merge, or discard this patch.
src/Address.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -44,11 +44,11 @@  discard block
 block discarded – undo
44 44
      * @param object   $object
45 45
      */
46 46
     public function __construct($object) {
47
-        if (property_exists($object, "personal")){ $this->personal = $object->personal; }
48
-        if (property_exists($object, "mailbox")){ $this->mailbox = $object->mailbox; }
49
-        if (property_exists($object, "host")){ $this->host = $object->host; }
50
-        if (property_exists($object, "mail")){ $this->mail = $object->mail; }
51
-        if (property_exists($object, "full")){ $this->full = $object->full; }
47
+        if (property_exists($object, "personal")) { $this->personal = $object->personal; }
48
+        if (property_exists($object, "mailbox")) { $this->mailbox = $object->mailbox; }
49
+        if (property_exists($object, "host")) { $this->host = $object->host; }
50
+        if (property_exists($object, "mail")) { $this->mail = $object->mail; }
51
+        if (property_exists($object, "full")) { $this->full = $object->full; }
52 52
     }
53 53
 
54 54
 
@@ -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 [
71 71
             "personal" => $this->personal,
72 72
             "mailbox" => $this->mailbox,
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
      *
82 82
      * @return array
83 83
      */
84
-    public function toArray(){
84
+    public function toArray() {
85 85
         return $this->__serialize();
86 86
     }
87 87
 
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
      *
91 91
      * @return string
92 92
      */
93
-    public function toString(){
93
+    public function toString() {
94 94
         return $this->__toString();
95 95
     }
96 96
 }
97 97
\ No newline at end of file
Please login to merge, or discard this patch.
src/Connection/Protocols/ImapProtocol.php 1 patch
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
      * @throws ConnectionFailedException
85 85
      * @throws RuntimeException
86 86
      */
87
-    protected function enableTls(){
87
+    protected function enableTls() {
88 88
         $response = $this->requestAndResponse('STARTTLS');
89 89
         $result = $response && stream_socket_enable_crypto($this->stream, true, $this->getCryptoMethod());
90 90
         if (!$result) {
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
         $stack = [];
147 147
 
148 148
         //  replace any trailing <NL> including spaces with a single space
149
-        $line = rtrim($line) . ' ';
149
+        $line = rtrim($line).' ';
150 150
         while (($pos = strpos($line, ' ')) !== false) {
151 151
             $token = substr($line, 0, $pos);
152 152
             if (!strlen($token)) {
@@ -176,11 +176,11 @@  discard block
 block discarded – undo
176 176
                     if (strlen($token) > $chars) {
177 177
                         $line = substr($token, $chars);
178 178
                         $token = substr($token, 0, $chars);
179
-                    } else {
179
+                    }else {
180 180
                         $line .= $this->nextLine();
181 181
                     }
182 182
                     $tokens[] = $token;
183
-                    $line = trim($line) . ' ';
183
+                    $line = trim($line).' ';
184 184
                     continue;
185 185
                 }
186 186
             }
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
         $line = $this->nextTaggedLine($tag); // get next tag
231 231
         if (!$dontParse) {
232 232
             $tokens = $this->decodeLine($line);
233
-        } else {
233
+        }else {
234 234
             $tokens = $line;
235 235
         }
236 236
         if ($this->debug) echo "<< ".$line."\n";
@@ -280,27 +280,27 @@  discard block
 block discarded – undo
280 280
     public function sendRequest($command, $tokens = [], &$tag = null) {
281 281
         if (!$tag) {
282 282
             $this->noun++;
283
-            $tag = 'TAG' . $this->noun;
283
+            $tag = 'TAG'.$this->noun;
284 284
         }
285 285
 
286
-        $line = $tag . ' ' . $command;
286
+        $line = $tag.' '.$command;
287 287
 
288 288
         foreach ($tokens as $token) {
289 289
             if (is_array($token)) {
290
-                if (fwrite($this->stream, $line . ' ' . $token[0] . "\r\n") === false) {
290
+                if (fwrite($this->stream, $line.' '.$token[0]."\r\n") === false) {
291 291
                     throw new RuntimeException('failed to write - connection closed?');
292 292
                 }
293 293
                 if (!$this->assumedNextLine('+ ')) {
294 294
                     throw new RuntimeException('failed to send literal string');
295 295
                 }
296 296
                 $line = $token[1];
297
-            } else {
298
-                $line .= ' ' . $token;
297
+            }else {
298
+                $line .= ' '.$token;
299 299
             }
300 300
         }
301 301
         if ($this->debug) echo ">> ".$line."\n";
302 302
 
303
-        if (fwrite($this->stream, $line . "\r\n") === false) {
303
+        if (fwrite($this->stream, $line."\r\n") === false) {
304 304
             throw new RuntimeException('failed to write - connection closed?');
305 305
         }
306 306
     }
@@ -330,9 +330,9 @@  discard block
 block discarded – undo
330 330
     public function escapeString($string) {
331 331
         if (func_num_args() < 2) {
332 332
             if (strpos($string, "\n") !== false) {
333
-                return ['{' . strlen($string) . '}', $string];
334
-            } else {
335
-                return '"' . str_replace(['\\', '"'], ['\\\\', '\\"'], $string) . '"';
333
+                return ['{'.strlen($string).'}', $string];
334
+            }else {
335
+                return '"'.str_replace(['\\', '"'], ['\\\\', '\\"'], $string).'"';
336 336
             }
337 337
         }
338 338
         $result = [];
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
             }
358 358
             $result[] = $this->escapeList($v);
359 359
         }
360
-        return '(' . implode(' ', $result) . ')';
360
+        return '('.implode(' ', $result).')';
361 361
     }
362 362
 
363 363
     /**
@@ -397,12 +397,12 @@  discard block
 block discarded – undo
397 397
                     error_log("got an extra server challenge: $response");
398 398
                     // respond with an empty response.
399 399
                     $this->sendRequest('');
400
-                } else {
400
+                }else {
401 401
                     if (preg_match('/^NO /i', $response) ||
402 402
                         preg_match('/^BAD /i', $response)) {
403 403
                         error_log("got failure response: $response");
404 404
                         return false;
405
-                    } else if (preg_match("/^OK /i", $response)) {
405
+                    }else if (preg_match("/^OK /i", $response)) {
406 406
                         return true;
407 407
                     }
408 408
                 }
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
      *
436 436
      * @return bool
437 437
      */
438
-    public function connected(){
438
+    public function connected() {
439 439
         return (boolean) $this->stream;
440 440
     }
441 441
 
@@ -482,10 +482,10 @@  discard block
 block discarded – undo
482 482
                     $result[strtolower($tokens[1])] = $tokens[0];
483 483
                     break;
484 484
                 case '[UIDVALIDITY':
485
-                    $result['uidvalidity'] = (int)$tokens[2];
485
+                    $result['uidvalidity'] = (int) $tokens[2];
486 486
                     break;
487 487
                 case '[UIDNEXT':
488
-                    $result['uidnext'] = (int)$tokens[2];
488
+                    $result['uidnext'] = (int) $tokens[2];
489 489
                     break;
490 490
                 default:
491 491
                     // ignore
@@ -539,17 +539,17 @@  discard block
 block discarded – undo
539 539
         if (is_array($from)) {
540 540
             $set = implode(',', $from);
541 541
         } elseif ($to === null) {
542
-            $set = (int)$from;
542
+            $set = (int) $from;
543 543
         } elseif ($to === INF) {
544
-            $set = (int)$from . ':*';
545
-        } else {
546
-            $set = (int)$from . ':' . (int)$to;
544
+            $set = (int) $from.':*';
545
+        }else {
546
+            $set = (int) $from.':'.(int) $to;
547 547
         }
548 548
 
549
-        $items = (array)$items;
549
+        $items = (array) $items;
550 550
         $itemList = $this->escapeList($items);
551 551
 
552
-        $this->sendRequest(($uid ? 'UID ' : '') . 'FETCH', [$set, $itemList], $tag);
552
+        $this->sendRequest(($uid ? 'UID ' : '').'FETCH', [$set, $itemList], $tag);
553 553
 
554 554
         $result = [];
555 555
         $tokens = null; // define $tokens variable before first use
@@ -564,9 +564,9 @@  discard block
 block discarded – undo
564 564
                 $count = count($tokens[2]);
565 565
                 if ($tokens[2][$count - 2] == 'UID') {
566 566
                     $uidKey = $count - 1;
567
-                } else if ($tokens[2][0] == 'UID') {
567
+                }else if ($tokens[2][0] == 'UID') {
568 568
                     $uidKey = 1;
569
-                } else {
569
+                }else {
570 570
                     $uidKey = array_search('UID', $tokens[2]) + 1;
571 571
                 }
572 572
             }
@@ -582,7 +582,7 @@  discard block
 block discarded – undo
582 582
                     $data = $tokens[2][1];
583 583
                 } elseif ($uid && $tokens[2][2] == $items[0]) {
584 584
                     $data = $tokens[2][3];
585
-                } else {
585
+                }else {
586 586
                     // maybe the server send an other field we didn't wanted
587 587
                     $count = count($tokens[2]);
588 588
                     // we start with 2, because 0 was already checked
@@ -594,7 +594,7 @@  discard block
 block discarded – undo
594 594
                         break;
595 595
                     }
596 596
                 }
597
-            } else {
597
+            }else {
598 598
                 $data = [];
599 599
                 while (key($tokens[2]) !== null) {
600 600
                     $data[current($tokens[2])] = next($tokens[2]);
@@ -611,7 +611,7 @@  discard block
 block discarded – undo
611 611
             }
612 612
             if ($uid) {
613 613
                 $result[$tokens[2][$uidKey]] = $data;
614
-            }else{
614
+            }else {
615 615
                 $result[$tokens[0]] = $data;
616 616
             }
617 617
         }
@@ -645,7 +645,7 @@  discard block
 block discarded – undo
645 645
      * @return array
646 646
      * @throws RuntimeException
647 647
      */
648
-    public function headers($uids, $rfc = "RFC822", $uid = false){
648
+    public function headers($uids, $rfc = "RFC822", $uid = false) {
649 649
         return $this->fetch(["$rfc.HEADER"], $uids, null, $uid);
650 650
     }
651 651
 
@@ -657,7 +657,7 @@  discard block
 block discarded – undo
657 657
      * @return array
658 658
      * @throws RuntimeException
659 659
      */
660
-    public function flags($uids, $uid = false){
660
+    public function flags($uids, $uid = false) {
661 661
         return $this->fetch(["FLAGS"], $uids, null, $uid);
662 662
     }
663 663
 
@@ -742,23 +742,23 @@  discard block
 block discarded – undo
742 742
     public function store(array $flags, $from, $to = null, $mode = null, $silent = true, $uid = false) {
743 743
         $item = 'FLAGS';
744 744
         if ($mode == '+' || $mode == '-') {
745
-            $item = $mode . $item;
745
+            $item = $mode.$item;
746 746
         }
747 747
         if ($silent) {
748 748
             $item .= '.SILENT';
749 749
         }
750 750
 
751 751
         $flags = $this->escapeList($flags);
752
-        $set = (int)$from;
752
+        $set = (int) $from;
753 753
         if ($to !== null) {
754
-            $set .= ':' . ($to == INF ? '*' : (int)$to);
754
+            $set .= ':'.($to == INF ? '*' : (int) $to);
755 755
         }
756 756
 
757 757
         $command = ($uid ? "UID " : "")."STORE";
758 758
         $result = $this->requestAndResponse($command, [$set, $item, $flags], $silent);
759 759
 
760 760
         if ($silent) {
761
-            return (bool)$result;
761
+            return (bool) $result;
762 762
         }
763 763
 
764 764
         $tokens = $result;
@@ -809,9 +809,9 @@  discard block
 block discarded – undo
809 809
      * @throws RuntimeException
810 810
      */
811 811
     public function copyMessage($folder, $from, $to = null, $uid = false) {
812
-        $set = (int)$from;
812
+        $set = (int) $from;
813 813
         if ($to !== null) {
814
-            $set .= ':' . ($to == INF ? '*' : (int)$to);
814
+            $set .= ':'.($to == INF ? '*' : (int) $to);
815 815
         }
816 816
         $command = ($uid ? "UID " : "")."COPY";
817 817
 
@@ -830,9 +830,9 @@  discard block
 block discarded – undo
830 830
      * @throws RuntimeException
831 831
      */
832 832
     public function moveMessage($folder, $from, $to = null, $uid = false) {
833
-        $set = (int)$from;
833
+        $set = (int) $from;
834 834
         if ($to !== null) {
835
-            $set .= ':' . ($to == INF ? '*' : (int)$to);
835
+            $set .= ':'.($to == INF ? '*' : (int) $to);
836 836
         }
837 837
         $command = ($uid ? "UID " : "")."MOVE";
838 838
 
@@ -1002,7 +1002,7 @@  discard block
 block discarded – undo
1002 1002
         $ids = [];
1003 1003
         foreach ($uids as $msgn => $v) {
1004 1004
             $id = $uid ? $v : $msgn;
1005
-            if ( ($to >= $id && $from <= $id) || ($to === "*" && $from <= $id) ){
1005
+            if (($to >= $id && $from <= $id) || ($to === "*" && $from <= $id)) {
1006 1006
                 $ids[] = $id;
1007 1007
             }
1008 1008
         }
@@ -1016,14 +1016,14 @@  discard block
 block discarded – undo
1016 1016
     /**
1017 1017
      * Enable the debug mode
1018 1018
      */
1019
-    public function enableDebug(){
1019
+    public function enableDebug() {
1020 1020
         $this->debug = true;
1021 1021
     }
1022 1022
 
1023 1023
     /**
1024 1024
      * Disable the debug mode
1025 1025
      */
1026
-    public function disableDebug(){
1026
+    public function disableDebug() {
1027 1027
         $this->debug = false;
1028 1028
     }
1029 1029
 }
1030 1030
\ No newline at end of file
Please login to merge, or discard this patch.
src/Query/Query.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -80,11 +80,11 @@  discard block
 block discarded – undo
80 80
         $this->setClient($client);
81 81
 
82 82
         $this->sequence = ClientManager::get('options.sequence', IMAP::ST_MSGN);
83
-        if(ClientManager::get('options.fetch') === IMAP::FT_PEEK) $this->leaveUnread();
83
+        if (ClientManager::get('options.fetch') === IMAP::FT_PEEK) $this->leaveUnread();
84 84
 
85 85
         if (ClientManager::get('options.fetch_order') === 'desc') {
86 86
             $this->fetch_order = 'desc';
87
-        } else {
87
+        }else {
88 88
             $this->fetch_order = 'asc';
89 89
         }
90 90
 
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
     /**
99 99
      * Instance boot method for additional functionality
100 100
      */
101
-    protected function boot(){}
101
+    protected function boot() {}
102 102
 
103 103
     /**
104 104
      * Parse a given value
@@ -106,8 +106,8 @@  discard block
 block discarded – undo
106 106
      *
107 107
      * @return string
108 108
      */
109
-    protected function parse_value($value){
110
-        switch(true){
109
+    protected function parse_value($value) {
110
+        switch (true) {
111 111
             case $value instanceof \Carbon\Carbon:
112 112
                 $value = $value->format($this->date_format);
113 113
                 break;
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
      * @throws MessageSearchValidationException
125 125
      */
126 126
     protected function parse_date($date) {
127
-        if($date instanceof \Carbon\Carbon) return $date;
127
+        if ($date instanceof \Carbon\Carbon) return $date;
128 128
 
129 129
         try {
130 130
             $date = Carbon::parse($date);
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
      * @return Collection
176 176
      * @throws GetMessagesFailedException
177 177
      */
178
-    protected function search(){
178
+    protected function search() {
179 179
         $this->generate_query();
180 180
 
181 181
         try {
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
                     $raw_flag = isset($raw_flags[$uid]) ? $raw_flags[$uid] : [];
241 241
 
242 242
                     $message = Message::make($uid, $msglist, $this->getClient(), $raw_header, $raw_content, $raw_flag, $this->getFetchOptions(), $this->sequence);
243
-                    switch ($message_key){
243
+                    switch ($message_key) {
244 244
                         case 'number':
245 245
                             $key = $message->getMessageNo();
246 246
                             break;
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 
263 263
             return $messages;
264 264
         } catch (\Exception $e) {
265
-            throw new GetMessagesFailedException($e->getMessage(),0, $e);
265
+            throw new GetMessagesFailedException($e->getMessage(), 0, $e);
266 266
         }
267 267
     }
268 268
 
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
      * @throws \Webklex\PHPIMAP\Exceptions\EventNotFoundException
282 282
      * @throws \Webklex\PHPIMAP\Exceptions\MessageFlagException
283 283
      */
284
-    public function getMessage($uid, $msglist = null, $sequence = null){
284
+    public function getMessage($uid, $msglist = null, $sequence = null) {
285 285
         return new Message($uid, $msglist, $this->getClient(), $this->getFetchOptions(), $this->getFetchBody(), $this->getFetchFlags(), $sequence ? $sequence : $this->sequence);
286 286
     }
287 287
 
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
      * @throws \Webklex\PHPIMAP\Exceptions\EventNotFoundException
300 300
      * @throws \Webklex\PHPIMAP\Exceptions\MessageFlagException
301 301
      */
302
-    public function getMessageByMsgn($msgn, $msglist = null){
302
+    public function getMessageByMsgn($msgn, $msglist = null) {
303 303
         return $this->getMessage($msgn, $msglist, IMAP::ST_MSGN);
304 304
     }
305 305
 
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
      * @throws \Webklex\PHPIMAP\Exceptions\EventNotFoundException
317 317
      * @throws \Webklex\PHPIMAP\Exceptions\MessageFlagException
318 318
      */
319
-    public function getMessageByUid($uid){
319
+    public function getMessageByUid($uid) {
320 320
         return $this->getMessage($uid, null, IMAP::ST_UID);
321 321
     }
322 322
 
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
      * @return LengthAwarePaginator
330 330
      * @throws GetMessagesFailedException
331 331
      */
332
-    public function paginate($per_page = 5, $page = null, $page_name = 'imap_page'){
332
+    public function paginate($per_page = 5, $page = null, $page_name = 'imap_page') {
333 333
         if (
334 334
                $page === null
335 335
             && isset($_GET[$page_name])
@@ -355,10 +355,10 @@  discard block
 block discarded – undo
355 355
         $this->query->each(function($statement) use(&$query) {
356 356
             if (count($statement) == 1) {
357 357
                 $query .= $statement[0];
358
-            } else {
359
-                if($statement[1] === null){
358
+            }else {
359
+                if ($statement[1] === null) {
360 360
                     $query .= $statement[0];
361
-                }else{
361
+                }else {
362 362
                     $query .= $statement[0].' "'.$statement[1].'"';
363 363
                 }
364 364
             }
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
      * @return $this
389 389
      */
390 390
     public function limit($limit, $page = 1) {
391
-        if($page >= 1) $this->page = $page;
391
+        if ($page >= 1) $this->page = $page;
392 392
         $this->limit = $limit;
393 393
 
394 394
         return $this;
Please login to merge, or discard this patch.
src/Structure.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
      * @throws MessageContentFetchingException
78 78
      * @throws InvalidMessageDateException
79 79
      */
80
-    protected function parse(){
80
+    protected function parse() {
81 81
         $this->findContentType();
82 82
         $this->parts = $this->find_parts();
83 83
     }
@@ -85,13 +85,13 @@  discard block
 block discarded – undo
85 85
     /**
86 86
      * Determine the message content type
87 87
      */
88
-    public function findContentType(){
88
+    public function findContentType() {
89 89
 
90 90
         $content_type = $this->header->get("content_type");
91 91
         $content_type = (is_array($content_type)) ? implode(' ', $content_type) : $content_type;
92
-        if(stripos($content_type, 'multipart') === 0) {
92
+        if (stripos($content_type, 'multipart') === 0) {
93 93
             $this->type = IMAP::MESSAGE_TYPE_MULTIPART;
94
-        }else{
94
+        }else {
95 95
             $this->type = IMAP::MESSAGE_TYPE_TEXT;
96 96
         }
97 97
     }
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
      *
102 102
      * @return string|null
103 103
      */
104
-    public function getBoundary(){
104
+    public function getBoundary() {
105 105
         $boundary = $this->header->find("/boundary=\"?([^\"]*)[\";\s]/i");
106 106
 
107 107
         if ($boundary === null) {
@@ -118,9 +118,9 @@  discard block
 block discarded – undo
118 118
      * @throws MessageContentFetchingException
119 119
      * @throws InvalidMessageDateException
120 120
      */
121
-    public function find_parts(){
122
-        if($this->type === IMAP::MESSAGE_TYPE_MULTIPART) {
123
-            if (($boundary = $this->getBoundary()) === null)  {
121
+    public function find_parts() {
122
+        if ($this->type === IMAP::MESSAGE_TYPE_MULTIPART) {
123
+            if (($boundary = $this->getBoundary()) === null) {
124 124
                 throw new MessageContentFetchingException("no content found", 0);
125 125
             }
126 126
 
@@ -129,21 +129,21 @@  discard block
 block discarded – undo
129 129
             ];
130 130
 
131 131
             if (preg_match("/boundary\=\"?(.*)\"?/", $this->raw, $match) == 1) {
132
-                if(is_array($match[1])){
133
-                    foreach($match[1] as $matched){
132
+                if (is_array($match[1])) {
133
+                    foreach ($match[1] as $matched) {
134 134
                         $boundaries[] = str_replace('"', '', $matched);
135 135
                     }
136
-                }else{
137
-                    if(!empty($match[1])) {
136
+                }else {
137
+                    if (!empty($match[1])) {
138 138
                         $boundaries[] = str_replace('"', '', $match[1]);
139 139
                     }
140 140
                 }
141 141
             }
142 142
 
143
-            $raw_parts = explode( $boundaries[0], str_replace($boundaries, $boundaries[0], $this->raw) );
143
+            $raw_parts = explode($boundaries[0], str_replace($boundaries, $boundaries[0], $this->raw));
144 144
             $parts = [];
145 145
             $part_number = 0;
146
-            foreach($raw_parts as $part) {
146
+            foreach ($raw_parts as $part) {
147 147
                 $part = trim(rtrim($part));
148 148
                 if ($part !== "--") {
149 149
                     $parts[] = new Part($part, null, $part_number);
Please login to merge, or discard this patch.
src/Folder.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 
126 126
         $this->setDelimiter($delimiter);
127 127
         $this->path      = $folder_name;
128
-        $this->full_name  = $this->decodeName($folder_name);
128
+        $this->full_name = $this->decodeName($folder_name);
129 129
         $this->name      = $this->getSimpleName($this->delimiter, $this->full_name);
130 130
 
131 131
         $this->parseAttributes($attributes);
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
      * @throws Exceptions\ConnectionFailedException
140 140
      * @throws Exceptions\RuntimeException
141 141
      */
142
-    public function query($charset = 'UTF-8'){
142
+    public function query($charset = 'UTF-8') {
143 143
         $this->getClient()->checkConnection();
144 144
         $this->getClient()->openFolder($this->path);
145 145
 
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
      * @throws Exceptions\ConnectionFailedException
152 152
      * @throws Exceptions\RuntimeException
153 153
      */
154
-    public function search($charset = 'UTF-8'){
154
+    public function search($charset = 'UTF-8') {
155 155
         return $this->query($charset);
156 156
     }
157 157
 
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
      * @throws Exceptions\ConnectionFailedException
161 161
      * @throws Exceptions\RuntimeException
162 162
      */
163
-    public function messages($charset = 'UTF-8'){
163
+    public function messages($charset = 'UTF-8') {
164 164
         return $this->query($charset);
165 165
     }
166 166
 
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
     public function move($new_name, $expunge = true) {
236 236
         $this->client->checkConnection();
237 237
         $status = $this->client->getConnection()->renameFolder($this->full_name, $new_name);
238
-        if($expunge) $this->client->expunge();
238
+        if ($expunge) $this->client->expunge();
239 239
 
240 240
         $folder = $this->client->getFolder($new_name);
241 241
         $event = $this->getEvent("folder", "moved");
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
      * @throws ConnectionFailedException
253 253
      * @throws Exceptions\RuntimeException
254 254
      */
255
-    public function overview($sequence = null){
255
+    public function overview($sequence = null) {
256 256
         $this->client->openFolder($this->path);
257 257
         $sequence = $sequence === null ? "1:*" : $sequence;
258 258
         $uid = ClientManager::get('options.sequence', IMAP::ST_MSGN) == IMAP::ST_UID;
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
          */
278 278
 
279 279
         if ($internal_date != null) {
280
-            if ($internal_date instanceof Carbon){
280
+            if ($internal_date instanceof Carbon) {
281 281
                 $internal_date = $internal_date->format('d-M-Y H:i:s O');
282 282
             }
283 283
         }
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
      */
312 312
     public function delete($expunge = true) {
313 313
         $status = $this->client->getConnection()->deleteFolder($this->path);
314
-        if($expunge) $this->client->expunge();
314
+        if ($expunge) $this->client->expunge();
315 315
 
316 316
         $event = $this->getEvent("folder", "deleted");
317 317
         $event::dispatch($this);
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
             try {
372 372
                 $line = $connection->nextLine();
373 373
                 if (($pos = strpos($line, "EXISTS")) !== false) {
374
-                    $msgn = (int) substr($line, 2, $pos -2);
374
+                    $msgn = (int) substr($line, 2, $pos - 2);
375 375
                     $connection->done();
376 376
 
377 377
                     $this->client->openFolder($this->path, true);
@@ -384,8 +384,8 @@  discard block
 block discarded – undo
384 384
 
385 385
                     $connection->idle();
386 386
                 }
387
-            }catch (Exceptions\RuntimeException $e) {
388
-                if(strpos($e->getMessage(), "connection closed") === false) {
387
+            } catch (Exceptions\RuntimeException $e) {
388
+                if (strpos($e->getMessage(), "connection closed") === false) {
389 389
                     throw $e;
390 390
                 }
391 391
                 if ($auto_reconnect === true) {
@@ -430,8 +430,8 @@  discard block
 block discarded – undo
430 430
      * Set the delimiter
431 431
      * @param $delimiter
432 432
      */
433
-    public function setDelimiter($delimiter){
434
-        if(in_array($delimiter, [null, '', ' ', false]) === true) {
433
+    public function setDelimiter($delimiter) {
434
+        if (in_array($delimiter, [null, '', ' ', false]) === true) {
435 435
             $delimiter = ClientManager::get('options.delimiter', '/');
436 436
         }
437 437
 
Please login to merge, or discard this patch.