@@ -16,7 +16,7 @@ |
||
16 | 16 | * New custom method which can be called through a mask |
17 | 17 | * @return string |
18 | 18 | */ |
19 | - public function token(){ |
|
19 | + public function token() { |
|
20 | 20 | return implode('-', [$this->message_id, $this->uid, $this->message_no]); |
21 | 21 | } |
22 | 22 |
@@ -16,7 +16,7 @@ |
||
16 | 16 | * New custom method which can be called through a mask |
17 | 17 | * @return string |
18 | 18 | */ |
19 | - public function token(){ |
|
19 | + public function token() { |
|
20 | 20 | return implode('-', [$this->id, $this->getMessage()->getUid(), $this->name]); |
21 | 21 | } |
22 | 22 |
@@ -26,8 +26,8 @@ |
||
26 | 26 | </tr> |
27 | 27 | </thead> |
28 | 28 | <tbody> |
29 | - <?php if($paginator->count() > 0): ?> |
|
30 | - <?php foreach($paginator as $message): ?> |
|
29 | + <?php if ($paginator->count() > 0): ?> |
|
30 | + <?php foreach ($paginator as $message): ?> |
|
31 | 31 | <tr> |
32 | 32 | <td><?php echo $message->getUid(); ?></td> |
33 | 33 | <td><?php echo $message->getSubject(); ?></td> |
@@ -24,8 +24,8 @@ |
||
24 | 24 | </tr> |
25 | 25 | </thead> |
26 | 26 | <tbody> |
27 | - <?php if($paginator->count() > 0): ?> |
|
28 | - <?php foreach($paginator as $folder): ?> |
|
27 | + <?php if ($paginator->count() > 0): ?> |
|
28 | + <?php foreach ($paginator as $folder): ?> |
|
29 | 29 | <tr> |
30 | 30 | <td><?php echo $folder->name; ?></td> |
31 | 31 | <td><?php echo $folder->search()->unseen()->setFetchBody(false)->count(); ?></td> |
@@ -5,8 +5,8 @@ |
||
5 | 5 | use Rector\Config\RectorConfig; |
6 | 6 | use Rector\Set\ValueObject\SetList; |
7 | 7 | |
8 | -return static function (RectorConfig $containerConfigurator): void { |
|
9 | - $containerConfigurator->paths([__DIR__ . '/src', __DIR__ . '/tests']); |
|
8 | +return static function(RectorConfig $containerConfigurator): void { |
|
9 | + $containerConfigurator->paths([__DIR__.'/src', __DIR__.'/tests']); |
|
10 | 10 | |
11 | 11 | $containerConfigurator->import(SetList::PHP_54); |
12 | 12 | $containerConfigurator->import(SetList::PHP_55); |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | |
96 | 96 | } |
97 | 97 | |
98 | - throw new MethodNotFoundException("Method " . self::class . '::' . $method . '() is not supported'); |
|
98 | + throw new MethodNotFoundException("Method ".self::class.'::'.$method.'() is not supported'); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |
@@ -130,20 +130,20 @@ discard block |
||
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])) { |
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) { |
145 | 145 | $this->attributes[$name] = $value; |
146 | - } else { |
|
146 | + }else { |
|
147 | 147 | $this->attributes[$name] = new Attribute($name, $value); |
148 | 148 | } |
149 | 149 | |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | $headers = []; |
236 | 236 | $imap_headers = []; |
237 | 237 | if (extension_loaded('imap') && $this->config["rfc822"]) { |
238 | - $raw_imap_headers = (array)imap_rfc822_parse_headers($this->raw); |
|
238 | + $raw_imap_headers = (array) imap_rfc822_parse_headers($this->raw); |
|
239 | 239 | foreach ($raw_imap_headers as $key => $values) { |
240 | 240 | $key = str_replace("-", "_", $key); |
241 | 241 | $imap_headers[$key] = $values; |
@@ -263,11 +263,11 @@ discard block |
||
263 | 263 | } |
264 | 264 | if (is_array($headers[$prev_header])) { |
265 | 265 | $headers[$prev_header][] = $line; |
266 | - } else { |
|
266 | + }else { |
|
267 | 267 | $headers[$prev_header] .= $line; |
268 | 268 | } |
269 | 269 | } |
270 | - } else { |
|
270 | + }else { |
|
271 | 271 | if (($pos = strpos($line, ":")) > 0) { |
272 | 272 | $key = trim(rtrim(strtolower(substr($line, 0, $pos)))); |
273 | 273 | $key = str_replace("-", "_", $key); |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | $value = trim(rtrim(substr($line, $pos + 1))); |
276 | 276 | if (isset($headers[$key])) { |
277 | 277 | $headers[$key][] = $value; |
278 | - } else { |
|
278 | + }else { |
|
279 | 279 | $headers[$key] = [$value]; |
280 | 280 | } |
281 | 281 | $prev_header = $key; |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | case 'reply_to': |
295 | 295 | case 'sender': |
296 | 296 | $value = $this->decodeAddresses($values); |
297 | - $headers[$key . "address"] = implode(", ", $values); |
|
297 | + $headers[$key."address"] = implode(", ", $values); |
|
298 | 298 | break; |
299 | 299 | case 'subject': |
300 | 300 | $value = implode(" ", $values); |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | $value = implode(" ", $values); |
314 | 314 | } elseif ($available_values > 2) { |
315 | 315 | $value = array_values($values); |
316 | - } else { |
|
316 | + }else { |
|
317 | 317 | $value = ""; |
318 | 318 | } |
319 | 319 | } |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | $headers[$key] = $value; |
323 | 323 | } |
324 | 324 | |
325 | - return (object)array_merge($headers, $imap_headers); |
|
325 | + return (object) array_merge($headers, $imap_headers); |
|
326 | 326 | } |
327 | 327 | |
328 | 328 | /** |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | return imap_mime_header_decode($text); |
339 | 339 | } |
340 | 340 | $charset = $this->getEncoding($text); |
341 | - return [(object)[ |
|
341 | + return [(object) [ |
|
342 | 342 | "charset" => $charset, |
343 | 343 | "text" => $this->convertEncoding($text, $charset) |
344 | 344 | ]]; |
@@ -501,7 +501,7 @@ discard block |
||
501 | 501 | */ |
502 | 502 | private function findPriority(): void { |
503 | 503 | if (($priority = $this->get("x_priority")) === null) return; |
504 | - switch ((int)"$priority") { |
|
504 | + switch ((int) "$priority") { |
|
505 | 505 | case IMAP::MESSAGE_PRIORITY_HIGHEST; |
506 | 506 | $priority = IMAP::MESSAGE_PRIORITY_HIGHEST; |
507 | 507 | break; |
@@ -540,7 +540,7 @@ discard block |
||
540 | 540 | if (isset($parsed_address['address'])) { |
541 | 541 | $mail_address = explode('@', $parsed_address['address']); |
542 | 542 | if (count($mail_address) == 2) { |
543 | - $addresses[] = (object)[ |
|
543 | + $addresses[] = (object) [ |
|
544 | 544 | "personal" => $parsed_address['display'] ?? '', |
545 | 545 | "mailbox" => $mail_address[0], |
546 | 546 | "host" => $mail_address[1], |
@@ -568,7 +568,7 @@ discard block |
||
568 | 568 | $name = trim(rtrim($matches["name"])); |
569 | 569 | $email = trim(rtrim($matches["email"])); |
570 | 570 | [$mailbox, $host] = array_pad(explode("@", $email), 2, null); |
571 | - $addresses[] = (object)[ |
|
571 | + $addresses[] = (object) [ |
|
572 | 572 | "personal" => $name, |
573 | 573 | "mailbox" => $mailbox, |
574 | 574 | "host" => $host, |
@@ -605,7 +605,7 @@ discard block |
||
605 | 605 | } |
606 | 606 | |
607 | 607 | foreach ($list as $item) { |
608 | - $address = (object)$item; |
|
608 | + $address = (object) $item; |
|
609 | 609 | |
610 | 610 | if (!property_exists($address, 'mailbox')) { |
611 | 611 | $address->mailbox = false; |
@@ -615,7 +615,7 @@ discard block |
||
615 | 615 | } |
616 | 616 | if (!property_exists($address, 'personal')) { |
617 | 617 | $address->personal = false; |
618 | - } else { |
|
618 | + }else { |
|
619 | 619 | $personalParts = $this->mime_header_decode($address->personal); |
620 | 620 | |
621 | 621 | if (is_array($personalParts)) { |
@@ -630,8 +630,8 @@ discard block |
||
630 | 630 | } |
631 | 631 | } |
632 | 632 | |
633 | - $address->mail = ($address->mailbox && $address->host) ? $address->mailbox . '@' . $address->host : false; |
|
634 | - $address->full = ($address->personal) ? $address->personal . ' <' . $address->mail . '>' : $address->mail; |
|
633 | + $address->mail = ($address->mailbox && $address->host) ? $address->mailbox.'@'.$address->host : false; |
|
634 | + $address->full = ($address->personal) ? $address->personal.' <'.$address->mail.'>' : $address->mail; |
|
635 | 635 | |
636 | 636 | $addresses[] = new Address($address); |
637 | 637 | } |
@@ -646,8 +646,8 @@ discard block |
||
646 | 646 | foreach ($this->attributes as $key => $value) { |
647 | 647 | if (is_array($value)) { |
648 | 648 | $value = implode(", ", $value); |
649 | - } else { |
|
650 | - $value = (string)$value; |
|
649 | + }else { |
|
650 | + $value = (string) $value; |
|
651 | 651 | } |
652 | 652 | // Only parse strings and don't parse any attributes like the user-agent |
653 | 653 | if (($key == "user_agent") === false) { |
@@ -726,7 +726,7 @@ discard block |
||
726 | 726 | $parsed_date = Carbon::parse($date); |
727 | 727 | } catch (Exception $_e) { |
728 | 728 | if (!isset($this->config["fallback_date"])) { |
729 | - throw new InvalidMessageDateException("Invalid message date. ID:" . $this->get("message_id") . " Date:" . $header->date . "/" . $date, 1100, $e); |
|
729 | + throw new InvalidMessageDateException("Invalid message date. ID:".$this->get("message_id")." Date:".$header->date."/".$date, 1100, $e); |
|
730 | 730 | } |
731 | 731 | $parsed_date = Carbon::parse($this->config["fallback_date"]); |
732 | 732 | } |
@@ -79,9 +79,9 @@ discard block |
||
79 | 79 | public function findContentType(): void{ |
80 | 80 | $content_type = $this->header->get("content_type"); |
81 | 81 | $content_type = is_array($content_type) ? implode(' ', $content_type) : $content_type; |
82 | - if(stripos($content_type, 'multipart') === 0) { |
|
82 | + if (stripos($content_type, 'multipart') === 0) { |
|
83 | 83 | $this->type = IMAP::MESSAGE_TYPE_MULTIPART; |
84 | - }else{ |
|
84 | + }else { |
|
85 | 85 | $this->type = IMAP::MESSAGE_TYPE_TEXT; |
86 | 86 | } |
87 | 87 | } |
@@ -118,9 +118,9 @@ discard block |
||
118 | 118 | * @throws InvalidMessageDateException |
119 | 119 | */ |
120 | 120 | private function detectParts(string $boundary, string $context, int $part_number = 0): array { |
121 | - $base_parts = explode( $boundary, $context); |
|
121 | + $base_parts = explode($boundary, $context); |
|
122 | 122 | $final_parts = []; |
123 | - foreach($base_parts as $ctx) { |
|
123 | + foreach ($base_parts as $ctx) { |
|
124 | 124 | $ctx = substr($ctx, 2); |
125 | 125 | if ($ctx !== "--" && $ctx != "") { |
126 | 126 | $parts = $this->parsePart($ctx, $part_number); |
@@ -142,8 +142,8 @@ discard block |
||
142 | 142 | * @throws InvalidMessageDateException |
143 | 143 | */ |
144 | 144 | public function find_parts(): array { |
145 | - if($this->type === IMAP::MESSAGE_TYPE_MULTIPART) { |
|
146 | - if (($boundary = $this->header->getBoundary()) === null) { |
|
145 | + if ($this->type === IMAP::MESSAGE_TYPE_MULTIPART) { |
|
146 | + if (($boundary = $this->header->getBoundary()) === null) { |
|
147 | 147 | throw new MessageContentFetchingException("no content found", 0); |
148 | 148 | } |
149 | 149 |
@@ -76,17 +76,17 @@ discard block |
||
76 | 76 | public static function get(string $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 | } |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | */ |
175 | 175 | public function setConfig($config): self { |
176 | 176 | |
177 | - if(is_array($config) === false) { |
|
177 | + if (is_array($config) === false) { |
|
178 | 178 | $config = require $config; |
179 | 179 | } |
180 | 180 | |
@@ -184,17 +184,17 @@ discard block |
||
184 | 184 | $vendor_config = require $path; |
185 | 185 | $config = $this->array_merge_recursive_distinct($vendor_config, $config); |
186 | 186 | |
187 | - if(is_array($config)){ |
|
188 | - if(isset($config['default'])){ |
|
189 | - if(isset($config['accounts']) && $config['default'] != false){ |
|
187 | + if (is_array($config)) { |
|
188 | + if (isset($config['default'])) { |
|
189 | + if (isset($config['accounts']) && $config['default'] != false) { |
|
190 | 190 | |
191 | 191 | $default_config = $vendor_config['accounts']['default']; |
192 | - if(isset($config['accounts'][$config['default']])){ |
|
192 | + if (isset($config['accounts'][$config['default']])) { |
|
193 | 193 | $default_config = array_merge($default_config, $config['accounts'][$config['default']]); |
194 | 194 | } |
195 | 195 | |
196 | - if(is_array($config['accounts'])){ |
|
197 | - foreach($config['accounts'] as $account_key => $account){ |
|
196 | + if (is_array($config['accounts'])) { |
|
197 | + foreach ($config['accounts'] as $account_key => $account) { |
|
198 | 198 | $config['accounts'][$account_key] = array_merge($default_config, $account); |
199 | 199 | } |
200 | 200 | } |
@@ -233,20 +233,20 @@ discard block |
||
233 | 233 | return array_keys($arr) !== range(0, count($arr) - 1); |
234 | 234 | }; |
235 | 235 | |
236 | - if(!is_array($base)) $base = empty($base) ? array() : array($base); |
|
236 | + if (!is_array($base)) $base = empty($base) ? array() : array($base); |
|
237 | 237 | |
238 | - foreach($arrays as $append) { |
|
238 | + foreach ($arrays as $append) { |
|
239 | 239 | |
240 | - if(!is_array($append)) $append = array($append); |
|
240 | + if (!is_array($append)) $append = array($append); |
|
241 | 241 | |
242 | - foreach($append as $key => $value) { |
|
242 | + foreach ($append as $key => $value) { |
|
243 | 243 | |
244 | - if(!array_key_exists($key, $base) and !is_numeric($key)) { |
|
244 | + if (!array_key_exists($key, $base) and !is_numeric($key)) { |
|
245 | 245 | $base[$key] = $value; |
246 | 246 | continue; |
247 | 247 | } |
248 | 248 | |
249 | - if( |
|
249 | + if ( |
|
250 | 250 | ( |
251 | 251 | is_array($value) |
252 | 252 | && $isAssoc($value) |
@@ -260,9 +260,9 @@ discard block |
||
260 | 260 | // else merging $baseConfig['dispositions'] = ['attachment', 'inline'] with $customConfig['dispositions'] = ['attachment'] |
261 | 261 | // results in $resultConfig['dispositions'] = ['attachment', 'inline'] |
262 | 262 | $base[$key] = $this->array_merge_recursive_distinct($base[$key], $value); |
263 | - } else if(is_numeric($key)) { |
|
264 | - if(!in_array($value, $base)) $base[] = $value; |
|
265 | - } else { |
|
263 | + }else if (is_numeric($key)) { |
|
264 | + if (!in_array($value, $base)) $base[] = $value; |
|
265 | + }else { |
|
266 | 266 | $base[$key] = $value; |
267 | 267 | } |
268 | 268 |
@@ -246,7 +246,7 @@ |
||
246 | 246 | if (is_numeric($uid)) { |
247 | 247 | return ""; |
248 | 248 | } |
249 | - return (string)$uid; |
|
249 | + return (string) $uid; |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | public function buildUIDCommand($command, $uid) : string { |