@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | |
124 | 124 | $this->setDelimiter($delimiter); |
125 | 125 | $this->path = $folder_name; |
126 | - $this->full_name = $this->decodeName($folder_name); |
|
126 | + $this->full_name = $this->decodeName($folder_name); |
|
127 | 127 | $this->name = $this->getSimpleName($this->delimiter, $this->full_name); |
128 | 128 | |
129 | 129 | $this->parseAttributes($attributes); |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | public function move(string $new_name, bool $expunge = true): bool { |
241 | 241 | $this->client->checkConnection(); |
242 | 242 | $status = $this->client->getConnection()->renameFolder($this->full_name, $new_name); |
243 | - if($expunge) $this->client->expunge(); |
|
243 | + if ($expunge) $this->client->expunge(); |
|
244 | 244 | |
245 | 245 | $folder = $this->client->getFolder($new_name); |
246 | 246 | $event = $this->getEvent("folder", "moved"); |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | * date string that conforms to the rfc2060 specifications for a date_time value or be a Carbon object. |
284 | 284 | */ |
285 | 285 | |
286 | - if ($internal_date instanceof Carbon){ |
|
286 | + if ($internal_date instanceof Carbon) { |
|
287 | 287 | $internal_date = $internal_date->format('d-M-Y H:i:s O'); |
288 | 288 | } |
289 | 289 | |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | */ |
317 | 317 | public function delete(bool $expunge = true): bool { |
318 | 318 | $status = $this->client->getConnection()->deleteFolder($this->path); |
319 | - if($expunge) $this->client->expunge(); |
|
319 | + if ($expunge) $this->client->expunge(); |
|
320 | 320 | |
321 | 321 | $event = $this->getEvent("folder", "deleted"); |
322 | 322 | $event::dispatch($this); |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | |
382 | 382 | if (($pos = strpos($line, "EXISTS")) !== false) { |
383 | 383 | $connection->done(); |
384 | - $msgn = (int) substr($line, 2, $pos -2); |
|
384 | + $msgn = (int) substr($line, 2, $pos - 2); |
|
385 | 385 | |
386 | 386 | $this->client->openFolder($this->path, true); |
387 | 387 | $message = $this->query()->getMessageByMsgn($msgn); |
@@ -395,13 +395,13 @@ discard block |
||
395 | 395 | $connection->done(); |
396 | 396 | $connection->idle(); |
397 | 397 | } |
398 | - }catch (Exceptions\RuntimeException $e) { |
|
399 | - if(strpos($e->getMessage(), "empty response") >= 0 && $connection->connected()) { |
|
398 | + } catch (Exceptions\RuntimeException $e) { |
|
399 | + if (strpos($e->getMessage(), "empty response") >= 0 && $connection->connected()) { |
|
400 | 400 | $connection->done(); |
401 | 401 | $connection->idle(); |
402 | 402 | continue; |
403 | 403 | } |
404 | - if(strpos($e->getMessage(), "connection closed") === false) { |
|
404 | + if (strpos($e->getMessage(), "connection closed") === false) { |
|
405 | 405 | throw $e; |
406 | 406 | } |
407 | 407 | |
@@ -449,8 +449,8 @@ discard block |
||
449 | 449 | * Set the delimiter |
450 | 450 | * @param $delimiter |
451 | 451 | */ |
452 | - public function setDelimiter($delimiter){ |
|
453 | - if(in_array($delimiter, [null, '', ' ', false]) === true) { |
|
452 | + public function setDelimiter($delimiter) { |
|
453 | + if (in_array($delimiter, [null, '', ' ', false]) === true) { |
|
454 | 454 | $delimiter = ClientManager::get('options.delimiter', '/'); |
455 | 455 | } |
456 | 456 |
@@ -240,7 +240,9 @@ discard block |
||
240 | 240 | public function move(string $new_name, bool $expunge = true): bool { |
241 | 241 | $this->client->checkConnection(); |
242 | 242 | $status = $this->client->getConnection()->renameFolder($this->full_name, $new_name); |
243 | - if($expunge) $this->client->expunge(); |
|
243 | + if($expunge) { |
|
244 | + $this->client->expunge(); |
|
245 | + } |
|
244 | 246 | |
245 | 247 | $folder = $this->client->getFolder($new_name); |
246 | 248 | $event = $this->getEvent("folder", "moved"); |
@@ -316,7 +318,9 @@ discard block |
||
316 | 318 | */ |
317 | 319 | public function delete(bool $expunge = true): bool { |
318 | 320 | $status = $this->client->getConnection()->deleteFolder($this->path); |
319 | - if($expunge) $this->client->expunge(); |
|
321 | + if($expunge) { |
|
322 | + $this->client->expunge(); |
|
323 | + } |
|
320 | 324 | |
321 | 325 | $event = $this->getEvent("folder", "deleted"); |
322 | 326 | $event::dispatch($this); |
@@ -395,7 +399,7 @@ discard block |
||
395 | 399 | $connection->done(); |
396 | 400 | $connection->idle(); |
397 | 401 | } |
398 | - }catch (Exceptions\RuntimeException $e) { |
|
402 | + } catch (Exceptions\RuntimeException $e) { |
|
399 | 403 | if(strpos($e->getMessage(), "empty response") >= 0 && $connection->connected()) { |
400 | 404 | $connection->done(); |
401 | 405 | $connection->idle(); |
@@ -89,7 +89,7 @@ discard block |
||
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) { |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | throw new RuntimeException('empty response'); |
113 | 113 | } |
114 | 114 | if ($this->debug) echo "<< ".$line."\n"; |
115 | - return $line . "\n"; |
|
115 | + return $line."\n"; |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | /** |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | $stack = []; |
167 | 167 | |
168 | 168 | // replace any trailing <NL> including spaces with a single space |
169 | - $line = rtrim($line) . ' '; |
|
169 | + $line = rtrim($line).' '; |
|
170 | 170 | while (($pos = strpos($line, ' ')) !== false) { |
171 | 171 | $token = substr($line, 0, $pos); |
172 | 172 | if (!strlen($token)) { |
@@ -196,11 +196,11 @@ discard block |
||
196 | 196 | if (strlen($token) > $chars) { |
197 | 197 | $line = substr($token, $chars); |
198 | 198 | $token = substr($token, 0, $chars); |
199 | - } else { |
|
199 | + }else { |
|
200 | 200 | $line .= $this->nextLine(); |
201 | 201 | } |
202 | 202 | $tokens[] = $token; |
203 | - $line = trim($line) . ' '; |
|
203 | + $line = trim($line).' '; |
|
204 | 204 | continue; |
205 | 205 | } |
206 | 206 | } |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | $line = $this->nextTaggedLine($tag); // get next tag |
251 | 251 | if (!$dontParse) { |
252 | 252 | $tokens = $this->decodeLine($line); |
253 | - } else { |
|
253 | + }else { |
|
254 | 254 | $tokens = $line; |
255 | 255 | } |
256 | 256 | |
@@ -300,20 +300,20 @@ discard block |
||
300 | 300 | public function sendRequest(string $command, array $tokens = [], string &$tag = null) { |
301 | 301 | if (!$tag) { |
302 | 302 | $this->noun++; |
303 | - $tag = 'TAG' . $this->noun; |
|
303 | + $tag = 'TAG'.$this->noun; |
|
304 | 304 | } |
305 | 305 | |
306 | - $line = $tag . ' ' . $command; |
|
306 | + $line = $tag.' '.$command; |
|
307 | 307 | |
308 | 308 | foreach ($tokens as $token) { |
309 | 309 | if (is_array($token)) { |
310 | - $this->write($line . ' ' . $token[0]); |
|
310 | + $this->write($line.' '.$token[0]); |
|
311 | 311 | if (!$this->assumedNextLine('+ ')) { |
312 | 312 | throw new RuntimeException('failed to send literal string'); |
313 | 313 | } |
314 | 314 | $line = $token[1]; |
315 | - } else { |
|
316 | - $line .= ' ' . $token; |
|
315 | + }else { |
|
316 | + $line .= ' '.$token; |
|
317 | 317 | } |
318 | 318 | } |
319 | 319 | $this->write($line); |
@@ -326,9 +326,9 @@ discard block |
||
326 | 326 | * @throws RuntimeException |
327 | 327 | */ |
328 | 328 | public function write(string $data) { |
329 | - if ($this->debug) echo ">> ".$data ."\n"; |
|
329 | + if ($this->debug) echo ">> ".$data."\n"; |
|
330 | 330 | |
331 | - if (fwrite($this->stream, $data . "\r\n") === false) { |
|
331 | + if (fwrite($this->stream, $data."\r\n") === false) { |
|
332 | 332 | throw new RuntimeException('failed to write - connection closed?'); |
333 | 333 | } |
334 | 334 | } |
@@ -358,9 +358,9 @@ discard block |
||
358 | 358 | public function escapeString($string) { |
359 | 359 | if (func_num_args() < 2) { |
360 | 360 | if (strpos($string, "\n") !== false) { |
361 | - return ['{' . strlen($string) . '}', $string]; |
|
362 | - } else { |
|
363 | - return '"' . str_replace(['\\', '"'], ['\\\\', '\\"'], $string) . '"'; |
|
361 | + return ['{'.strlen($string).'}', $string]; |
|
362 | + }else { |
|
363 | + return '"'.str_replace(['\\', '"'], ['\\\\', '\\"'], $string).'"'; |
|
364 | 364 | } |
365 | 365 | } |
366 | 366 | $result = []; |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | } |
386 | 386 | $result[] = $this->escapeList($v); |
387 | 387 | } |
388 | - return '(' . implode(' ', $result) . ')'; |
|
388 | + return '('.implode(' ', $result).')'; |
|
389 | 389 | } |
390 | 390 | |
391 | 391 | /** |
@@ -426,12 +426,12 @@ discard block |
||
426 | 426 | error_log("got an extra server challenge: $response"); |
427 | 427 | // respond with an empty response. |
428 | 428 | $this->sendRequest(''); |
429 | - } else { |
|
429 | + }else { |
|
430 | 430 | if (preg_match('/^NO /i', $response) || |
431 | 431 | preg_match('/^BAD /i', $response)) { |
432 | 432 | error_log("got failure response: $response"); |
433 | 433 | return false; |
434 | - } else if (preg_match("/^OK /i", $response)) { |
|
434 | + }else if (preg_match("/^OK /i", $response)) { |
|
435 | 435 | return true; |
436 | 436 | } |
437 | 437 | } |
@@ -512,10 +512,10 @@ discard block |
||
512 | 512 | $result[strtolower($tokens[1])] = $tokens[0]; |
513 | 513 | break; |
514 | 514 | case '[UIDVALIDITY': |
515 | - $result['uidvalidity'] = (int)$tokens[2]; |
|
515 | + $result['uidvalidity'] = (int) $tokens[2]; |
|
516 | 516 | break; |
517 | 517 | case '[UIDNEXT': |
518 | - $result['uidnext'] = (int)$tokens[2]; |
|
518 | + $result['uidnext'] = (int) $tokens[2]; |
|
519 | 519 | break; |
520 | 520 | default: |
521 | 521 | // ignore |
@@ -572,14 +572,14 @@ discard block |
||
572 | 572 | if (is_array($from)) { |
573 | 573 | $set = implode(',', $from); |
574 | 574 | } elseif ($to === null) { |
575 | - $set = (int)$from; |
|
575 | + $set = (int) $from; |
|
576 | 576 | } elseif ($to === INF) { |
577 | - $set = (int)$from . ':*'; |
|
578 | - } else { |
|
579 | - $set = (int)$from . ':' . (int)$to; |
|
577 | + $set = (int) $from.':*'; |
|
578 | + }else { |
|
579 | + $set = (int) $from.':'.(int) $to; |
|
580 | 580 | } |
581 | 581 | |
582 | - $items = (array)$items; |
|
582 | + $items = (array) $items; |
|
583 | 583 | $itemList = $this->escapeList($items); |
584 | 584 | |
585 | 585 | $this->sendRequest($this->buildUIDCommand("FETCH", $uid), [$set, $itemList], $tag); |
@@ -596,9 +596,9 @@ discard block |
||
596 | 596 | $count = count($tokens[2]); |
597 | 597 | if ($tokens[2][$count - 2] == 'UID') { |
598 | 598 | $uidKey = $count - 1; |
599 | - } else if ($tokens[2][0] == 'UID') { |
|
599 | + }else if ($tokens[2][0] == 'UID') { |
|
600 | 600 | $uidKey = 1; |
601 | - } else { |
|
601 | + }else { |
|
602 | 602 | $uidKey = array_search('UID', $tokens[2]) + 1; |
603 | 603 | } |
604 | 604 | } |
@@ -615,7 +615,7 @@ discard block |
||
615 | 615 | $data = $tokens[2][1]; |
616 | 616 | } elseif ($uid && $tokens[2][2] == $items[0]) { |
617 | 617 | $data = $tokens[2][3]; |
618 | - } else { |
|
618 | + }else { |
|
619 | 619 | // maybe the server send an other field we didn't wanted |
620 | 620 | $count = count($tokens[2]); |
621 | 621 | // we start with 2, because 0 was already checked |
@@ -627,7 +627,7 @@ discard block |
||
627 | 627 | break; |
628 | 628 | } |
629 | 629 | } |
630 | - } else { |
|
630 | + }else { |
|
631 | 631 | $data = []; |
632 | 632 | while (key($tokens[2]) !== null) { |
633 | 633 | $data[current($tokens[2])] = next($tokens[2]); |
@@ -644,7 +644,7 @@ discard block |
||
644 | 644 | } |
645 | 645 | if ($uid) { |
646 | 646 | $result[$tokens[2][$uidKey]] = $data; |
647 | - }else{ |
|
647 | + }else { |
|
648 | 648 | $result[$tokens[0]] = $data; |
649 | 649 | } |
650 | 650 | } |
@@ -799,7 +799,7 @@ discard block |
||
799 | 799 | $response = $this->requestAndResponse($command, [$set, $item, $flags], $silent); |
800 | 800 | |
801 | 801 | if ($silent) { |
802 | - return (bool)$response; |
|
802 | + return (bool) $response; |
|
803 | 803 | } |
804 | 804 | |
805 | 805 | $result = []; |
@@ -1101,7 +1101,7 @@ discard block |
||
1101 | 1101 | $ids = []; |
1102 | 1102 | foreach ($uids as $msgn => $v) { |
1103 | 1103 | $id = $uid ? $v : $msgn; |
1104 | - if ( ($to >= $id && $from <= $id) || ($to === "*" && $from <= $id) ){ |
|
1104 | + if (($to >= $id && $from <= $id) || ($to === "*" && $from <= $id)) { |
|
1105 | 1105 | $ids[] = $id; |
1106 | 1106 | } |
1107 | 1107 | } |
@@ -1115,14 +1115,14 @@ discard block |
||
1115 | 1115 | /** |
1116 | 1116 | * Enable the debug mode |
1117 | 1117 | */ |
1118 | - public function enableDebug(){ |
|
1118 | + public function enableDebug() { |
|
1119 | 1119 | $this->debug = true; |
1120 | 1120 | } |
1121 | 1121 | |
1122 | 1122 | /** |
1123 | 1123 | * Disable the debug mode |
1124 | 1124 | */ |
1125 | - public function disableDebug(){ |
|
1125 | + public function disableDebug() { |
|
1126 | 1126 | $this->debug = false; |
1127 | 1127 | } |
1128 | 1128 | |
@@ -1134,9 +1134,9 @@ discard block |
||
1134 | 1134 | * @return int|string |
1135 | 1135 | */ |
1136 | 1136 | public function buildSet($from, $to = null) { |
1137 | - $set = (int)$from; |
|
1137 | + $set = (int) $from; |
|
1138 | 1138 | if ($to !== null) { |
1139 | - $set .= ':' . ($to == INF ? '*' : (int)$to); |
|
1139 | + $set .= ':'.($to == INF ? '*' : (int) $to); |
|
1140 | 1140 | } |
1141 | 1141 | return $set; |
1142 | 1142 | } |
@@ -111,7 +111,9 @@ discard block |
||
111 | 111 | if ($line === "") { |
112 | 112 | throw new RuntimeException('empty response'); |
113 | 113 | } |
114 | - if ($this->debug) echo "<< ".$line."\n"; |
|
114 | + if ($this->debug) { |
|
115 | + echo "<< ".$line."\n"; |
|
116 | + } |
|
115 | 117 | return $line . "\n"; |
116 | 118 | } |
117 | 119 | |
@@ -326,7 +328,9 @@ discard block |
||
326 | 328 | * @throws RuntimeException |
327 | 329 | */ |
328 | 330 | public function write(string $data) { |
329 | - if ($this->debug) echo ">> ".$data ."\n"; |
|
331 | + if ($this->debug) { |
|
332 | + echo ">> ".$data ."\n"; |
|
333 | + } |
|
330 | 334 | |
331 | 335 | if (fwrite($this->stream, $data . "\r\n") === false) { |
332 | 336 | throw new RuntimeException('failed to write - connection closed?'); |
@@ -478,7 +482,9 @@ discard block |
||
478 | 482 | public function getCapabilities(): array { |
479 | 483 | $response = $this->requestAndResponse('CAPABILITY'); |
480 | 484 | |
481 | - if (!$response) return []; |
|
485 | + if (!$response) { |
|
486 | + return []; |
|
487 | + } |
|
482 | 488 | |
483 | 489 | $capabilities = []; |
484 | 490 | foreach ($response as $line) { |
@@ -638,13 +644,14 @@ discard block |
||
638 | 644 | // if we want only one message we can ignore everything else and just return |
639 | 645 | if ($to === null && !is_array($from) && ($uid ? $tokens[2][$uidKey] == $from : $tokens[0] == $from)) { |
640 | 646 | // we still need to read all lines |
641 | - while (!$this->readLine($tokens, $tag)) |
|
642 | - |
|
647 | + while (!$this->readLine($tokens, $tag)) { |
|
648 | + |
|
643 | 649 | return $data; |
650 | + } |
|
644 | 651 | } |
645 | 652 | if ($uid) { |
646 | 653 | $result[$tokens[2][$uidKey]] = $data; |
647 | - }else{ |
|
654 | + } else{ |
|
648 | 655 | $result[$tokens[0]] = $data; |
649 | 656 | } |
650 | 657 | } |
@@ -91,7 +91,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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" => $parsed_address['display'] ?? '', |
551 | 551 | "mailbox" => $mail_address[0], |
552 | 552 | "host" => $mail_address[1], |
@@ -574,7 +574,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 (($key == "user_agent") === false) { |
@@ -713,7 +713,7 @@ discard block |
||
713 | 713 | |
714 | 714 | $date = trim(rtrim($date)); |
715 | 715 | try { |
716 | - if(strpos($date, ' ') !== false){ |
|
716 | + if (strpos($date, ' ') !== false) { |
|
717 | 717 | $date = str_replace(' ', ' ', $date); |
718 | 718 | } |
719 | 719 | $parsed_date = Carbon::parse($date); |
@@ -740,8 +740,8 @@ discard block |
||
740 | 740 | $parsed_date = Carbon::parse($date); |
741 | 741 | } catch (\Exception $_e) { |
742 | 742 | if (!isset($this->config["fallback_date"])) { |
743 | - throw new InvalidMessageDateException("Invalid message date. ID:" . $this->get("message_id") . " Date:" . $header->date . "/" . $date, 1100, $e); |
|
744 | - } else { |
|
743 | + throw new InvalidMessageDateException("Invalid message date. ID:".$this->get("message_id")." Date:".$header->date."/".$date, 1100, $e); |
|
744 | + }else { |
|
745 | 745 | $parsed_date = Carbon::parse($this->config["fallback_date"]); |
746 | 746 | } |
747 | 747 | } |