Passed
Push — master ( 7779e0...031dc8 )
by Malte
02:35
created
src/Header.php 1 patch
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -82,10 +82,10 @@  discard block
 block discarded – undo
82 82
      * @throws MethodNotFoundException
83 83
      */
84 84
     public function __call($method, $arguments) {
85
-        if(strtolower(substr($method, 0, 3)) === 'get') {
85
+        if (strtolower(substr($method, 0, 3)) === 'get') {
86 86
             $name = preg_replace('/(.)(?=[A-Z])/u', '$1_', substr(strtolower($method), 3));
87 87
 
88
-            if(in_array($name, array_keys($this->attributes))) {
88
+            if (in_array($name, array_keys($this->attributes))) {
89 89
                 return $this->attributes[$name];
90 90
             }
91 91
 
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
      * @return Attribute|mixed
112 112
      */
113 113
     public function get($name) {
114
-        if(isset($this->attributes[$name])) {
114
+        if (isset($this->attributes[$name])) {
115 115
             return $this->attributes[$name];
116 116
         }
117 117
 
@@ -127,23 +127,23 @@  discard block
 block discarded – undo
127 127
      * @return Attribute
128 128
      */
129 129
     public function set($name, $value, $strict = false) {
130
-        if(isset($this->attributes[$name]) && $strict === false) {
130
+        if (isset($this->attributes[$name]) && $strict === false) {
131 131
             if ($this->attributize) {
132 132
                 $this->attributes[$name]->add($value, true);
133
-            }else{
134
-                if(isset($this->attributes[$name])) {
133
+            }else {
134
+                if (isset($this->attributes[$name])) {
135 135
                     if (is_array($this->attributes[$name]) == false) {
136 136
                         $this->attributes[$name] = [$this->attributes[$name], $value];
137
-                    }else{
137
+                    }else {
138 138
                         $this->attributes[$name][] = $value;
139 139
                     }
140
-                }else{
140
+                }else {
141 141
                     $this->attributes[$name] = $value;
142 142
                 }
143 143
             }
144
-        }elseif($this->attributize == false){
144
+        }elseif ($this->attributize == false) {
145 145
             $this->attributes[$name] = $value;
146
-        }else{
146
+        }else {
147 147
             $this->attributes[$name] = new Attribute($name, $value);
148 148
         }
149 149
 
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
     public function find($pattern) {
160 160
         if (preg_match_all($pattern, $this->raw, $matches)) {
161 161
             if (isset($matches[1])) {
162
-                if(count($matches[1]) > 0) {
162
+                if (count($matches[1]) > 0) {
163 163
                     return $matches[1][0];
164 164
                 }
165 165
             }
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
      *
173 173
      * @return string|null
174 174
      */
175
-    public function getBoundary(){
175
+    public function getBoundary() {
176 176
         $boundary = $this->find("/boundary\=(.*)/i");
177 177
 
178 178
         if ($boundary === null) {
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
      *
198 198
      * @throws InvalidMessageDateException
199 199
      */
200
-    protected function parse(){
200
+    protected function parse() {
201 201
         $header = $this->rfc822_parse_headers($this->raw);
202 202
 
203 203
         $this->extractAddresses($header);
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
         $this->parseDate($header);
216 216
         foreach ($header as $key => $value) {
217 217
             $key = trim(rtrim(strtolower($key)));
218
-            if(!isset($this->attributes[$key])){
218
+            if (!isset($this->attributes[$key])) {
219 219
                 $this->set($key, $value);
220 220
             }
221 221
         }
@@ -231,19 +231,19 @@  discard block
 block discarded – undo
231 231
      *
232 232
      * @return object
233 233
      */
234
-    public function rfc822_parse_headers($raw_headers){
234
+    public function rfc822_parse_headers($raw_headers) {
235 235
         $headers = [];
236 236
         $imap_headers = [];
237 237
         if (extension_loaded('imap') && $this->config["rfc822"]) {
238 238
             $raw_imap_headers = (array) \imap_rfc822_parse_headers($this->raw);
239
-            foreach($raw_imap_headers as $key => $values) {
239
+            foreach ($raw_imap_headers as $key => $values) {
240 240
                 $key = str_replace("-", "_", $key);
241 241
                 $imap_headers[$key] = $values;
242 242
             }
243 243
         }
244 244
         $lines = explode("\r\n", str_replace("\r\n\t", ' ', $raw_headers));
245 245
         $prev_header = null;
246
-        foreach($lines as $line) {
246
+        foreach ($lines as $line) {
247 247
             if (substr($line, 0, 1) === "\n") {
248 248
                 $line = substr($line, 1);
249 249
             }
@@ -263,19 +263,19 @@  discard block
 block discarded – undo
263 263
                     }
264 264
                     if (is_array($headers[$prev_header])) {
265 265
                         $headers[$prev_header][] = $line;
266
-                    }else{
266
+                    }else {
267 267
                         $headers[$prev_header] .= $line;
268 268
                     }
269 269
                 }
270
-            }else{
270
+            }else {
271 271
                 if (($pos = strpos($line, ":")) > 0) {
272 272
                     $key = trim(rtrim(strtolower(substr($line, 0, $pos))));
273 273
                     $key = str_replace("-", "_", $key);
274 274
 
275 275
                     $value = trim(rtrim(substr($line, $pos + 1)));
276 276
                     if (isset($headers[$key])) {
277
-                        $headers[$key][]  = $value;
278
-                    }else{
277
+                        $headers[$key][] = $value;
278
+                    }else {
279 279
                         $headers[$key] = [$value];
280 280
                     }
281 281
                     $prev_header = $key;
@@ -283,10 +283,10 @@  discard block
 block discarded – undo
283 283
             }
284 284
         }
285 285
 
286
-        foreach($headers as $key => $values) {
286
+        foreach ($headers as $key => $values) {
287 287
             if (isset($imap_headers[$key])) continue;
288 288
             $value = null;
289
-            switch($key){
289
+            switch ($key) {
290 290
                 case 'from':
291 291
                 case 'to':
292 292
                 case 'cc':
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
                     break;
302 302
                 default:
303 303
                     if (is_array($values)) {
304
-                        foreach($values as $k => $v) {
304
+                        foreach ($values as $k => $v) {
305 305
                             if ($v == "") {
306 306
                                 unset($values[$k]);
307 307
                             }
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
                             $value = implode(" ", $values);
314 314
                         } elseif ($available_values > 2) {
315 315
                             $value = array_values($values);
316
-                        } else {
316
+                        }else {
317 317
                             $value = "";
318 318
                         }
319 319
                     }
@@ -333,12 +333,12 @@  discard block
 block discarded – undo
333 333
      * @return array The decoded elements are returned in an array of objects, where each
334 334
      * object has two properties, charset and text.
335 335
      */
336
-    public function mime_header_decode($text){
336
+    public function mime_header_decode($text) {
337 337
         if (extension_loaded('imap')) {
338 338
             return \imap_mime_header_decode($text);
339 339
         }
340 340
         $charset = $this->getEncoding($text);
341
-        return [(object)[
341
+        return [(object) [
342 342
             "charset" => $charset,
343 343
             "text" => $this->convertEncoding($text, $charset)
344 344
         ]];
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
         try {
393 393
             if (function_exists('iconv') && $from != 'UTF-7' && $to != 'UTF-7') {
394 394
                 return iconv($from, $to, $str);
395
-            } else {
395
+            }else {
396 396
                 if (!$from) {
397 397
                     return mb_convert_encoding($str, $to);
398 398
                 }
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
             if (strstr($from, '-')) {
403 403
                 $from = str_replace('-', '', $from);
404 404
                 return $this->convertEncoding($str, $from, $to);
405
-            } else {
405
+            }else {
406 406
                 return $str;
407 407
             }
408 408
         }
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
             }
424 424
         }elseif (property_exists($structure, 'charset')) {
425 425
             return EncodingAliases::get($structure->charset, $this->fallback_encoding);
426
-        }elseif (is_string($structure) === true){
426
+        }elseif (is_string($structure) === true) {
427 427
             return mb_detect_encoding($structure);
428 428
         }
429 429
 
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
         if ($value !== null) {
457 457
             $is_utf8_base = $this->is_uft8($value);
458 458
 
459
-            if($decoder === 'utf-8' && extension_loaded('imap')) {
459
+            if ($decoder === 'utf-8' && extension_loaded('imap')) {
460 460
                 $value = \imap_utf8($value);
461 461
                 $is_utf8_base = $this->is_uft8($value);
462 462
                 if ($is_utf8_base) {
@@ -465,14 +465,14 @@  discard block
 block discarded – undo
465 465
                 if ($this->notDecoded($original_value, $value)) {
466 466
                     $decoded_value = $this->mime_header_decode($value);
467 467
                     if (count($decoded_value) > 0) {
468
-                        if(property_exists($decoded_value[0], "text")) {
468
+                        if (property_exists($decoded_value[0], "text")) {
469 469
                             $value = $decoded_value[0]->text;
470 470
                         }
471 471
                     }
472 472
                 }
473
-            }elseif($decoder === 'iconv' && $is_utf8_base) {
473
+            }elseif ($decoder === 'iconv' && $is_utf8_base) {
474 474
                 $value = iconv_mime_decode($value);
475
-            }elseif($is_utf8_base){
475
+            }elseif ($is_utf8_base) {
476 476
                 $value = mb_decode_mimeheader($value);
477 477
             }
478 478
 
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
      * @return array
496 496
      */
497 497
     private function decodeArray($values) {
498
-        foreach($values as $key => $value) {
498
+        foreach ($values as $key => $value) {
499 499
             $values[$key] = $this->decode($value);
500 500
         }
501 501
         return $values;
@@ -505,8 +505,8 @@  discard block
 block discarded – undo
505 505
      * Try to extract the priority from a given raw header string
506 506
      */
507 507
     private function findPriority() {
508
-        if(($priority = $this->get("x_priority")) === null) return;
509
-        switch((int)"$priority"){
508
+        if (($priority = $this->get("x_priority")) === null) return;
509
+        switch ((int) "$priority") {
510 510
             case IMAP::MESSAGE_PRIORITY_HIGHEST;
511 511
                 $priority = IMAP::MESSAGE_PRIORITY_HIGHEST;
512 512
                 break;
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
                     if (isset($parsed_address['address'])) {
546 546
                         $mail_address = explode('@', $parsed_address['address']);
547 547
                         if (count($mail_address) == 2) {
548
-                            $addresses[] = (object)[
548
+                            $addresses[] = (object) [
549 549
                                 "personal" => isset($parsed_address['display']) ? $parsed_address['display'] : '',
550 550
                                 "mailbox" => $mail_address[0],
551 551
                                 "host" => $mail_address[1],
@@ -558,7 +558,7 @@  discard block
 block discarded – undo
558 558
             return $addresses;
559 559
         }
560 560
 
561
-        foreach($values as $address) {
561
+        foreach ($values as $address) {
562 562
             foreach (preg_split('/, (?=(?:[^"]*"[^"]*")*[^"]*$)/', $address) as $split_address) {
563 563
                 $split_address = trim(rtrim($split_address));
564 564
 
@@ -573,7 +573,7 @@  discard block
 block discarded – undo
573 573
                     $name = trim(rtrim($matches["name"]));
574 574
                     $email = trim(rtrim($matches["email"]));
575 575
                     list($mailbox, $host) = array_pad(explode("@", $email), 2, null);
576
-                    $addresses[] = (object)[
576
+                    $addresses[] = (object) [
577 577
                         "personal" => $name,
578 578
                         "mailbox" => $mailbox,
579 579
                         "host" => $host,
@@ -590,7 +590,7 @@  discard block
 block discarded – undo
590 590
      * @param object $header
591 591
      */
592 592
     private function extractAddresses($header) {
593
-        foreach(['from', 'to', 'cc', 'bcc', 'reply_to', 'sender'] as $key){
593
+        foreach (['from', 'to', 'cc', 'bcc', 'reply_to', 'sender'] as $key) {
594 594
             if (property_exists($header, $key)) {
595 595
                 $this->set($key, $this->parseAddresses($header->$key));
596 596
             }
@@ -621,10 +621,10 @@  discard block
 block discarded – undo
621 621
             }
622 622
             if (!property_exists($address, 'personal')) {
623 623
                 $address->personal = false;
624
-            } else {
624
+            }else {
625 625
                 $personalParts = $this->mime_header_decode($address->personal);
626 626
 
627
-                if(is_array($personalParts)) {
627
+                if (is_array($personalParts)) {
628 628
                     $address->personal = '';
629 629
                     foreach ($personalParts as $p) {
630 630
                         $address->personal .= $this->convertEncoding($p->text, $this->getEncoding($p));
@@ -648,23 +648,23 @@  discard block
 block discarded – undo
648 648
     /**
649 649
      * Search and extract potential header extensions
650 650
      */
651
-    private function extractHeaderExtensions(){
651
+    private function extractHeaderExtensions() {
652 652
         foreach ($this->attributes as $key => $value) {
653 653
             if (is_array($value)) {
654 654
                 $value = implode(", ", $value);
655
-            }else{
656
-                $value = (string)$value;
655
+            }else {
656
+                $value = (string) $value;
657 657
             }
658 658
             // Only parse strings and don't parse any attributes like the user-agent
659 659
             if (in_array($key, ["user_agent"]) === false) {
660
-                if (($pos = strpos($value, ";")) !== false){
660
+                if (($pos = strpos($value, ";")) !== false) {
661 661
                     $original = substr($value, 0, $pos);
662 662
                     $this->set($key, trim(rtrim($original)), true);
663 663
 
664 664
                     // Get all potential extensions
665 665
                     $extensions = explode(";", substr($value, $pos + 1));
666
-                    foreach($extensions as $extension) {
667
-                        if (($pos = strpos($extension, "=")) !== false){
666
+                    foreach ($extensions as $extension) {
667
+                        if (($pos = strpos($extension, "=")) !== false) {
668 668
                             $key = substr($extension, 0, $pos);
669 669
                             $key = trim(rtrim(strtolower($key)));
670 670
 
@@ -707,7 +707,7 @@  discard block
 block discarded – undo
707 707
             $parsed_date = null;
708 708
             $date = $header->date;
709 709
 
710
-            if(preg_match('/\+0580/', $date)) {
710
+            if (preg_match('/\+0580/', $date)) {
711 711
                 $date = str_replace('+0580', '+0530', $date);
712 712
             }
713 713
 
@@ -730,7 +730,7 @@  discard block
 block discarded – undo
730 730
                         $date = trim(array_pop($array));
731 731
                         break;
732 732
                 }
733
-                try{
733
+                try {
734 734
                     $parsed_date = Carbon::parse($date);
735 735
                 } catch (\Exception $_e) {
736 736
                     throw new InvalidMessageDateException("Invalid message date. ID:".$this->get("message_id"), 1100, $e);
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
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
      * @throws ConnectionFailedException
89 89
      * @throws RuntimeException
90 90
      */
91
-    protected function enableTls(){
91
+    protected function enableTls() {
92 92
         $response = $this->requestAndResponse('STARTTLS');
93 93
         $result = $response && stream_socket_enable_crypto($this->stream, true, $this->getCryptoMethod());
94 94
         if (!$result) {
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
         $stack = [];
151 151
 
152 152
         //  replace any trailing <NL> including spaces with a single space
153
-        $line = rtrim($line) . ' ';
153
+        $line = rtrim($line).' ';
154 154
         while (($pos = strpos($line, ' ')) !== false) {
155 155
             $token = substr($line, 0, $pos);
156 156
             if (!strlen($token)) {
@@ -180,11 +180,11 @@  discard block
 block discarded – undo
180 180
                     if (strlen($token) > $chars) {
181 181
                         $line = substr($token, $chars);
182 182
                         $token = substr($token, 0, $chars);
183
-                    } else {
183
+                    }else {
184 184
                         $line .= $this->nextLine();
185 185
                     }
186 186
                     $tokens[] = $token;
187
-                    $line = trim($line) . ' ';
187
+                    $line = trim($line).' ';
188 188
                     continue;
189 189
                 }
190 190
             }
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
         $line = $this->nextTaggedLine($tag); // get next tag
235 235
         if (!$dontParse) {
236 236
             $tokens = $this->decodeLine($line);
237
-        } else {
237
+        }else {
238 238
             $tokens = $line;
239 239
         }
240 240
         if ($this->debug) echo "<< ".$line."\n";
@@ -284,27 +284,27 @@  discard block
 block discarded – undo
284 284
     public function sendRequest($command, $tokens = [], &$tag = null) {
285 285
         if (!$tag) {
286 286
             $this->noun++;
287
-            $tag = 'TAG' . $this->noun;
287
+            $tag = 'TAG'.$this->noun;
288 288
         }
289 289
 
290
-        $line = $tag . ' ' . $command;
290
+        $line = $tag.' '.$command;
291 291
 
292 292
         foreach ($tokens as $token) {
293 293
             if (is_array($token)) {
294
-                if (fwrite($this->stream, $line . ' ' . $token[0] . "\r\n") === false) {
294
+                if (fwrite($this->stream, $line.' '.$token[0]."\r\n") === false) {
295 295
                     throw new RuntimeException('failed to write - connection closed?');
296 296
                 }
297 297
                 if (!$this->assumedNextLine('+ ')) {
298 298
                     throw new RuntimeException('failed to send literal string');
299 299
                 }
300 300
                 $line = $token[1];
301
-            } else {
302
-                $line .= ' ' . $token;
301
+            }else {
302
+                $line .= ' '.$token;
303 303
             }
304 304
         }
305 305
         if ($this->debug) echo ">> ".$line."\n";
306 306
 
307
-        if (fwrite($this->stream, $line . "\r\n") === false) {
307
+        if (fwrite($this->stream, $line."\r\n") === false) {
308 308
             throw new RuntimeException('failed to write - connection closed?');
309 309
         }
310 310
     }
@@ -334,9 +334,9 @@  discard block
 block discarded – undo
334 334
     public function escapeString($string) {
335 335
         if (func_num_args() < 2) {
336 336
             if (strpos($string, "\n") !== false) {
337
-                return ['{' . strlen($string) . '}', $string];
338
-            } else {
339
-                return '"' . str_replace(['\\', '"'], ['\\\\', '\\"'], $string) . '"';
337
+                return ['{'.strlen($string).'}', $string];
338
+            }else {
339
+                return '"'.str_replace(['\\', '"'], ['\\\\', '\\"'], $string).'"';
340 340
             }
341 341
         }
342 342
         $result = [];
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
             }
362 362
             $result[] = $this->escapeList($v);
363 363
         }
364
-        return '(' . implode(' ', $result) . ')';
364
+        return '('.implode(' ', $result).')';
365 365
     }
366 366
 
367 367
     /**
@@ -401,12 +401,12 @@  discard block
 block discarded – undo
401 401
                     error_log("got an extra server challenge: $response");
402 402
                     // respond with an empty response.
403 403
                     $this->sendRequest('');
404
-                } else {
404
+                }else {
405 405
                     if (preg_match('/^NO /i', $response) ||
406 406
                         preg_match('/^BAD /i', $response)) {
407 407
                         error_log("got failure response: $response");
408 408
                         return false;
409
-                    } else if (preg_match("/^OK /i", $response)) {
409
+                    }else if (preg_match("/^OK /i", $response)) {
410 410
                         return true;
411 411
                     }
412 412
                 }
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
      *
440 440
      * @return bool
441 441
      */
442
-    public function connected(){
442
+    public function connected() {
443 443
         return (boolean) $this->stream;
444 444
     }
445 445
 
@@ -486,10 +486,10 @@  discard block
 block discarded – undo
486 486
                     $result[strtolower($tokens[1])] = $tokens[0];
487 487
                     break;
488 488
                 case '[UIDVALIDITY':
489
-                    $result['uidvalidity'] = (int)$tokens[2];
489
+                    $result['uidvalidity'] = (int) $tokens[2];
490 490
                     break;
491 491
                 case '[UIDNEXT':
492
-                    $result['uidnext'] = (int)$tokens[2];
492
+                    $result['uidnext'] = (int) $tokens[2];
493 493
                     break;
494 494
                 default:
495 495
                     // ignore
@@ -543,17 +543,17 @@  discard block
 block discarded – undo
543 543
         if (is_array($from)) {
544 544
             $set = implode(',', $from);
545 545
         } elseif ($to === null) {
546
-            $set = (int)$from;
546
+            $set = (int) $from;
547 547
         } elseif ($to === INF) {
548
-            $set = (int)$from . ':*';
549
-        } else {
550
-            $set = (int)$from . ':' . (int)$to;
548
+            $set = (int) $from.':*';
549
+        }else {
550
+            $set = (int) $from.':'.(int) $to;
551 551
         }
552 552
 
553
-        $items = (array)$items;
553
+        $items = (array) $items;
554 554
         $itemList = $this->escapeList($items);
555 555
 
556
-        $this->sendRequest(($uid ? 'UID ' : '') . 'FETCH', [$set, $itemList], $tag);
556
+        $this->sendRequest(($uid ? 'UID ' : '').'FETCH', [$set, $itemList], $tag);
557 557
 
558 558
         $result = [];
559 559
         $tokens = null; // define $tokens variable before first use
@@ -568,9 +568,9 @@  discard block
 block discarded – undo
568 568
                 $count = count($tokens[2]);
569 569
                 if ($tokens[2][$count - 2] == 'UID') {
570 570
                     $uidKey = $count - 1;
571
-                } else if ($tokens[2][0] == 'UID') {
571
+                }else if ($tokens[2][0] == 'UID') {
572 572
                     $uidKey = 1;
573
-                } else {
573
+                }else {
574 574
                     $uidKey = array_search('UID', $tokens[2]) + 1;
575 575
                 }
576 576
             }
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
                     $data = $tokens[2][1];
587 587
                 } elseif ($uid && $tokens[2][2] == $items[0]) {
588 588
                     $data = $tokens[2][3];
589
-                } else {
589
+                }else {
590 590
                     // maybe the server send an other field we didn't wanted
591 591
                     $count = count($tokens[2]);
592 592
                     // we start with 2, because 0 was already checked
@@ -598,7 +598,7 @@  discard block
 block discarded – undo
598 598
                         break;
599 599
                     }
600 600
                 }
601
-            } else {
601
+            }else {
602 602
                 $data = [];
603 603
                 while (key($tokens[2]) !== null) {
604 604
                     $data[current($tokens[2])] = next($tokens[2]);
@@ -615,7 +615,7 @@  discard block
 block discarded – undo
615 615
             }
616 616
             if ($uid) {
617 617
                 $result[$tokens[2][$uidKey]] = $data;
618
-            }else{
618
+            }else {
619 619
                 $result[$tokens[0]] = $data;
620 620
             }
621 621
         }
@@ -649,7 +649,7 @@  discard block
 block discarded – undo
649 649
      * @return array
650 650
      * @throws RuntimeException
651 651
      */
652
-    public function headers($uids, $rfc = "RFC822", $uid = false){
652
+    public function headers($uids, $rfc = "RFC822", $uid = false) {
653 653
         return $this->fetch(["$rfc.HEADER"], $uids, null, $uid);
654 654
     }
655 655
 
@@ -661,7 +661,7 @@  discard block
 block discarded – undo
661 661
      * @return array
662 662
      * @throws RuntimeException
663 663
      */
664
-    public function flags($uids, $uid = false){
664
+    public function flags($uids, $uid = false) {
665 665
         return $this->fetch(["FLAGS"], $uids, null, $uid);
666 666
     }
667 667
 
@@ -748,23 +748,23 @@  discard block
 block discarded – undo
748 748
     public function store(array $flags, $from, $to = null, $mode = null, $silent = true, $uid = false) {
749 749
         $item = 'FLAGS';
750 750
         if ($mode == '+' || $mode == '-') {
751
-            $item = $mode . $item;
751
+            $item = $mode.$item;
752 752
         }
753 753
         if ($silent) {
754 754
             $item .= '.SILENT';
755 755
         }
756 756
 
757 757
         $flags = $this->escapeList($flags);
758
-        $set = (int)$from;
758
+        $set = (int) $from;
759 759
         if ($to !== null) {
760
-            $set .= ':' . ($to == INF ? '*' : (int)$to);
760
+            $set .= ':'.($to == INF ? '*' : (int) $to);
761 761
         }
762 762
 
763 763
         $command = ($uid ? "UID " : "")."STORE";
764 764
         $result = $this->requestAndResponse($command, [$set, $item, $flags], $silent);
765 765
 
766 766
         if ($silent) {
767
-            return (bool)$result;
767
+            return (bool) $result;
768 768
         }
769 769
 
770 770
         $tokens = $result;
@@ -815,9 +815,9 @@  discard block
 block discarded – undo
815 815
      * @throws RuntimeException
816 816
      */
817 817
     public function copyMessage($folder, $from, $to = null, $uid = false) {
818
-        $set = (int)$from;
818
+        $set = (int) $from;
819 819
         if ($to !== null) {
820
-            $set .= ':' . ($to == INF ? '*' : (int)$to);
820
+            $set .= ':'.($to == INF ? '*' : (int) $to);
821 821
         }
822 822
         $command = ($uid ? "UID " : "")."COPY";
823 823
 
@@ -855,9 +855,9 @@  discard block
 block discarded – undo
855 855
      * @throws RuntimeException
856 856
      */
857 857
     public function moveMessage($folder, $from, $to = null, $uid = false) {
858
-        $set = (int)$from;
858
+        $set = (int) $from;
859 859
         if ($to !== null) {
860
-            $set .= ':' . ($to == INF ? '*' : (int)$to);
860
+            $set .= ':'.($to == INF ? '*' : (int) $to);
861 861
         }
862 862
         $command = ($uid ? "UID " : "")."MOVE";
863 863
 
@@ -1046,7 +1046,7 @@  discard block
 block discarded – undo
1046 1046
         $ids = [];
1047 1047
         foreach ($uids as $msgn => $v) {
1048 1048
             $id = $uid ? $v : $msgn;
1049
-            if ( ($to >= $id && $from <= $id) || ($to === "*" && $from <= $id) ){
1049
+            if (($to >= $id && $from <= $id) || ($to === "*" && $from <= $id)) {
1050 1050
                 $ids[] = $id;
1051 1051
             }
1052 1052
         }
@@ -1060,14 +1060,14 @@  discard block
 block discarded – undo
1060 1060
     /**
1061 1061
      * Enable the debug mode
1062 1062
      */
1063
-    public function enableDebug(){
1063
+    public function enableDebug() {
1064 1064
         $this->debug = true;
1065 1065
     }
1066 1066
 
1067 1067
     /**
1068 1068
      * Disable the debug mode
1069 1069
      */
1070
-    public function disableDebug(){
1070
+    public function disableDebug() {
1071 1071
         $this->debug = false;
1072 1072
     }
1073 1073
 }
Please login to merge, or discard this patch.