Passed
Pull Request — master (#194)
by
unknown
03:17
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/ClientManager.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -76,17 +76,17 @@  discard block
 block discarded – undo
76 76
     public static function get($key, $default = null) {
77 77
         $parts = explode('.', $key);
78 78
         $value = null;
79
-        foreach($parts as $part) {
80
-            if($value === null) {
81
-                if(isset(self::$config[$part])) {
79
+        foreach ($parts as $part) {
80
+            if ($value === null) {
81
+                if (isset(self::$config[$part])) {
82 82
                     $value = self::$config[$part];
83
-                }else{
83
+                }else {
84 84
                     break;
85 85
                 }
86
-            }else{
87
-                if(isset($value[$part])) {
86
+            }else {
87
+                if (isset($value[$part])) {
88 88
                     $value = $value[$part];
89
-                }else{
89
+                }else {
90 90
                     break;
91 91
                 }
92 92
             }
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
      */
177 177
     public function setConfig($config) {
178 178
 
179
-        if(is_array($config) === false) {
179
+        if (is_array($config) === false) {
180 180
             $config = require $config;
181 181
         }
182 182
 
@@ -186,17 +186,17 @@  discard block
 block discarded – undo
186 186
         $vendor_config = require $path;
187 187
         $config = $this->array_merge_recursive_distinct($vendor_config, $config);
188 188
 
189
-        if(is_array($config)){
190
-            if(isset($config['default'])){
191
-                if(isset($config['accounts']) && $config['default'] != false){
189
+        if (is_array($config)) {
190
+            if (isset($config['default'])) {
191
+                if (isset($config['accounts']) && $config['default'] != false) {
192 192
 
193 193
                     $default_config = $vendor_config['accounts']['default'];
194
-                    if(isset($config['accounts'][$config['default']])){
194
+                    if (isset($config['accounts'][$config['default']])) {
195 195
                         $default_config = array_merge($default_config, $config['accounts'][$config['default']]);
196 196
                     }
197 197
 
198
-                    if(is_array($config['accounts'])){
199
-                        foreach($config['accounts'] as $account_key => $account){
198
+                    if (is_array($config['accounts'])) {
199
+                        foreach ($config['accounts'] as $account_key => $account) {
200 200
                             $config['accounts'][$account_key] = array_merge($default_config, $account);
201 201
                         }
202 202
                     }
@@ -238,20 +238,20 @@  discard block
 block discarded – undo
238 238
             return array_keys($arr) !== range(0, count($arr) - 1);
239 239
         };
240 240
 
241
-        if(!is_array($base)) $base = empty($base) ? array() : array($base);
241
+        if (!is_array($base)) $base = empty($base) ? array() : array($base);
242 242
 
243
-        foreach($arrays as $append) {
243
+        foreach ($arrays as $append) {
244 244
 
245
-            if(!is_array($append)) $append = array($append);
245
+            if (!is_array($append)) $append = array($append);
246 246
 
247
-            foreach($append as $key => $value) {
247
+            foreach ($append as $key => $value) {
248 248
 
249
-                if(!array_key_exists($key, $base) and !is_numeric($key)) {
249
+                if (!array_key_exists($key, $base) and !is_numeric($key)) {
250 250
                     $base[$key] = $append[$key];
251 251
                     continue;
252 252
                 }
253 253
 
254
-                if(
254
+                if (
255 255
                     (
256 256
                         is_array($value)
257 257
                         && $isAssoc($value)
@@ -265,9 +265,9 @@  discard block
 block discarded – undo
265 265
                     // else merging $baseConfig['dispositions'] = ['attachment', 'inline'] with $customConfig['dispositions'] = ['attachment']
266 266
                     // results in $resultConfig['dispositions'] = ['attachment', 'inline']
267 267
                     $base[$key] = $this->array_merge_recursive_distinct($base[$key], $append[$key]);
268
-                } else if(is_numeric($key)) {
269
-                    if(!in_array($value, $base)) $base[] = $value;
270
-                } else {
268
+                }else if (is_numeric($key)) {
269
+                    if (!in_array($value, $base)) $base[] = $value;
270
+                }else {
271 271
                     $base[$key] = $value;
272 272
                 }
273 273
 
Please login to merge, or discard this patch.