Passed
Pull Request — master (#242)
by
unknown
08:12
created
src/Connection/Protocols/ImapProtocol.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
         $stack = [];
152 152
 
153 153
         //  replace any trailing <NL> including spaces with a single space
154
-        $line = rtrim($line) . ' ';
154
+        $line = rtrim($line).' ';
155 155
         while (($pos = strpos($line, ' ')) !== false) {
156 156
             $token = substr($line, 0, $pos);
157 157
             if (!strlen($token)) {
@@ -181,11 +181,11 @@  discard block
 block discarded – undo
181 181
                     if (strlen($token) > $chars) {
182 182
                         $line = substr($token, $chars);
183 183
                         $token = substr($token, 0, $chars);
184
-                    } else {
184
+                    }else {
185 185
                         $line .= $this->nextLine();
186 186
                     }
187 187
                     $tokens[] = $token;
188
-                    $line = trim($line) . ' ';
188
+                    $line = trim($line).' ';
189 189
                     continue;
190 190
                 }
191 191
             }
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
         $line = $this->nextTaggedLine($tag); // get next tag
236 236
         if (!$dontParse) {
237 237
             $tokens = $this->decodeLine($line);
238
-        } else {
238
+        }else {
239 239
             $tokens = $line;
240 240
         }
241 241
         if ($this->debug) echo "<< ".$line."\n";
@@ -287,27 +287,27 @@  discard block
 block discarded – undo
287 287
     public function sendRequest(string $command, array $tokens = [], ?string &$tag = null): void {
288 288
         if (!$tag) {
289 289
             $this->noun++;
290
-            $tag = 'TAG' . $this->noun;
290
+            $tag = 'TAG'.$this->noun;
291 291
         }
292 292
 
293
-        $line = $tag . ' ' . $command;
293
+        $line = $tag.' '.$command;
294 294
 
295 295
         foreach ($tokens as $token) {
296 296
             if (is_array($token)) {
297
-                if (fwrite($this->stream, $line . ' ' . $token[0] . "\r\n") === false) {
297
+                if (fwrite($this->stream, $line.' '.$token[0]."\r\n") === false) {
298 298
                     throw new RuntimeException('failed to write - connection closed?');
299 299
                 }
300 300
                 if (!$this->assumedNextLine('+ ')) {
301 301
                     throw new RuntimeException('failed to send literal string');
302 302
                 }
303 303
                 $line = $token[1];
304
-            } else {
305
-                $line .= ' ' . $token;
304
+            }else {
305
+                $line .= ' '.$token;
306 306
             }
307 307
         }
308 308
         if ($this->debug) echo ">> ".$line."\n";
309 309
 
310
-        if (fwrite($this->stream, $line . "\r\n") === false) {
310
+        if (fwrite($this->stream, $line."\r\n") === false) {
311 311
             throw new RuntimeException('failed to write - connection closed?');
312 312
         }
313 313
     }
@@ -337,9 +337,9 @@  discard block
 block discarded – undo
337 337
     public function escapeString($string) {
338 338
         if (func_num_args() < 2) {
339 339
             if (strpos($string, "\n") !== false) {
340
-                return ['{' . strlen($string) . '}', $string];
340
+                return ['{'.strlen($string).'}', $string];
341 341
             }
342
-            return '"' . str_replace(['\\', '"'], ['\\\\', '\\"'], $string) . '"';
342
+            return '"'.str_replace(['\\', '"'], ['\\\\', '\\"'], $string).'"';
343 343
         }
344 344
         $result = [];
345 345
         foreach (func_get_args() as $string) {
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
             }
364 364
             $result[] = $this->escapeList($v);
365 365
         }
366
-        return '(' . implode(' ', $result) . ')';
366
+        return '('.implode(' ', $result).')';
367 367
     }
368 368
 
369 369
     /**
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
                     error_log("got an extra server challenge: $response");
405 405
                     // respond with an empty response.
406 406
                     $this->sendRequest('');
407
-                } else {
407
+                }else {
408 408
                     if (preg_match('/^NO /i', $response) ||
409 409
                         preg_match('/^BAD /i', $response)) {
410 410
                         error_log("got failure response: $response");
@@ -491,10 +491,10 @@  discard block
 block discarded – undo
491 491
                     $result[strtolower($tokens[1])] = $tokens[0];
492 492
                     break;
493 493
                 case '[UIDVALIDITY':
494
-                    $result['uidvalidity'] = (int)$tokens[2];
494
+                    $result['uidvalidity'] = (int) $tokens[2];
495 495
                     break;
496 496
                 case '[UIDNEXT':
497
-                    $result['uidnext'] = (int)$tokens[2];
497
+                    $result['uidnext'] = (int) $tokens[2];
498 498
                     break;
499 499
                 default:
500 500
                     // ignore
@@ -551,14 +551,14 @@  discard block
 block discarded – undo
551 551
         if (is_array($from)) {
552 552
             $set = implode(',', $from);
553 553
         } elseif ($to === null) {
554
-            $set = (int)$from;
554
+            $set = (int) $from;
555 555
         } elseif ($to === INF) {
556
-            $set = (int)$from . ':*';
557
-        } else {
558
-            $set = (int)$from . ':' . (int)$to;
556
+            $set = (int) $from.':*';
557
+        }else {
558
+            $set = (int) $from.':'.(int) $to;
559 559
         }
560 560
 
561
-        $items = (array)$items;
561
+        $items = (array) $items;
562 562
         $itemList = $this->escapeList($items);
563 563
 
564 564
         $this->sendRequest($this->buildUIDCommand("FETCH", $uid), [$set, $itemList], $tag);
@@ -576,9 +576,9 @@  discard block
 block discarded – undo
576 576
                 $count = is_countable($tokens[2]) ? count($tokens[2]) : 0;
577 577
                 if ($tokens[2][$count - 2] == 'UID') {
578 578
                     $uidKey = $count - 1;
579
-                } else if ($tokens[2][0] == 'UID') {
579
+                }else if ($tokens[2][0] == 'UID') {
580 580
                     $uidKey = 1;
581
-                } else {
581
+                }else {
582 582
                     $uidKey = array_search('UID', $tokens[2]) + 1;
583 583
                 }
584 584
             }
@@ -595,7 +595,7 @@  discard block
 block discarded – undo
595 595
                     $data = $tokens[2][1];
596 596
                 } elseif ($uid && $tokens[2][2] == $items[0]) {
597 597
                     $data = $tokens[2][3];
598
-                } else {
598
+                }else {
599 599
                     // maybe the server send an other field we didn't wanted
600 600
                     $count = is_countable($tokens[2]) ? count($tokens[2]) : 0;
601 601
                     // we start with 2, because 0 was already checked
@@ -607,7 +607,7 @@  discard block
 block discarded – undo
607 607
                         break;
608 608
                     }
609 609
                 }
610
-            } else {
610
+            }else {
611 611
                 $data = [];
612 612
                 while (key($tokens[2]) !== null) {
613 613
                     $data[current($tokens[2])] = next($tokens[2]);
@@ -624,7 +624,7 @@  discard block
 block discarded – undo
624 624
             }
625 625
             if ($uid) {
626 626
                 $result[$tokens[2][$uidKey]] = $data;
627
-            }else{
627
+            }else {
628 628
                 $result[$tokens[0]] = $data;
629 629
             }
630 630
         }
@@ -690,7 +690,7 @@  discard block
 block discarded – undo
690 690
 
691 691
         if ($this->enable_uid_cache && $this->uid_cache) {
692 692
             $uids = $this->uid_cache;
693
-        } else {
693
+        }else {
694 694
             try {
695 695
                 $uids = $this->fetch('UID', 1, INF);
696 696
                 $this->setUidCache($uids); // set cache for this folder
@@ -790,7 +790,7 @@  discard block
 block discarded – undo
790 790
         $response = $this->requestAndResponse($command, [$set, $item, $flags], $silent);
791 791
 
792 792
         if ($silent) {
793
-            return (bool)$response;
793
+            return (bool) $response;
794 794
         }
795 795
 
796 796
         $result = [];
@@ -1094,7 +1094,7 @@  discard block
 block discarded – undo
1094 1094
         $ids = [];
1095 1095
         foreach ($uids as $msgn => $v) {
1096 1096
             $id = $uid ? $v : $msgn;
1097
-            if ( ($to >= $id && $from <= $id) || ($to === "*" && $from <= $id) ){
1097
+            if (($to >= $id && $from <= $id) || ($to === "*" && $from <= $id)) {
1098 1098
                 $ids[] = $id;
1099 1099
             }
1100 1100
         }
@@ -1127,10 +1127,10 @@  discard block
 block discarded – undo
1127 1127
      * @return int|string
1128 1128
      */
1129 1129
     public function buildSet($from, $to = null) {
1130
-        $set = (int)$from;
1130
+        $set = (int) $from;
1131 1131
         if ($to === null) {
1132 1132
             return $set;
1133 1133
         }
1134
-        return $set . ':' . ($to == INF ? '*' : (int)$to);
1134
+        return $set.':'.($to == INF ? '*' : (int) $to);
1135 1135
     }
1136 1136
 }
Please login to merge, or discard this patch.
src/Part.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
     protected function parse(): void {
160 160
         if ($this->header === null) {
161 161
             $body = $this->findHeaders();
162
-        }else{
162
+        }else {
163 163
             $body = $this->raw;
164 164
         }
165 165
 
@@ -171,11 +171,11 @@  discard block
 block discarded – undo
171 171
         $this->name = $this->header->get("name");
172 172
         $this->filename = $this->header->get("filename");
173 173
 
174
-        if(!empty($this->header->get("id"))) {
174
+        if (!empty($this->header->get("id"))) {
175 175
             $this->id = $this->header->get("id");
176
-        } else if(!empty($this->header->get("x_attachment_id"))){
176
+        }else if (!empty($this->header->get("x_attachment_id"))) {
177 177
             $this->id = $this->header->get("x_attachment_id");
178
-        } else if(!empty($this->header->get("content_id"))){
178
+        }else if (!empty($this->header->get("content_id"))) {
179 179
             $this->id = strtr($this->header->get("content_id"), [
180 180
                 '<' => '',
181 181
                 '>' => ''
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
         }
184 184
 
185 185
         $content_types = $this->header->get("content_type");
186
-        if(!empty($content_types)){
186
+        if (!empty($content_types)) {
187 187
             $this->subtype = $this->parseSubtype($content_types);
188 188
             $content_type = $content_types;
189 189
             if (is_array($content_types)) {
@@ -223,16 +223,16 @@  discard block
 block discarded – undo
223 223
      *
224 224
      * @return string
225 225
      */
226
-    private function parseSubtype($content_type){
226
+    private function parseSubtype($content_type) {
227 227
         if (is_array($content_type)) {
228
-            foreach ($content_type as $part){
229
-                if ((strpos($part, "/")) !== false){
228
+            foreach ($content_type as $part) {
229
+                if ((strpos($part, "/")) !== false) {
230 230
                     return $this->parseSubtype($part);
231 231
                 }
232 232
             }
233 233
             return null;
234 234
         }
235
-        if (($pos = strpos($content_type, "/")) !== false){
235
+        if (($pos = strpos($content_type, "/")) !== false) {
236 236
             return substr($content_type, $pos + 1);
237 237
         }
238 238
         return null;
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
      */
244 244
     private function parseDisposition(): void {
245 245
         $content_disposition = $this->header->get("content_disposition");
246
-        if($content_disposition !== null) {
246
+        if ($content_disposition !== null) {
247 247
             $this->ifdisposition = true;
248 248
             $this->disposition = (is_array($content_disposition)) ? implode(' ', $content_disposition) : $content_disposition;
249 249
         }
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
      */
255 255
     private function parseDescription(): void {
256 256
         $content_description = $this->header->get("content_description");
257
-        if($content_description !== null) {
257
+        if ($content_description !== null) {
258 258
             $this->ifdescription = true;
259 259
             $this->description = $content_description;
260 260
         }
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
      */
266 266
     private function parseEncoding(): void {
267 267
         $encoding = $this->header->get("content_transfer_encoding");
268
-        if($encoding !== null) {
268
+        if ($encoding !== null) {
269 269
             switch (strtolower($encoding)) {
270 270
                 case "quoted-printable":
271 271
                     $this->encoding = IMAP::MESSAGE_ENC_QUOTED_PRINTABLE;
Please login to merge, or discard this patch.
src/Message.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
         $this->boot();
169 169
 
170 170
         $default_mask = $client->getDefaultMessageMask();
171
-        if($default_mask != null) {
171
+        if ($default_mask != null) {
172 172
             $this->mask = $default_mask;
173 173
         }
174 174
         $this->events["message"] = $client->getDefaultEvents("message");
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
         $instance->boot();
227 227
 
228 228
         $default_mask = $client->getDefaultMessageMask();
229
-        if($default_mask != null) {
229
+        if ($default_mask != null) {
230 230
             $instance->setMask($default_mask);
231 231
         }
232 232
         $instance->setEvents([
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
         }
277 277
         if (strtolower(substr($method, 0, 3)) === 'set') {
278 278
             $name = Str::snake(substr($method, 3));
279
-            if(in_array($name, array_keys($this->attributes))) {
279
+            if (in_array($name, array_keys($this->attributes))) {
280 280
                 return $this->__set($name, array_pop($arguments));
281 281
             }
282 282
         }
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
      * @return Attribute|mixed|null
315 315
      */
316 316
     public function get($name) {
317
-        if(isset($this->attributes[$name])) {
317
+        if (isset($this->attributes[$name])) {
318 318
             return $this->attributes[$name];
319 319
         }
320 320
 
@@ -399,8 +399,8 @@  discard block
 block discarded – undo
399 399
     public function parseRawFlags(array $raw_flags): void {
400 400
         $this->flags = FlagCollection::make([]);
401 401
 
402
-        foreach($raw_flags as $flag) {
403
-            if (strpos($flag, "\\") === 0){
402
+        foreach ($raw_flags as $flag) {
403
+            if (strpos($flag, "\\") === 0) {
404 404
                 $flag = substr($flag, 1);
405 405
             }
406 406
             $flag_key = strtolower($flag);
@@ -521,7 +521,7 @@  discard block
 block discarded – undo
521 521
     private function fetchPart(Part $part): void {
522 522
         if ($part->isAttachment()) {
523 523
             $this->fetchAttachment($part);
524
-        }else{
524
+        }else {
525 525
             $encoding = $this->getEncoding($part);
526 526
 
527 527
             $content = $this->decodeString($part->content, $part->encoding);
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
 
547 547
             if (isset($this->bodies[$subtype])) {
548 548
                 $this->bodies[$subtype] .= "\n".$content;
549
-            }else{
549
+            }else {
550 550
                 $this->bodies[$subtype] = $content;
551 551
             }
552 552
         }
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
         }
567 567
         if ($oAttachment->getId() !== null) {
568 568
             $this->attachments->put($oAttachment->getId(), $oAttachment);
569
-        } else {
569
+        }else {
570 570
             $this->attachments->push($oAttachment);
571 571
         }
572 572
     }
@@ -712,9 +712,9 @@  discard block
 block discarded – undo
712 712
                     return EncodingAliases::get($parameter->value, "ISO-8859-2");
713 713
                 }
714 714
             }
715
-        }elseif (property_exists($structure, 'charset')){
715
+        }elseif (property_exists($structure, 'charset')) {
716 716
             return EncodingAliases::get($structure->charset, "ISO-8859-2");
717
-        }elseif (is_string($structure) === true){
717
+        }elseif (is_string($structure) === true) {
718 718
             return mb_detect_encoding($structure);
719 719
         }
720 720
 
@@ -729,7 +729,7 @@  discard block
 block discarded – undo
729 729
      * @throws Exceptions\FolderFetchingException
730 730
      * @throws Exceptions\RuntimeException
731 731
      */
732
-    public function getFolder(){
732
+    public function getFolder() {
733 733
         return $this->client->getFolderByPath($this->folder_path);
734 734
     }
735 735
 
@@ -745,13 +745,13 @@  discard block
 block discarded – undo
745 745
      * @throws Exceptions\GetMessagesFailedException
746 746
      * @throws Exceptions\RuntimeException
747 747
      */
748
-    public function thread(Folder $sent_folder = null, MessageCollection &$thread = null, Folder $folder = null): MessageCollection {
748
+    public function thread(Folder $sent_folder = null, MessageCollection & $thread = null, Folder $folder = null): MessageCollection {
749 749
         $thread = $thread ?: MessageCollection::make([]);
750
-        $folder = $folder ?:  $this->getFolder();
750
+        $folder = $folder ?: $this->getFolder();
751 751
         $sent_folder = $sent_folder ?: $this->client->getFolderByPath(ClientManager::get("options.common_folders.sent", "INBOX/Sent"));
752 752
 
753 753
         /** @var Message $message */
754
-        foreach($thread as $message) {
754
+        foreach ($thread as $message) {
755 755
             if ($message->message_id->first() == $this->message_id->first()) {
756 756
                 return $thread;
757 757
             }
@@ -762,7 +762,7 @@  discard block
 block discarded – undo
762 762
         $this->fetchThreadByInReplyTo($thread, $this->message_id, $sent_folder, $folder, $sent_folder);
763 763
 
764 764
         if (is_array($this->in_reply_to)) {
765
-            foreach($this->in_reply_to as $in_reply_to) {
765
+            foreach ($this->in_reply_to as $in_reply_to) {
766 766
                 $this->fetchThreadByMessageId($thread, $in_reply_to, $folder, $folder, $sent_folder);
767 767
                 $this->fetchThreadByMessageId($thread, $in_reply_to, $sent_folder, $folder, $sent_folder);
768 768
             }
@@ -784,7 +784,7 @@  discard block
 block discarded – undo
784 784
      * @throws Exceptions\RuntimeException
785 785
      * @throws Exceptions\FolderFetchingException
786 786
      */
787
-    protected function fetchThreadByInReplyTo(MessageCollection &$thread, string $in_reply_to, Folder $primary_folder, Folder $secondary_folder, Folder $sent_folder): void{
787
+    protected function fetchThreadByInReplyTo(MessageCollection & $thread, string $in_reply_to, Folder $primary_folder, Folder $secondary_folder, Folder $sent_folder): void{
788 788
         $primary_folder->query()->inReplyTo($in_reply_to)
789 789
         ->setFetchBody($this->getFetchBodyOption())
790 790
         ->leaveUnread()->get()->each(function($message) use(&$thread, $secondary_folder, $sent_folder): void{
@@ -806,7 +806,7 @@  discard block
 block discarded – undo
806 806
      * @throws Exceptions\RuntimeException
807 807
      * @throws Exceptions\FolderFetchingException
808 808
      */
809
-    protected function fetchThreadByMessageId(MessageCollection &$thread, string $message_id, Folder $primary_folder, Folder $secondary_folder, Folder $sent_folder): void{
809
+    protected function fetchThreadByMessageId(MessageCollection & $thread, string $message_id, Folder $primary_folder, Folder $secondary_folder, Folder $sent_folder): void{
810 810
         $primary_folder->query()->messageId($message_id)
811 811
         ->setFetchBody($this->getFetchBodyOption())
812 812
         ->leaveUnread()->get()->each(function($message) use(&$thread, $secondary_folder, $sent_folder): void{
@@ -901,13 +901,13 @@  discard block
 block discarded – undo
901 901
      * @throws MessageHeaderFetchingException
902 902
      */
903 903
     protected function fetchNewMail(Folder $folder, int $next_uid, string $event, bool $expunge): Message {
904
-        if($expunge) $this->client->expunge();
904
+        if ($expunge) $this->client->expunge();
905 905
 
906 906
         $this->client->openFolder($folder->path);
907 907
 
908 908
         if ($this->sequence === IMAP::ST_UID) {
909 909
             $sequence_id = $next_uid;
910
-        }else{
910
+        }else {
911 911
             $sequence_id = $this->client->getConnection()->getMessageNumber($next_uid);
912 912
         }
913 913
 
@@ -937,11 +937,11 @@  discard block
 block discarded – undo
937 937
      */
938 938
     public function delete(bool $expunge = true, string $trash_path = null, bool $force_move = false) {
939 939
         $status = $this->setFlag("Deleted");
940
-        if($force_move) {
940
+        if ($force_move) {
941 941
             $trash_path ??= $this->config["common_folders"]["trash"];
942 942
             $status = $this->move($trash_path);
943 943
         }
944
-        if($expunge) $this->client->expunge();
944
+        if ($expunge) $this->client->expunge();
945 945
 
946 946
         $event = $this->getEvent("message", "deleted");
947 947
         $event::dispatch($this);
@@ -961,7 +961,7 @@  discard block
 block discarded – undo
961 961
      */
962 962
     public function restore(bool $expunge = true): bool {
963 963
         $status = $this->unsetFlag("Deleted");
964
-        if($expunge) $this->client->expunge();
964
+        if ($expunge) $this->client->expunge();
965 965
 
966 966
         $event = $this->getEvent("message", "restored");
967 967
         $event::dispatch($this);
@@ -1204,7 +1204,7 @@  discard block
 block discarded – undo
1204 1204
      * @return $this
1205 1205
      */
1206 1206
     public function setMask(string $mask): self {
1207
-        if(class_exists($mask)){
1207
+        if (class_exists($mask)) {
1208 1208
             $this->mask = $mask;
1209 1209
         }
1210 1210
 
@@ -1229,7 +1229,7 @@  discard block
 block discarded – undo
1229 1229
      */
1230 1230
     public function mask($mask = null): object {
1231 1231
         $mask ??= $this->mask;
1232
-        if(class_exists($mask)){
1232
+        if (class_exists($mask)) {
1233 1233
             return new $mask($this);
1234 1234
         }
1235 1235
 
@@ -1381,7 +1381,7 @@  discard block
 block discarded – undo
1381 1381
         if ($this->getSequence() === IMAP::ST_UID) {
1382 1382
             $this->setUid($uid);
1383 1383
             $this->setMsglist($msglist);
1384
-        }else{
1384
+        }else {
1385 1385
             $this->setMsgn($uid, $msglist);
1386 1386
         }
1387 1387
     }
Please login to merge, or discard this patch.
src/Attribute.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
     public function offsetSet($offset, $value): void {
114 114
         if (is_null($offset)) {
115 115
             $this->values[] = $value;
116
-        } else {
116
+        }else {
117 117
             $this->values[$offset] = $value;
118 118
         }
119 119
     }
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
             if ($this->contains($value) === false) {
181 181
                 $this->values[] = $value;
182 182
             }
183
-        }else{
183
+        }else {
184 184
             $this->values[] = $value;
185 185
         }
186 186
     }
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
      *
228 228
      * @return mixed|null
229 229
      */
230
-    public function first(){
230
+    public function first() {
231 231
         if ($this->offsetExists(0)) {
232 232
             return $this->values[0];
233 233
         }
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
      *
240 240
      * @return mixed|null
241 241
      */
242
-    public function last(){
242
+    public function last() {
243 243
         if (($cnt = $this->count()) > 0) {
244 244
             return $this->values[$cnt - 1];
245 245
         }
Please login to merge, or discard this patch.
src/Query/WhereQuery.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -85,8 +85,8 @@  discard block
 block discarded – undo
85 85
         }
86 86
 
87 87
         if (strpos(strtolower($name), "where") === false) {
88
-            $method = 'where' . ucfirst($name);
89
-        } else {
88
+            $method = 'where'.ucfirst($name);
89
+        }else {
90 90
             $method = lcfirst($name);
91 91
         }
92 92
 
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
             return call_user_func_array([$that, $method], $arguments);
95 95
         }
96 96
 
97
-        throw new MethodNotFoundException("Method " . self::class . '::' . $method . '() is not supported');
97
+        throw new MethodNotFoundException("Method ".self::class.'::'.$method.'() is not supported');
98 98
     }
99 99
 
100 100
     /**
@@ -137,11 +137,11 @@  discard block
 block discarded – undo
137 137
             foreach ($criteria as $key => $value) {
138 138
                 if (is_numeric($key)) {
139 139
                     $this->where($value);
140
-                }else{
140
+                }else {
141 141
                     $this->where($key, $value);
142 142
                 }
143 143
             }
144
-        } else {
144
+        }else {
145 145
             $this->push_search_criteria($criteria, $value);
146 146
         }
147 147
 
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 
162 162
         if ($value === null || $value === '') {
163 163
             $this->query->push([$criteria]);
164
-        } else {
164
+        }else {
165 165
             $this->query->push([$criteria, $value]);
166 166
         }
167 167
     }
Please login to merge, or discard this patch.
src/Query/Query.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 
86 86
         if (ClientManager::get('options.fetch_order') === 'desc') {
87 87
             $this->fetch_order = 'desc';
88
-        } else {
88
+        }else {
89 89
             $this->fetch_order = 'asc';
90 90
         }
91 91
 
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
                 break;
117 117
         }
118 118
 
119
-        return (string)$value;
119
+        return (string) $value;
120 120
     }
121 121
 
122 122
     /**
@@ -148,14 +148,14 @@  discard block
 block discarded – undo
148 148
         $this->query->each(function($statement) use (&$query): void {
149 149
             if ((is_countable($statement) ? count($statement) : 0) == 1) {
150 150
                 $query .= $statement[0];
151
-            } else {
151
+            }else {
152 152
                 if ($statement[1] === null) {
153 153
                     $query .= $statement[0];
154
-                } else {
154
+                }else {
155 155
                     if (is_numeric($statement[1])) {
156
-                        $query .= $statement[0] . ' ' . $statement[1];
157
-                    } else {
158
-                        $query .= $statement[0] . ' "' . $statement[1] . '"';
156
+                        $query .= $statement[0].' '.$statement[1];
157
+                    }else {
158
+                        $query .= $statement[0].' "'.$statement[1].'"';
159 159
                     }
160 160
                 }
161 161
             }
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
         try {
181 181
             $available_messages = $this->client->getConnection()->search([$this->getRawQuery()], $this->sequence);
182 182
             return $available_messages !== false ? new Collection($available_messages) : new Collection();
183
-        } catch (RuntimeException|ConnectionFailedException $e) {
183
+        } catch (RuntimeException | ConnectionFailedException $e) {
184 184
             throw new GetMessagesFailedException("failed to fetch messages", 0, $e);
185 185
         }
186 186
     }
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
     protected function make(int $uid, int $msglist, string $header, string $content, array $flags) {
247 247
         try {
248 248
             return Message::make($uid, $msglist, $this->getClient(), $header, $content, $flags, $this->getFetchOptions(), $this->sequence);
249
-        } catch (MessageNotFoundException|RuntimeException|MessageFlagException|InvalidMessageDateException|MessageContentFetchingException $e) {
249
+        } catch (MessageNotFoundException | RuntimeException | MessageFlagException | InvalidMessageDateException | MessageContentFetchingException $e) {
250 250
             $this->setError($uid, $e);
251 251
         }
252 252
 
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
                 $key = $message->getMessageId();
279 279
                 break;
280 280
         }
281
-        return (string)$key;
281
+        return (string) $key;
282 282
     }
283 283
 
284 284
     /**
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
             $extensions = $raw_messages["extensions"][$uid] ?? [];
327 327
 
328 328
             $message = $this->make($uid, $msglist, $header, $content, $flag);
329
-            foreach($extensions as $key => $extension) {
329
+            foreach ($extensions as $key => $extension) {
330 330
                 $message->getHeader()->set($key, $extension);
331 331
             }
332 332
             if ($message !== null) {
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
         $uids = $connection->getUid();
479 479
         $available_messages = new Collection();
480 480
         if (is_array($uids)) {
481
-            foreach ($uids as $id){
481
+            foreach ($uids as $id) {
482 482
                 if ($closure($id)) {
483 483
                     $available_messages->push($id);
484 484
                 }
Please login to merge, or discard this patch.
src/Support/PaginatedCollection.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@
 block discarded – undo
68 68
      * @return int|null
69 69
      */
70 70
     public function total($total = null): ?int {
71
-        if($total === null) {
71
+        if ($total === null) {
72 72
             return $this->total;
73 73
         }
74 74
 
Please login to merge, or discard this patch.
src/Support/Masks/Mask.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
     public function __construct(object $parent) {
42 42
         $this->parent = $parent;
43 43
 
44
-        if(method_exists($this->parent, 'getAttributes')){
44
+        if (method_exists($this->parent, 'getAttributes')) {
45 45
             $this->attributes = array_merge($this->attributes, $this->parent->getAttributes());
46 46
         }
47 47
 
@@ -62,17 +62,17 @@  discard block
 block discarded – undo
62 62
      * @throws MethodNotFoundException
63 63
      */
64 64
     public function __call(string $method, array $arguments) {
65
-        if(strtolower(substr($method, 0, 3)) === 'get') {
65
+        if (strtolower(substr($method, 0, 3)) === 'get') {
66 66
             $name = Str::snake(substr($method, 3));
67 67
 
68
-            if(isset($this->attributes[$name])) {
68
+            if (isset($this->attributes[$name])) {
69 69
                 return $this->attributes[$name];
70 70
             }
71 71
 
72 72
         }elseif (strtolower(substr($method, 0, 3)) === 'set') {
73 73
             $name = Str::snake(substr($method, 3));
74 74
 
75
-            if(isset($this->attributes[$name])) {
75
+            if (isset($this->attributes[$name])) {
76 76
                 $this->attributes[$name] = array_pop($arguments);
77 77
 
78 78
                 return $this->attributes[$name];
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 
81 81
         }
82 82
 
83
-        if(method_exists($this->parent, $method) === true){
83
+        if (method_exists($this->parent, $method) === true) {
84 84
             return call_user_func_array([$this->parent, $method], $arguments);
85 85
         }
86 86
 
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
      * @return mixed|null
108 108
      */
109 109
     public function __get($name) {
110
-        if(isset($this->attributes[$name])) {
110
+        if (isset($this->attributes[$name])) {
111 111
             return $this->attributes[$name];
112 112
         }
113 113
 
Please login to merge, or discard this patch.
src/Support/Masks/MessageMask.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -30,13 +30,13 @@  discard block
 block discarded – undo
30 30
      *
31 31
      * @return null
32 32
      */
33
-    public function getHtmlBody(){
33
+    public function getHtmlBody() {
34 34
         $bodies = $this->parent->getBodies();
35 35
         if (!isset($bodies['html'])) {
36 36
             return null;
37 37
         }
38 38
 
39
-        if(is_object($bodies['html']) && property_exists($bodies['html'], 'content')) {
39
+        if (is_object($bodies['html']) && property_exists($bodies['html'], 'content')) {
40 40
             return $bodies['html']->content;
41 41
         }
42 42
         return $bodies['html'];
@@ -50,15 +50,15 @@  discard block
 block discarded – undo
50 50
      */
51 51
     public function getCustomHTMLBody($callback = false): ?string {
52 52
         $body = $this->getHtmlBody();
53
-        if($body === null) return null;
53
+        if ($body === null) return null;
54 54
 
55 55
         if ($callback !== false) {
56 56
             $aAttachment = $this->parent->getAttachments();
57 57
             $aAttachment->each(function($oAttachment) use(&$body, $callback): void {
58 58
                 /** @var Attachment $oAttachment */
59
-                if(is_callable($callback)) {
59
+                if (is_callable($callback)) {
60 60
                     $body = $callback($body, $oAttachment);
61
-                }elseif(is_string($callback)) {
61
+                }elseif (is_string($callback)) {
62 62
                     call_user_func($callback, [$body, $oAttachment]);
63 63
                 }
64 64
             });
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
      * @return string|null
75 75
      */
76 76
     public function getHTMLBodyWithEmbeddedBase64Images(): ?string {
77
-        return $this->getCustomHTMLBody(function($body, $oAttachment){
77
+        return $this->getCustomHTMLBody(function($body, $oAttachment) {
78 78
             /** @var Attachment $oAttachment */
79 79
             if ($oAttachment->id) {
80 80
                 $body = str_replace('cid:'.$oAttachment->id, 'data:'.$oAttachment->getContentType().';base64, '.base64_encode($oAttachment->getContent()), $body);
Please login to merge, or discard this patch.