Passed
Push — master ( 073bee...77c12b )
by Malte
03:50 queued 01:11
created
src/Attribute.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
      *
58 58
      * @return string
59 59
      */
60
-    public function toString(){
60
+    public function toString() {
61 61
         return $this->__toString();
62 62
     }
63 63
 
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
      *
67 67
      * @return array
68 68
      */
69
-    public function toArray(){
69
+    public function toArray() {
70 70
         return $this->values;
71 71
     }
72 72
 
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
      *
76 76
      * @return Carbon|null
77 77
      */
78
-    public function toDate(){
78
+    public function toDate() {
79 79
         $date = $this->first();
80 80
         if ($date instanceof Carbon) return $date;
81 81
 
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
     public function offsetSet($key, $value) {
113 113
         if (is_null($key)) {
114 114
             $this->values[] = $value;
115
-        } else {
115
+        }else {
116 116
             $this->values[$key] = $value;
117 117
         }
118 118
     }
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
             if ($this->contains($value) === false) {
187 187
                 $this->values[] = $value;
188 188
             }
189
-        }else{
189
+        }else {
190 190
             $this->values[] = $value;
191 191
         }
192 192
     }
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
      *
198 198
      * @return Attribute
199 199
      */
200
-    public function setName($name){
200
+    public function setName($name) {
201 201
         $this->name = $name;
202 202
 
203 203
         return $this;
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
      *
209 209
      * @return string
210 210
      */
211
-    public function getName(){
211
+    public function getName() {
212 212
         return $this->name;
213 213
     }
214 214
 
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
      *
218 218
      * @return array
219 219
      */
220
-    public function get(){
220
+    public function get() {
221 221
         return $this->values;
222 222
     }
223 223
 
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
      *
227 227
      * @return array
228 228
      */
229
-    public function all(){
229
+    public function all() {
230 230
         return $this->get();
231 231
     }
232 232
 
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
      *
236 236
      * @return mixed|null
237 237
      */
238
-    public function first(){
238
+    public function first() {
239 239
         if ($this->offsetExists(0)) {
240 240
             return $this->values[0];
241 241
         }
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
      *
248 248
      * @return mixed|null
249 249
      */
250
-    public function last(){
250
+    public function last() {
251 251
         if (($cnt = $this->count()) > 0) {
252 252
             return $this->values[$cnt - 1];
253 253
         }
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
      *
260 260
      * @return int
261 261
      */
262
-    public function count(){
262
+    public function count() {
263 263
         return count($this->values);
264 264
     }
265 265
 }
266 266
\ No newline at end of file
Please login to merge, or discard this patch.
src/Connection/Protocols/ImapProtocol.php 1 patch
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
      * @throws ConnectionFailedException
90 90
      * @throws RuntimeException
91 91
      */
92
-    protected function enableStartTls(){
92
+    protected function enableStartTls() {
93 93
         $response = $this->requestAndResponse('STARTTLS');
94 94
         $result = $response && stream_socket_enable_crypto($this->stream, true, $this->getCryptoMethod());
95 95
         if (!$result) {
@@ -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";
@@ -286,27 +286,27 @@  discard block
 block discarded – undo
286 286
     public function sendRequest($command, $tokens = [], &$tag = null) {
287 287
         if (!$tag) {
288 288
             $this->noun++;
289
-            $tag = 'TAG' . $this->noun;
289
+            $tag = 'TAG'.$this->noun;
290 290
         }
291 291
 
292
-        $line = $tag . ' ' . $command;
292
+        $line = $tag.' '.$command;
293 293
 
294 294
         foreach ($tokens as $token) {
295 295
             if (is_array($token)) {
296
-                if (fwrite($this->stream, $line . ' ' . $token[0] . "\r\n") === false) {
296
+                if (fwrite($this->stream, $line.' '.$token[0]."\r\n") === false) {
297 297
                     throw new RuntimeException('failed to write - connection closed?');
298 298
                 }
299 299
                 if (!$this->assumedNextLine('+ ')) {
300 300
                     throw new RuntimeException('failed to send literal string');
301 301
                 }
302 302
                 $line = $token[1];
303
-            } else {
304
-                $line .= ' ' . $token;
303
+            }else {
304
+                $line .= ' '.$token;
305 305
             }
306 306
         }
307 307
         if ($this->debug) echo ">> ".$line."\n";
308 308
 
309
-        if (fwrite($this->stream, $line . "\r\n") === false) {
309
+        if (fwrite($this->stream, $line."\r\n") === false) {
310 310
             throw new RuntimeException('failed to write - connection closed?');
311 311
         }
312 312
     }
@@ -336,9 +336,9 @@  discard block
 block discarded – undo
336 336
     public function escapeString($string) {
337 337
         if (func_num_args() < 2) {
338 338
             if (strpos($string, "\n") !== false) {
339
-                return ['{' . strlen($string) . '}', $string];
340
-            } else {
341
-                return '"' . str_replace(['\\', '"'], ['\\\\', '\\"'], $string) . '"';
339
+                return ['{'.strlen($string).'}', $string];
340
+            }else {
341
+                return '"'.str_replace(['\\', '"'], ['\\\\', '\\"'], $string).'"';
342 342
             }
343 343
         }
344 344
         $result = [];
@@ -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
     /**
@@ -403,12 +403,12 @@  discard block
 block discarded – undo
403 403
                     error_log("got an extra server challenge: $response");
404 404
                     // respond with an empty response.
405 405
                     $this->sendRequest('');
406
-                } else {
406
+                }else {
407 407
                     if (preg_match('/^NO /i', $response) ||
408 408
                         preg_match('/^BAD /i', $response)) {
409 409
                         error_log("got failure response: $response");
410 410
                         return false;
411
-                    } else if (preg_match("/^OK /i", $response)) {
411
+                    }else if (preg_match("/^OK /i", $response)) {
412 412
                         return true;
413 413
                     }
414 414
                 }
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
      *
442 442
      * @return bool
443 443
      */
444
-    public function connected(){
444
+    public function connected() {
445 445
         return (boolean) $this->stream;
446 446
     }
447 447
 
@@ -488,10 +488,10 @@  discard block
 block discarded – undo
488 488
                     $result[strtolower($tokens[1])] = $tokens[0];
489 489
                     break;
490 490
                 case '[UIDVALIDITY':
491
-                    $result['uidvalidity'] = (int)$tokens[2];
491
+                    $result['uidvalidity'] = (int) $tokens[2];
492 492
                     break;
493 493
                 case '[UIDNEXT':
494
-                    $result['uidnext'] = (int)$tokens[2];
494
+                    $result['uidnext'] = (int) $tokens[2];
495 495
                     break;
496 496
                 default:
497 497
                     // ignore
@@ -546,14 +546,14 @@  discard block
 block discarded – undo
546 546
         if (is_array($from)) {
547 547
             $set = implode(',', $from);
548 548
         } elseif ($to === null) {
549
-            $set = (int)$from;
549
+            $set = (int) $from;
550 550
         } elseif ($to === INF) {
551
-            $set = (int)$from . ':*';
552
-        } else {
553
-            $set = (int)$from . ':' . (int)$to;
551
+            $set = (int) $from.':*';
552
+        }else {
553
+            $set = (int) $from.':'.(int) $to;
554 554
         }
555 555
 
556
-        $items = (array)$items;
556
+        $items = (array) $items;
557 557
         $itemList = $this->escapeList($items);
558 558
 
559 559
         $this->sendRequest($this->buildUIDCommand("FETCH", $uid), [$set, $itemList], $tag);
@@ -570,9 +570,9 @@  discard block
 block discarded – undo
570 570
                 $count = count($tokens[2]);
571 571
                 if ($tokens[2][$count - 2] == 'UID') {
572 572
                     $uidKey = $count - 1;
573
-                } else if ($tokens[2][0] == 'UID') {
573
+                }else if ($tokens[2][0] == 'UID') {
574 574
                     $uidKey = 1;
575
-                } else {
575
+                }else {
576 576
                     $uidKey = array_search('UID', $tokens[2]) + 1;
577 577
                 }
578 578
             }
@@ -588,7 +588,7 @@  discard block
 block discarded – undo
588 588
                     $data = $tokens[2][1];
589 589
                 } elseif ($uid && $tokens[2][2] == $items[0]) {
590 590
                     $data = $tokens[2][3];
591
-                } else {
591
+                }else {
592 592
                     // maybe the server send an other field we didn't wanted
593 593
                     $count = count($tokens[2]);
594 594
                     // we start with 2, because 0 was already checked
@@ -600,7 +600,7 @@  discard block
 block discarded – undo
600 600
                         break;
601 601
                     }
602 602
                 }
603
-            } else {
603
+            }else {
604 604
                 $data = [];
605 605
                 while (key($tokens[2]) !== null) {
606 606
                     $data[current($tokens[2])] = next($tokens[2]);
@@ -617,7 +617,7 @@  discard block
 block discarded – undo
617 617
             }
618 618
             if ($uid) {
619 619
                 $result[$tokens[2][$uidKey]] = $data;
620
-            }else{
620
+            }else {
621 621
                 $result[$tokens[0]] = $data;
622 622
             }
623 623
         }
@@ -653,7 +653,7 @@  discard block
 block discarded – undo
653 653
      * @return array
654 654
      * @throws RuntimeException
655 655
      */
656
-    public function headers($uids, $rfc = "RFC822", $uid = IMAP::ST_UID){
656
+    public function headers($uids, $rfc = "RFC822", $uid = IMAP::ST_UID) {
657 657
         return $this->fetch(["$rfc.HEADER"], $uids, null, $uid);
658 658
     }
659 659
 
@@ -666,7 +666,7 @@  discard block
 block discarded – undo
666 666
      * @return array
667 667
      * @throws RuntimeException
668 668
      */
669
-    public function flags($uids, $uid = IMAP::ST_UID){
669
+    public function flags($uids, $uid = IMAP::ST_UID) {
670 670
         return $this->fetch(["FLAGS"], $uids, null, $uid);
671 671
     }
672 672
 
@@ -762,7 +762,7 @@  discard block
 block discarded – undo
762 762
         $response = $this->requestAndResponse($command, [$set, $item, $flags], $silent);
763 763
 
764 764
         if ($silent) {
765
-            return (bool)$response;
765
+            return (bool) $response;
766 766
         }
767 767
 
768 768
         $result = [];
@@ -1063,7 +1063,7 @@  discard block
 block discarded – undo
1063 1063
         $ids = [];
1064 1064
         foreach ($uids as $msgn => $v) {
1065 1065
             $id = $uid ? $v : $msgn;
1066
-            if ( ($to >= $id && $from <= $id) || ($to === "*" && $from <= $id) ){
1066
+            if (($to >= $id && $from <= $id) || ($to === "*" && $from <= $id)) {
1067 1067
                 $ids[] = $id;
1068 1068
             }
1069 1069
         }
@@ -1077,14 +1077,14 @@  discard block
 block discarded – undo
1077 1077
     /**
1078 1078
      * Enable the debug mode
1079 1079
      */
1080
-    public function enableDebug(){
1080
+    public function enableDebug() {
1081 1081
         $this->debug = true;
1082 1082
     }
1083 1083
 
1084 1084
     /**
1085 1085
      * Disable the debug mode
1086 1086
      */
1087
-    public function disableDebug(){
1087
+    public function disableDebug() {
1088 1088
         $this->debug = false;
1089 1089
     }
1090 1090
 
@@ -1096,9 +1096,9 @@  discard block
 block discarded – undo
1096 1096
      * @return int|string
1097 1097
      */
1098 1098
     public function buildSet($from, $to = null) {
1099
-        $set = (int)$from;
1099
+        $set = (int) $from;
1100 1100
         if ($to !== null) {
1101
-            $set .= ':' . ($to == INF ? '*' : (int)$to);
1101
+            $set .= ':'.($to == INF ? '*' : (int) $to);
1102 1102
         }
1103 1103
         return $set;
1104 1104
     }
Please login to merge, or discard this patch.
src/Part.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -159,10 +159,10 @@  discard block
 block discarded – undo
159 159
      *
160 160
      * @throws InvalidMessageDateException
161 161
      */
162
-    protected function parse(){
162
+    protected function parse() {
163 163
         if ($this->header === null) {
164 164
             $body = $this->findHeaders();
165
-        }else{
165
+        }else {
166 166
             $body = $this->raw;
167 167
         }
168 168
 
@@ -174,11 +174,11 @@  discard block
 block discarded – undo
174 174
         $this->name = $this->header->get("name");
175 175
         $this->filename = $this->header->get("filename");
176 176
 
177
-        if(!empty($this->header->get("id"))) {
177
+        if (!empty($this->header->get("id"))) {
178 178
             $this->id = $this->header->get("id");
179
-        } else if(!empty($this->header->get("x_attachment_id"))){
179
+        }else if (!empty($this->header->get("x_attachment_id"))) {
180 180
             $this->id = $this->header->get("x_attachment_id");
181
-        } else if(!empty($this->header->get("content_id"))){
181
+        }else if (!empty($this->header->get("content_id"))) {
182 182
             $this->id = strtr($this->header->get("content_id"), [
183 183
                 '<' => '',
184 184
                 '>' => ''
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
         }
187 187
 
188 188
         $content_types = $this->header->get("content_type");
189
-        if(!empty($content_types)){
189
+        if (!empty($content_types)) {
190 190
             $this->subtype = $this->parseSubtype($content_types);
191 191
             $content_type = $content_types;
192 192
             if (is_array($content_types)) {
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
      * @return string
208 208
      * @throws InvalidMessageDateException
209 209
      */
210
-    private function findHeaders(){
210
+    private function findHeaders() {
211 211
         $body = $this->raw;
212 212
         while (($pos = strpos($body, "\r\n")) > 0) {
213 213
             $body = substr($body, $pos + 2);
@@ -226,16 +226,16 @@  discard block
 block discarded – undo
226 226
      *
227 227
      * @return string
228 228
      */
229
-    private function parseSubtype($content_type){
229
+    private function parseSubtype($content_type) {
230 230
         if (is_array($content_type)) {
231
-            foreach ($content_type as $part){
232
-                if ((strpos($part, "/")) !== false){
231
+            foreach ($content_type as $part) {
232
+                if ((strpos($part, "/")) !== false) {
233 233
                     return $this->parseSubtype($part);
234 234
                 }
235 235
             }
236 236
             return null;
237 237
         }
238
-        if (($pos = strpos($content_type, "/")) !== false){
238
+        if (($pos = strpos($content_type, "/")) !== false) {
239 239
             return substr($content_type, $pos + 1);
240 240
         }
241 241
         return null;
@@ -244,9 +244,9 @@  discard block
 block discarded – undo
244 244
     /**
245 245
      * Try to parse the disposition if any is present
246 246
      */
247
-    private function parseDisposition(){
247
+    private function parseDisposition() {
248 248
         $content_disposition = $this->header->get("content_disposition");
249
-        if($content_disposition !== null) {
249
+        if ($content_disposition !== null) {
250 250
             $this->ifdisposition = true;
251 251
             $this->disposition = (is_array($content_disposition)) ? implode(' ', $content_disposition) : $content_disposition;
252 252
         }
@@ -255,9 +255,9 @@  discard block
 block discarded – undo
255 255
     /**
256 256
      * Try to parse the description if any is present
257 257
      */
258
-    private function parseDescription(){
258
+    private function parseDescription() {
259 259
         $content_description = $this->header->get("content_description");
260
-        if($content_description !== null) {
260
+        if ($content_description !== null) {
261 261
             $this->ifdescription = true;
262 262
             $this->description = $content_description;
263 263
         }
@@ -266,9 +266,9 @@  discard block
 block discarded – undo
266 266
     /**
267 267
      * Try to parse the encoding if any is present
268 268
      */
269
-    private function parseEncoding(){
269
+    private function parseEncoding() {
270 270
         $encoding = $this->header->get("content_transfer_encoding");
271
-        if($encoding !== null) {
271
+        if ($encoding !== null) {
272 272
             switch (strtolower($encoding)) {
273 273
                 case "quoted-printable":
274 274
                     $this->encoding = IMAP::MESSAGE_ENC_QUOTED_PRINTABLE;
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
      *
299 299
      * @return bool
300 300
      */
301
-    public function isAttachment(){
301
+    public function isAttachment() {
302 302
         $valid_disposition = in_array(strtolower($this->disposition), ClientManager::get('options.dispositions'));
303 303
 
304 304
         if ($this->type == IMAP::MESSAGE_TYPE_TEXT && ($this->ifdisposition == 0 || empty($this->disposition) || !$valid_disposition)) {
Please login to merge, or discard this patch.