Passed
Push — master ( 4dc410...354c27 )
by Malte
03:19
created
src/Connection/Protocols/LegacyProtocol.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -89,16 +89,16 @@  discard block
 block discarded – undo
89 89
             throw new AuthFailedException($message);
90 90
         }
91 91
 
92
-        if(!$this->stream) {
92
+        if (!$this->stream) {
93 93
             $errors = \imap_errors();
94 94
             $message = implode("; ", (is_array($errors) ? $errors : array()));
95 95
             throw new AuthFailedException($message);
96 96
         }
97 97
 
98 98
         $errors = \imap_errors();
99
-        if(is_array($errors)) {
99
+        if (is_array($errors)) {
100 100
             $status = $this->examineFolder();
101
-            if($status['exists'] !== 0) {
101
+            if ($status['exists'] !== 0) {
102 102
                 $message = implode("; ", (is_array($errors) ? $errors : array()));
103 103
                 throw new RuntimeException($message);
104 104
             }
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
         if (!$this->cert_validation) {
130 130
             $address .= '/novalidate-cert';
131 131
         }
132
-        if (in_array($this->encryption,['tls', 'notls', 'ssl'])) {
132
+        if (in_array($this->encryption, ['tls', 'notls', 'ssl'])) {
133 133
             $address .= '/'.$this->encryption;
134 134
         } elseif ($this->encryption === "starttls") {
135 135
             $address .= '/tls';
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
      *
161 161
      * @return bool
162 162
      */
163
-    public function connected(){
163
+    public function connected() {
164 164
         return boolval($this->stream);
165 165
     }
166 166
 
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
      *
234 234
      * @return array
235 235
      */
236
-    public function headers($uids, $rfc = "RFC822", $uid = IMAP::ST_UID){
236
+    public function headers($uids, $rfc = "RFC822", $uid = IMAP::ST_UID) {
237 237
         $result = [];
238 238
         $uids = is_array($uids) ? $uids : [$uids];
239 239
         foreach ($uids as $id) {
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
      *
250 250
      * @return array
251 251
      */
252
-    public function flags($uids, $uid = IMAP::ST_UID){
252
+    public function flags($uids, $uid = IMAP::ST_UID) {
253 253
         $result = [];
254 254
         $uids = is_array($uids) ? $uids : [$uids];
255 255
         foreach ($uids as $id) {
@@ -257,8 +257,8 @@  discard block
 block discarded – undo
257 257
             $flags = [];
258 258
             if (is_array($raw_flags) && isset($raw_flags[0])) {
259 259
                 $raw_flags = (array) $raw_flags[0];
260
-                foreach($raw_flags as $flag => $value) {
261
-                    if ($value === 1 && in_array($flag, ["size", "uid", "msgno", "update"]) === false){
260
+                foreach ($raw_flags as $flag => $value) {
261
+                    if ($value === 1 && in_array($flag, ["size", "uid", "msgno", "update"]) === false) {
262 262
                         $flags[] = "\\".ucfirst($flag);
263 263
                     }
264 264
                 }
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 
284 284
             $overview = $this->overview("1:*");
285 285
             $uids = [];
286
-            foreach($overview as $set){
286
+            foreach ($overview as $set) {
287 287
                 $uids[$set->msgno] = $set->uid;
288 288
             }
289 289
 
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
      * @return array
313 313
      */
314 314
     public function overview($sequence, $uid = IMAP::ST_UID) {
315
-        return \imap_fetch_overview($this->stream, $sequence,$uid ? IMAP::ST_UID : IMAP::NIL);
315
+        return \imap_fetch_overview($this->stream, $sequence, $uid ? IMAP::ST_UID : IMAP::NIL);
316 316
     }
317 317
 
318 318
     /**
@@ -327,12 +327,12 @@  discard block
 block discarded – undo
327 327
         $result = [];
328 328
 
329 329
         $items = \imap_getmailboxes($this->stream, $this->getAddress(), $reference.$folder);
330
-        if(is_array($items)){
330
+        if (is_array($items)) {
331 331
             foreach ($items as $item) {
332 332
                 $name = $this->decodeFolderName($item->name);
333 333
                 $result[$name] = ['delimiter' => $item->delimiter, 'flags' => []];
334 334
             }
335
-        }else{
335
+        }else {
336 336
             throw new RuntimeException(\imap_last_error());
337 337
         }
338 338
 
@@ -354,9 +354,9 @@  discard block
 block discarded – undo
354 354
     public function store(array $flags, $from, $to = null, $mode = null, $silent = true, $uid = IMAP::ST_UID) {
355 355
         $flag = trim(is_array($flags) ? implode(" ", $flags) : $flags);
356 356
 
357
-        if ($mode == "+"){
357
+        if ($mode == "+") {
358 358
             $status = \imap_setflag_full($this->stream, $from, $flag, $uid ? IMAP::ST_UID : IMAP::NIL);
359
-        }else{
359
+        }else {
360 360
             $status = \imap_clearflag_full($this->stream, $from, $flag, $uid ? IMAP::ST_UID : IMAP::NIL);
361 361
         }
362 362
 
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
      */
379 379
     public function appendMessage($folder, $message, $flags = null, $date = null) {
380 380
         if ($date != null) {
381
-            if ($date instanceof \Carbon\Carbon){
381
+            if ($date instanceof \Carbon\Carbon) {
382 382
                 $date = $date->format('d-M-Y H:i:s O');
383 383
             }
384 384
             return \imap_append($this->stream, $folder, $message, $flags, $date);
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
      * @return array|bool Tokens if operation successful, false if an error occurred
411 411
      */
412 412
     public function copyManyMessages($messages, $folder, $uid = IMAP::ST_UID) {
413
-        foreach($messages as $msg) {
413
+        foreach ($messages as $msg) {
414 414
             if ($this->copyMessage($folder, $msg, null, $uid) == false) {
415 415
                 return false;
416 416
             }
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
      * @return array|bool Tokens if operation successful, false if an error occurred
443 443
      */
444 444
     public function moveManyMessages($messages, $folder, $uid = IMAP::ST_UID) {
445
-        foreach($messages as $msg) {
445
+        foreach ($messages as $msg) {
446 446
             if ($this->moveMessage($folder, $msg, null, $uid) == false) {
447 447
                 return false;
448 448
             }
@@ -565,14 +565,14 @@  discard block
 block discarded – undo
565 565
     /**
566 566
      * Enable the debug mode
567 567
      */
568
-    public function enableDebug(){
568
+    public function enableDebug() {
569 569
         $this->debug = true;
570 570
     }
571 571
 
572 572
     /**
573 573
      * Disable the debug mode
574 574
      */
575
-    public function disableDebug(){
575
+    public function disableDebug() {
576 576
         $this->debug = false;
577 577
     }
578 578
 
Please login to merge, or discard this patch.
src/Query/Query.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 
96 96
         if (ClientManager::get('options.fetch_order') === 'desc') {
97 97
             $this->fetch_order = 'desc';
98
-        } else {
98
+        }else {
99 99
             $this->fetch_order = 'asc';
100 100
         }
101 101
 
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
                 break;
127 127
         }
128 128
 
129
-        return (string)$value;
129
+        return (string) $value;
130 130
     }
131 131
 
132 132
     /**
@@ -158,14 +158,14 @@  discard block
 block discarded – undo
158 158
         $this->query->each(function($statement) use (&$query) {
159 159
             if (count($statement) == 1) {
160 160
                 $query .= $statement[0];
161
-            } else {
161
+            }else {
162 162
                 if ($statement[1] === null) {
163 163
                     $query .= $statement[0];
164
-                } else {
164
+                }else {
165 165
                     if (is_numeric($statement[1])) {
166
-                        $query .= $statement[0] . ' ' . $statement[1];
167
-                    } else {
168
-                        $query .= $statement[0] . ' "' . $statement[1] . '"';
166
+                        $query .= $statement[0].' '.$statement[1];
167
+                    }else {
168
+                        $query .= $statement[0].' "'.$statement[1].'"';
169 169
                     }
170 170
                 }
171 171
             }
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
                 $key = $message->getMessageId();
300 300
                 break;
301 301
         }
302
-        return (string)$key;
302
+        return (string) $key;
303 303
     }
304 304
 
305 305
     /**
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
             $extensions = isset($raw_messages["extensions"][$uid]) ? $raw_messages["extensions"][$uid] : [];
348 348
 
349 349
             $message = $this->make($uid, $msglist, $header, $content, $flag);
350
-            foreach($extensions as $key => $extension) {
350
+            foreach ($extensions as $key => $extension) {
351 351
                 $message->getHeader()->set($key, $extension);
352 352
             }
353 353
             if ($message !== null) {
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
         $uids = $connection->getUid();
500 500
         $available_messages = new Collection();
501 501
         if (is_array($uids)) {
502
-            foreach ($uids as $id){
502
+            foreach ($uids as $id) {
503 503
                 if ($closure($id)) {
504 504
                     $available_messages->push($id);
505 505
                 }
Please login to merge, or discard this patch.
src/Header.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 
92 92
         }
93 93
 
94
-        throw new MethodNotFoundException("Method " . self::class . '::' . $method . '() is not supported');
94
+        throw new MethodNotFoundException("Method ".self::class.'::'.$method.'() is not supported');
95 95
     }
96 96
 
97 97
     /**
@@ -130,20 +130,20 @@  discard block
 block discarded – undo
130 130
         if (isset($this->attributes[$name]) && $strict === false) {
131 131
             if ($this->attributize) {
132 132
                 $this->attributes[$name]->add($value, true);
133
-            } else {
133
+            }else {
134 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 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
 
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
         $headers = [];
237 237
         $imap_headers = [];
238 238
         if (extension_loaded('imap') && $this->config["rfc822"]) {
239
-            $raw_imap_headers = (array)\imap_rfc822_parse_headers($this->raw);
239
+            $raw_imap_headers = (array) \imap_rfc822_parse_headers($this->raw);
240 240
             foreach ($raw_imap_headers as $key => $values) {
241 241
                 $key = str_replace("-", "_", $key);
242 242
                 $imap_headers[$key] = $values;
@@ -264,11 +264,11 @@  discard block
 block discarded – undo
264 264
                     }
265 265
                     if (is_array($headers[$prev_header])) {
266 266
                         $headers[$prev_header][] = $line;
267
-                    } else {
267
+                    }else {
268 268
                         $headers[$prev_header] .= $line;
269 269
                     }
270 270
                 }
271
-            } else {
271
+            }else {
272 272
                 if (($pos = strpos($line, ":")) > 0) {
273 273
                     $key = trim(rtrim(strtolower(substr($line, 0, $pos))));
274 274
                     $key = str_replace("-", "_", $key);
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
                     $value = trim(rtrim(substr($line, $pos + 1)));
277 277
                     if (isset($headers[$key])) {
278 278
                         $headers[$key][] = $value;
279
-                    } else {
279
+                    }else {
280 280
                         $headers[$key] = [$value];
281 281
                     }
282 282
                     $prev_header = $key;
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
                 case 'reply_to':
296 296
                 case 'sender':
297 297
                     $value = $this->decodeAddresses($values);
298
-                    $headers[$key . "address"] = implode(", ", $values);
298
+                    $headers[$key."address"] = implode(", ", $values);
299 299
                     break;
300 300
                 case 'subject':
301 301
                     $value = implode(" ", $values);
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
                             $value = implode(" ", $values);
315 315
                         } elseif ($available_values > 2) {
316 316
                             $value = array_values($values);
317
-                        } else {
317
+                        }else {
318 318
                             $value = "";
319 319
                         }
320 320
                     }
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
             $headers[$key] = $value;
324 324
         }
325 325
 
326
-        return (object)array_merge($headers, $imap_headers);
326
+        return (object) array_merge($headers, $imap_headers);
327 327
     }
328 328
 
329 329
     /**
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
             return \imap_mime_header_decode($text);
340 340
         }
341 341
         $charset = $this->getEncoding($text);
342
-        return [(object)[
342
+        return [(object) [
343 343
             "charset" => $charset,
344 344
             "text"    => $this->convertEncoding($text, $charset)
345 345
         ]];
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
         try {
394 394
             if (function_exists('iconv') && $from != 'UTF-7' && $to != 'UTF-7') {
395 395
                 return iconv($from, $to, $str);
396
-            } else {
396
+            }else {
397 397
                 if (!$from) {
398 398
                     return mb_convert_encoding($str, $to);
399 399
                 }
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
             if (strstr($from, '-')) {
404 404
                 $from = str_replace('-', '', $from);
405 405
                 return $this->convertEncoding($str, $from, $to);
406
-            } else {
406
+            }else {
407 407
                 return $str;
408 408
             }
409 409
         }
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
      */
508 508
     private function findPriority() {
509 509
         if (($priority = $this->get("x_priority")) === null) return;
510
-        switch ((int)"$priority") {
510
+        switch ((int) "$priority") {
511 511
             case IMAP::MESSAGE_PRIORITY_HIGHEST;
512 512
                 $priority = IMAP::MESSAGE_PRIORITY_HIGHEST;
513 513
                 break;
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
                     if (isset($parsed_address['address'])) {
547 547
                         $mail_address = explode('@', $parsed_address['address']);
548 548
                         if (count($mail_address) == 2) {
549
-                            $addresses[] = (object)[
549
+                            $addresses[] = (object) [
550 550
                                 "personal" => isset($parsed_address['display']) ? $parsed_address['display'] : '',
551 551
                                 "mailbox"  => $mail_address[0],
552 552
                                 "host"     => $mail_address[1],
@@ -574,7 +574,7 @@  discard block
 block discarded – undo
574 574
                     $name = trim(rtrim($matches["name"]));
575 575
                     $email = trim(rtrim($matches["email"]));
576 576
                     list($mailbox, $host) = array_pad(explode("@", $email), 2, null);
577
-                    $addresses[] = (object)[
577
+                    $addresses[] = (object) [
578 578
                         "personal" => $name,
579 579
                         "mailbox"  => $mailbox,
580 580
                         "host"     => $host,
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
         }
613 613
 
614 614
         foreach ($list as $item) {
615
-            $address = (object)$item;
615
+            $address = (object) $item;
616 616
 
617 617
             if (!property_exists($address, 'mailbox')) {
618 618
                 $address->mailbox = false;
@@ -622,7 +622,7 @@  discard block
 block discarded – undo
622 622
             }
623 623
             if (!property_exists($address, 'personal')) {
624 624
                 $address->personal = false;
625
-            } else {
625
+            }else {
626 626
                 $personalParts = $this->mime_header_decode($address->personal);
627 627
 
628 628
                 if (is_array($personalParts)) {
@@ -637,8 +637,8 @@  discard block
 block discarded – undo
637 637
                 }
638 638
             }
639 639
 
640
-            $address->mail = ($address->mailbox && $address->host) ? $address->mailbox . '@' . $address->host : false;
641
-            $address->full = ($address->personal) ? $address->personal . ' <' . $address->mail . '>' : $address->mail;
640
+            $address->mail = ($address->mailbox && $address->host) ? $address->mailbox.'@'.$address->host : false;
641
+            $address->full = ($address->personal) ? $address->personal.' <'.$address->mail.'>' : $address->mail;
642 642
 
643 643
             $addresses[] = new Address($address);
644 644
         }
@@ -653,8 +653,8 @@  discard block
 block discarded – undo
653 653
         foreach ($this->attributes as $key => $value) {
654 654
             if (is_array($value)) {
655 655
                 $value = implode(", ", $value);
656
-            } else {
657
-                $value = (string)$value;
656
+            }else {
657
+                $value = (string) $value;
658 658
             }
659 659
             // Only parse strings and don't parse any attributes like the user-agent
660 660
             if (in_array($key, ["user_agent"]) === false) {
@@ -735,8 +735,8 @@  discard block
 block discarded – undo
735 735
                     $parsed_date = Carbon::parse($date);
736 736
                 } catch (\Exception $_e) {
737 737
                     if (!isset($this->config["fallback_date"])) {
738
-                        throw new InvalidMessageDateException("Invalid message date. ID:" . $this->get("message_id") . " Date:" . $header->date . "/" . $date, 1100, $e);
739
-                    } else {
738
+                        throw new InvalidMessageDateException("Invalid message date. ID:".$this->get("message_id")." Date:".$header->date."/".$date, 1100, $e);
739
+                    }else {
740 740
                         $parsed_date = Carbon::parse($this->config["fallback_date"]);
741 741
                     }
742 742
                 }
Please login to merge, or discard this patch.