Passed
Pull Request — master (#160)
by
unknown
03:38
created
src/Message.php 1 patch
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
         $this->boot();
193 193
 
194 194
         $default_mask = $client->getDefaultMessageMask();
195
-        if($default_mask != null) {
195
+        if ($default_mask != null) {
196 196
             $this->mask = $default_mask;
197 197
         }
198 198
         $this->events["message"] = $client->getDefaultEvents("message");
@@ -246,14 +246,14 @@  discard block
 block discarded – undo
246 246
      * @throws Exceptions\RuntimeException
247 247
      * @throws Exceptions\MessageNotFoundException
248 248
      */
249
-    public static function make($uid, $msglist, Client $client, $raw_header, $raw_body, $raw_flags, $fetch_options = null, $sequence = null){
249
+    public static function make($uid, $msglist, Client $client, $raw_header, $raw_body, $raw_flags, $fetch_options = null, $sequence = null) {
250 250
         $reflection = new ReflectionClass(self::class);
251 251
         /** @var self $instance */
252 252
         $instance = $reflection->newInstanceWithoutConstructor();
253 253
         $instance->boot();
254 254
 
255 255
         $default_mask = $client->getDefaultMessageMask();
256
-        if($default_mask != null) {
256
+        if ($default_mask != null) {
257 257
             $instance->setMask($default_mask);
258 258
         }
259 259
         $instance->setEvents([
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
     /**
279 279
      * Boot a new instance
280 280
      */
281
-    public function boot(){
281
+    public function boot() {
282 282
         $this->attributes = [];
283 283
 
284 284
         $this->config = ClientManager::get('options');
@@ -297,13 +297,13 @@  discard block
 block discarded – undo
297 297
      * @throws MethodNotFoundException
298 298
      */
299 299
     public function __call($method, $arguments) {
300
-        if(strtolower(substr($method, 0, 3)) === 'get') {
300
+        if (strtolower(substr($method, 0, 3)) === 'get') {
301 301
             $name = Str::snake(substr($method, 3));
302 302
             return $this->get($name);
303 303
         }elseif (strtolower(substr($method, 0, 3)) === 'set') {
304 304
             $name = Str::snake(substr($method, 3));
305 305
 
306
-            if(in_array($name, array_keys($this->attributes))) {
306
+            if (in_array($name, array_keys($this->attributes))) {
307 307
                 return $this->__set($name, array_pop($arguments));
308 308
             }
309 309
 
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
      * @return Attribute|mixed|null
343 343
      */
344 344
     public function get($name) {
345
-        if(isset($this->attributes[$name])) {
345
+        if (isset($this->attributes[$name])) {
346 346
             return $this->attributes[$name];
347 347
         }
348 348
 
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
      *
417 417
      * @throws InvalidMessageDateException
418 418
      */
419
-    public function parseRawHeader($raw_header){
419
+    public function parseRawHeader($raw_header) {
420 420
         $this->header = new Header($raw_header);
421 421
     }
422 422
 
@@ -427,8 +427,8 @@  discard block
 block discarded – undo
427 427
     public function parseRawFlags($raw_flags) {
428 428
         $this->flags = FlagCollection::make([]);
429 429
 
430
-        foreach($raw_flags as $flag) {
431
-            if (strpos($flag, "\\") === 0){
430
+        foreach ($raw_flags as $flag) {
431
+            if (strpos($flag, "\\") === 0) {
432 432
                 $flag = substr($flag, 1);
433 433
             }
434 434
             $flag_key = strtolower($flag);
@@ -501,7 +501,7 @@  discard block
 block discarded – undo
501 501
      * @throws MessageFlagException
502 502
      * @throws Exceptions\RuntimeException
503 503
      */
504
-    public function peek(){
504
+    public function peek() {
505 505
         if ($this->fetch_options == IMAP::FT_PEEK) {
506 506
             if ($this->getFlags()->get("seen") == null) {
507 507
                 $this->unsetFlag("Seen");
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
     private function fetchPart(Part $part) {
551 551
         if ($part->isAttachment()) {
552 552
             $this->fetchAttachment($part);
553
-        }else{
553
+        }else {
554 554
             $encoding = $this->getEncoding($part);
555 555
 
556 556
             $content = $this->decodeString($part->content, $part->encoding);
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
 
576 576
             if (isset($this->bodies[$subtype])) {
577 577
                 $this->bodies[$subtype] .= "\n".$content;
578
-            }else{
578
+            }else {
579 579
                 $this->bodies[$subtype] = $content;
580 580
             }
581 581
         }
@@ -591,7 +591,7 @@  discard block
 block discarded – undo
591 591
         if ($oAttachment->getName() !== null && $oAttachment->getSize() > 0) {
592 592
             if ($oAttachment->getId() !== null) {
593 593
                 $this->attachments->put($oAttachment->getId(), $oAttachment);
594
-            } else {
594
+            }else {
595 595
                 $this->attachments->push($oAttachment);
596 596
             }
597 597
         }
@@ -725,7 +725,7 @@  discard block
 block discarded – undo
725 725
 
726 726
         if (function_exists('iconv') && $from != 'UTF-7' && $to != 'UTF-7') {
727 727
             return @iconv($from, $to.'//IGNORE', $str);
728
-        } else {
728
+        }else {
729 729
             if (!$from) {
730 730
                 return mb_convert_encoding($str, $to);
731 731
             }
@@ -746,9 +746,9 @@  discard block
 block discarded – undo
746 746
                     return EncodingAliases::get($parameter->value);
747 747
                 }
748 748
             }
749
-        }elseif (property_exists($structure, 'charset')){
749
+        }elseif (property_exists($structure, 'charset')) {
750 750
             return EncodingAliases::get($structure->charset);
751
-        }elseif (is_string($structure) === true){
751
+        }elseif (is_string($structure) === true) {
752 752
             return mb_detect_encoding($structure);
753 753
         }
754 754
 
@@ -763,7 +763,7 @@  discard block
 block discarded – undo
763 763
      * @throws Exceptions\FolderFetchingException
764 764
      * @throws Exceptions\RuntimeException
765 765
      */
766
-    public function getFolder(){
766
+    public function getFolder() {
767 767
         return $this->client->getFolderByPath($this->folder_path);
768 768
     }
769 769
 
@@ -779,13 +779,13 @@  discard block
 block discarded – undo
779 779
      * @throws Exceptions\GetMessagesFailedException
780 780
      * @throws Exceptions\RuntimeException
781 781
      */
782
-    public function thread($sent_folder = null, &$thread = null, $folder = null){
782
+    public function thread($sent_folder = null, &$thread = null, $folder = null) {
783 783
         $thread = $thread ? $thread : MessageCollection::make([]);
784
-        $folder = $folder ? $folder :  $this->getFolder();
784
+        $folder = $folder ? $folder : $this->getFolder();
785 785
         $sent_folder = $sent_folder ? $sent_folder : $this->client->getFolderByPath(ClientManager::get("options.common_folders.sent", "INBOX/Sent"));
786 786
 
787 787
         /** @var Message $message */
788
-        foreach($thread as $message) {
788
+        foreach ($thread as $message) {
789 789
             if ($message->message_id->first() == $this->message_id->first()) {
790 790
                 return $thread;
791 791
             }
@@ -796,7 +796,7 @@  discard block
 block discarded – undo
796 796
         $this->fetchThreadByInReplyTo($thread, $this->message_id, $sent_folder, $folder, $sent_folder);
797 797
 
798 798
         if (is_array($this->in_reply_to)) {
799
-            foreach($this->in_reply_to as $in_reply_to) {
799
+            foreach ($this->in_reply_to as $in_reply_to) {
800 800
                 $this->fetchThreadByMessageId($thread, $in_reply_to, $folder, $folder, $sent_folder);
801 801
                 $this->fetchThreadByMessageId($thread, $in_reply_to, $sent_folder, $folder, $sent_folder);
802 802
             }
@@ -817,7 +817,7 @@  discard block
 block discarded – undo
817 817
      * @throws Exceptions\GetMessagesFailedException
818 818
      * @throws Exceptions\RuntimeException
819 819
      */
820
-    protected function fetchThreadByInReplyTo(&$thread, $in_reply_to, $primary_folder, $secondary_folder, $sent_folder){
820
+    protected function fetchThreadByInReplyTo(&$thread, $in_reply_to, $primary_folder, $secondary_folder, $sent_folder) {
821 821
         $primary_folder->query()->inReplyTo($in_reply_to)
822 822
         ->setFetchBody($this->getFetchBodyOption())
823 823
         ->leaveUnread()->get()->each(function($message) use(&$thread, $secondary_folder, $sent_folder){
@@ -838,7 +838,7 @@  discard block
 block discarded – undo
838 838
      * @throws Exceptions\GetMessagesFailedException
839 839
      * @throws Exceptions\RuntimeException
840 840
      */
841
-    protected function fetchThreadByMessageId(&$thread, $message_id, $primary_folder, $secondary_folder, $sent_folder){
841
+    protected function fetchThreadByMessageId(&$thread, $message_id, $primary_folder, $secondary_folder, $sent_folder) {
842 842
         $primary_folder->query()->messageId($message_id)
843 843
         ->setFetchBody($this->getFetchBodyOption())
844 844
         ->leaveUnread()->get()->each(function($message) use(&$thread, $secondary_folder, $sent_folder){
@@ -934,14 +934,14 @@  discard block
 block discarded – undo
934 934
      * @throws MessageFlagException
935 935
      * @throws MessageHeaderFetchingException
936 936
      */
937
-    protected function fetchNewMail($folder, $next_uid, $event, $expunge){
938
-        if($expunge) $this->client->expunge();
937
+    protected function fetchNewMail($folder, $next_uid, $event, $expunge) {
938
+        if ($expunge) $this->client->expunge();
939 939
 
940 940
         $this->client->openFolder($folder->path);
941 941
 
942 942
         if ($this->sequence === IMAP::ST_UID) {
943 943
             $sequence_id = $next_uid;
944
-        }else{
944
+        }else {
945 945
             $sequence_id = $this->client->getConnection()->getMessageNumber($next_uid);
946 946
         }
947 947
 
@@ -964,7 +964,7 @@  discard block
 block discarded – undo
964 964
      */
965 965
     public function delete($expunge = true) {
966 966
         $status = $this->setFlag("Deleted");
967
-        if($expunge) $this->client->expunge();
967
+        if ($expunge) $this->client->expunge();
968 968
 
969 969
         $event = $this->getEvent("message", "deleted");
970 970
         $event::dispatch($this);
@@ -984,7 +984,7 @@  discard block
 block discarded – undo
984 984
      */
985 985
     public function restore($expunge = true) {
986 986
         $status = $this->unsetFlag("Deleted");
987
-        if($expunge) $this->client->expunge();
987
+        if ($expunge) $this->client->expunge();
988 988
 
989 989
         $event = $this->getEvent("message", "restored");
990 990
         $event::dispatch($this);
@@ -1089,7 +1089,7 @@  discard block
 block discarded – undo
1089 1089
      *
1090 1090
      * @return AttachmentCollection
1091 1091
      */
1092
-    public function attachments(){
1092
+    public function attachments() {
1093 1093
         return $this->getAttachments();
1094 1094
     }
1095 1095
 
@@ -1187,7 +1187,7 @@  discard block
 block discarded – undo
1187 1187
      *
1188 1188
      * @return FlagCollection
1189 1189
      */
1190
-    public function flags(){
1190
+    public function flags() {
1191 1191
         return $this->getFlags();
1192 1192
     }
1193 1193
 
@@ -1196,7 +1196,7 @@  discard block
 block discarded – undo
1196 1196
      *
1197 1197
      * @return Structure|null
1198 1198
      */
1199
-    public function getStructure(){
1199
+    public function getStructure() {
1200 1200
         return $this->structure;
1201 1201
     }
1202 1202
 
@@ -1222,7 +1222,7 @@  discard block
 block discarded – undo
1222 1222
      *
1223 1223
      * @return array
1224 1224
      */
1225
-    public function getAttributes(){
1225
+    public function getAttributes() {
1226 1226
         return array_merge($this->attributes, $this->header->getAttributes());
1227 1227
     }
1228 1228
 
@@ -1232,8 +1232,8 @@  discard block
 block discarded – undo
1232 1232
      *
1233 1233
      * @return $this
1234 1234
      */
1235
-    public function setMask($mask){
1236
-        if(class_exists($mask)){
1235
+    public function setMask($mask) {
1236
+        if (class_exists($mask)) {
1237 1237
             $this->mask = $mask;
1238 1238
         }
1239 1239
 
@@ -1245,7 +1245,7 @@  discard block
 block discarded – undo
1245 1245
      *
1246 1246
      * @return string
1247 1247
      */
1248
-    public function getMask(){
1248
+    public function getMask() {
1249 1249
         return $this->mask;
1250 1250
     }
1251 1251
 
@@ -1256,9 +1256,9 @@  discard block
 block discarded – undo
1256 1256
      * @return mixed
1257 1257
      * @throws MaskNotFoundException
1258 1258
      */
1259
-    public function mask($mask = null){
1259
+    public function mask($mask = null) {
1260 1260
         $mask = $mask !== null ? $mask : $this->mask;
1261
-        if(class_exists($mask)){
1261
+        if (class_exists($mask)) {
1262 1262
             return new $mask($this);
1263 1263
         }
1264 1264
 
@@ -1270,7 +1270,7 @@  discard block
 block discarded – undo
1270 1270
      *
1271 1271
      * @return string
1272 1272
      */
1273
-    public function getFolderPath(){
1273
+    public function getFolderPath() {
1274 1274
         return $this->folder_path;
1275 1275
     }
1276 1276
 
@@ -1280,7 +1280,7 @@  discard block
 block discarded – undo
1280 1280
      *
1281 1281
      * @return $this
1282 1282
      */
1283
-    public function setFolderPath($folder_path){
1283
+    public function setFolderPath($folder_path) {
1284 1284
         $this->folder_path = $folder_path;
1285 1285
 
1286 1286
         return $this;
@@ -1292,7 +1292,7 @@  discard block
 block discarded – undo
1292 1292
      *
1293 1293
      * @return $this
1294 1294
      */
1295
-    public function setConfig($config){
1295
+    public function setConfig($config) {
1296 1296
         $this->config = $config;
1297 1297
 
1298 1298
         return $this;
@@ -1304,7 +1304,7 @@  discard block
 block discarded – undo
1304 1304
      *
1305 1305
      * @return $this
1306 1306
      */
1307
-    public function setAvailableFlags($available_flags){
1307
+    public function setAvailableFlags($available_flags) {
1308 1308
         $this->available_flags = $available_flags;
1309 1309
 
1310 1310
         return $this;
@@ -1316,7 +1316,7 @@  discard block
 block discarded – undo
1316 1316
      *
1317 1317
      * @return $this
1318 1318
      */
1319
-    public function setAttachments($attachments){
1319
+    public function setAttachments($attachments) {
1320 1320
         $this->attachments = $attachments;
1321 1321
 
1322 1322
         return $this;
@@ -1328,7 +1328,7 @@  discard block
 block discarded – undo
1328 1328
      *
1329 1329
      * @return $this
1330 1330
      */
1331
-    public function setFlags($flags){
1331
+    public function setFlags($flags) {
1332 1332
         $this->flags = $flags;
1333 1333
 
1334 1334
         return $this;
@@ -1342,7 +1342,7 @@  discard block
 block discarded – undo
1342 1342
      * @throws Exceptions\RuntimeException
1343 1343
      * @throws Exceptions\ConnectionFailedException
1344 1344
      */
1345
-    public function setClient($client){
1345
+    public function setClient($client) {
1346 1346
         $this->client = $client;
1347 1347
         $this->client->openFolder($this->folder_path);
1348 1348
 
@@ -1357,7 +1357,7 @@  discard block
 block discarded – undo
1357 1357
      * @throws Exceptions\MessageNotFoundException
1358 1358
      * @throws Exceptions\ConnectionFailedException
1359 1359
      */
1360
-    public function setUid($uid){
1360
+    public function setUid($uid) {
1361 1361
         $this->uid = $uid;
1362 1362
         $this->msgn = $this->client->getConnection()->getMessageNumber($this->uid);
1363 1363
         $this->msglist = null;
@@ -1374,7 +1374,7 @@  discard block
 block discarded – undo
1374 1374
      * @throws Exceptions\MessageNotFoundException
1375 1375
      * @throws Exceptions\ConnectionFailedException
1376 1376
      */
1377
-    public function setMsgn($msgn, $msglist = null){
1377
+    public function setMsgn($msgn, $msglist = null) {
1378 1378
         $this->msgn = $msgn;
1379 1379
         $this->msglist = $msglist;
1380 1380
         $this->uid = $this->client->getConnection()->getUid($this->msgn);
@@ -1387,7 +1387,7 @@  discard block
 block discarded – undo
1387 1387
      *
1388 1388
      * @return int
1389 1389
      */
1390
-    public function getSequence(){
1390
+    public function getSequence() {
1391 1391
         return $this->sequence;
1392 1392
     }
1393 1393
 
@@ -1396,7 +1396,7 @@  discard block
 block discarded – undo
1396 1396
      *
1397 1397
      * @return int
1398 1398
      */
1399
-    public function getSequenceId(){
1399
+    public function getSequenceId() {
1400 1400
         return $this->sequence === IMAP::ST_UID ? $this->uid : $this->msgn;
1401 1401
     }
1402 1402
 
@@ -1408,11 +1408,11 @@  discard block
 block discarded – undo
1408 1408
      * @throws Exceptions\ConnectionFailedException
1409 1409
      * @throws Exceptions\MessageNotFoundException
1410 1410
      */
1411
-    public function setSequenceId($uid, $msglist = null){
1411
+    public function setSequenceId($uid, $msglist = null) {
1412 1412
         if ($this->getSequence() === IMAP::ST_UID) {
1413 1413
             $this->setUid($uid);
1414 1414
             $this->setMsglist($msglist);
1415
-        }else{
1415
+        }else {
1416 1416
             $this->setMsgn($uid, $msglist);
1417 1417
         }
1418 1418
     }
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.