Passed
Push — master ( 4dc410...354c27 )
by Malte
03:19
created
src/Query/WhereQuery.php 2 patches
Spacing   +7 added lines, -7 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
 
@@ -155,13 +155,13 @@  discard block
 block discarded – undo
155 155
      *
156 156
      * @throws InvalidWhereQueryCriteriaException
157 157
      */
158
-    protected function push_search_criteria($criteria, $value){
158
+    protected function push_search_criteria($criteria, $value) {
159 159
         $criteria = $this->validate_criteria($criteria);
160 160
         $value = $this->parse_value($value);
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.
Braces   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -137,7 +137,7 @@  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
             }
@@ -173,7 +173,9 @@  discard block
 block discarded – undo
173 173
      */
174 174
     public function orWhere(Closure $closure = null) {
175 175
         $this->query->push(['OR']);
176
-        if ($closure !== null) $closure($this);
176
+        if ($closure !== null) {
177
+            $closure($this);
178
+        }
177 179
 
178 180
         return $this;
179 181
     }
@@ -185,7 +187,9 @@  discard block
 block discarded – undo
185 187
      */
186 188
     public function andWhere(Closure $closure = null) {
187 189
         $this->query->push(['AND']);
188
-        if ($closure !== null) $closure($this);
190
+        if ($closure !== null) {
191
+            $closure($this);
192
+        }
189 193
 
190 194
         return $this;
191 195
     }
Please login to merge, or discard this patch.
src/ClientManager.php 2 patches
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.
Braces   +15 added lines, -7 removed lines patch added patch discarded remove patch
@@ -80,13 +80,13 @@  discard block
 block discarded – undo
80 80
             if($value === null) {
81 81
                 if(isset(self::$config[$part])) {
82 82
                     $value = self::$config[$part];
83
-                }else{
83
+                } else{
84 84
                     break;
85 85
                 }
86
-            }else{
86
+            } else{
87 87
                 if(isset($value[$part])) {
88 88
                     $value = $value[$part];
89
-                }else{
89
+                } else{
90 90
                     break;
91 91
                 }
92 92
             }
@@ -234,15 +234,21 @@  discard block
 block discarded – undo
234 234
 
235 235
         // From https://stackoverflow.com/a/173479
236 236
         $isAssoc = function(array $arr) {
237
-            if (array() === $arr) return false;
237
+            if (array() === $arr) {
238
+                return false;
239
+            }
238 240
             return array_keys($arr) !== range(0, count($arr) - 1);
239 241
         };
240 242
 
241
-        if(!is_array($base)) $base = empty($base) ? array() : array($base);
243
+        if(!is_array($base)) {
244
+            $base = empty($base) ? array() : array($base);
245
+        }
242 246
 
243 247
         foreach($arrays as $append) {
244 248
 
245
-            if(!is_array($append)) $append = array($append);
249
+            if(!is_array($append)) {
250
+                $append = array($append);
251
+            }
246 252
 
247 253
             foreach($append as $key => $value) {
248 254
 
@@ -266,7 +272,9 @@  discard block
 block discarded – undo
266 272
                     // results in $resultConfig['dispositions'] = ['attachment', 'inline']
267 273
                     $base[$key] = $this->array_merge_recursive_distinct($base[$key], $append[$key]);
268 274
                 } else if(is_numeric($key)) {
269
-                    if(!in_array($value, $base)) $base[] = $value;
275
+                    if(!in_array($value, $base)) {
276
+                        $base[] = $value;
277
+                    }
270 278
                 } else {
271 279
                     $base[$key] = $value;
272 280
                 }
Please login to merge, or discard this patch.
src/Header.php 2 patches
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.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -285,7 +285,9 @@  discard block
 block discarded – undo
285 285
         }
286 286
 
287 287
         foreach ($headers as $key => $values) {
288
-            if (isset($imap_headers[$key])) continue;
288
+            if (isset($imap_headers[$key])) {
289
+                continue;
290
+            }
289 291
             $value = null;
290 292
             switch ($key) {
291 293
                 case 'from':
@@ -506,7 +508,9 @@  discard block
 block discarded – undo
506 508
      * Try to extract the priority from a given raw header string
507 509
      */
508 510
     private function findPriority() {
509
-        if (($priority = $this->get("x_priority")) === null) return;
511
+        if (($priority = $this->get("x_priority")) === null) {
512
+            return;
513
+        }
510 514
         switch ((int)"$priority") {
511 515
             case IMAP::MESSAGE_PRIORITY_HIGHEST;
512 516
                 $priority = IMAP::MESSAGE_PRIORITY_HIGHEST;
Please login to merge, or discard this patch.