@@ -46,7 +46,9 @@ discard block |
||
46 | 46 | */ |
47 | 47 | public function getCustomHTMLBody($callback = false) { |
48 | 48 | $body = $this->getHtmlBody(); |
49 | - if($body === null) return null; |
|
49 | + if($body === null) { |
|
50 | + return null; |
|
51 | + } |
|
50 | 52 | |
51 | 53 | if ($callback !== false) { |
52 | 54 | $aAttachment = $this->parent->getAttachments(); |
@@ -54,7 +56,7 @@ discard block |
||
54 | 56 | /** @var Attachment $oAttachment */ |
55 | 57 | if(is_callable($callback)) { |
56 | 58 | $body = $callback($body, $oAttachment); |
57 | - }elseif(is_string($callback)) { |
|
59 | + } elseif(is_string($callback)) { |
|
58 | 60 | call_user_func($callback, [$body, $oAttachment]); |
59 | 61 | } |
60 | 62 | }); |
@@ -67,7 +67,7 @@ |
||
67 | 67 | return $this->attributes[$name]; |
68 | 68 | } |
69 | 69 | |
70 | - }elseif (strtolower(substr($method, 0, 3)) === 'set') { |
|
70 | + } elseif (strtolower(substr($method, 0, 3)) === 'set') { |
|
71 | 71 | $name = Str::snake(substr($method, 3)); |
72 | 72 | |
73 | 73 | if(isset($this->attributes[$name])) { |
@@ -55,7 +55,7 @@ |
||
55 | 55 | // so add them back in manually if we can |
56 | 56 | if (defined('STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT')) { |
57 | 57 | $cryptoMethod = STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT; |
58 | - }elseif (defined('STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT')) { |
|
58 | + } elseif (defined('STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT')) { |
|
59 | 59 | $cryptoMethod = STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT; |
60 | 60 | } |
61 | 61 |
@@ -35,11 +35,14 @@ |
||
35 | 35 | <td><?php echo $message->getAttachments()->count() > 0 ? 'yes' : 'no'; ?></td> |
36 | 36 | </tr> |
37 | 37 | <?php endforeach; ?> |
38 | - <?php else: ?> |
|
38 | + <?php else { |
|
39 | + : ?> |
|
39 | 40 | <tr> |
40 | 41 | <td colspan="4">No messages found</td> |
41 | 42 | </tr> |
42 | - <?php endif; ?> |
|
43 | + <?php endif; |
|
44 | +} |
|
45 | +?> |
|
43 | 46 | </tbody> |
44 | 47 | </table> |
45 | 48 |
@@ -31,11 +31,14 @@ |
||
31 | 31 | <td><?php echo $folder->search()->unseen()->setFetchBody(false)->count(); ?></td> |
32 | 32 | </tr> |
33 | 33 | <?php endforeach; ?> |
34 | - <?php else: ?> |
|
34 | + <?php else { |
|
35 | + : ?> |
|
35 | 36 | <tr> |
36 | 37 | <td colspan="4">No folders found</td> |
37 | 38 | </tr> |
38 | - <?php endif; ?> |
|
39 | + <?php endif; |
|
40 | +} |
|
41 | +?> |
|
39 | 42 | </tbody> |
40 | 43 | </table> |
41 | 44 |
@@ -121,7 +121,7 @@ |
||
121 | 121 | protected function parse(){ |
122 | 122 | if ($this->header === null) { |
123 | 123 | $body = $this->findHeaders(); |
124 | - }else{ |
|
124 | + } else{ |
|
125 | 125 | $body = $this->raw; |
126 | 126 | } |
127 | 127 |
@@ -232,7 +232,9 @@ discard block |
||
232 | 232 | public function move($new_name, $expunge = true) { |
233 | 233 | $this->client->checkConnection(); |
234 | 234 | $status = $this->client->getConnection()->renameFolder($this->full_name, $new_name); |
235 | - if($expunge) $this->client->expunge(); |
|
235 | + if($expunge) { |
|
236 | + $this->client->expunge(); |
|
237 | + } |
|
236 | 238 | |
237 | 239 | $folder = $this->client->getFolder($new_name); |
238 | 240 | $event = $this->getEvent("folder", "moved"); |
@@ -306,7 +308,9 @@ discard block |
||
306 | 308 | */ |
307 | 309 | public function delete($expunge = true) { |
308 | 310 | $status = $this->client->getConnection()->deleteFolder($this->path); |
309 | - if($expunge) $this->client->expunge(); |
|
311 | + if($expunge) { |
|
312 | + $this->client->expunge(); |
|
313 | + } |
|
310 | 314 | |
311 | 315 | $event = $this->getEvent("folder", "deleted"); |
312 | 316 | $event::dispatch($this); |
@@ -374,7 +378,7 @@ discard block |
||
374 | 378 | |
375 | 379 | $connection->idle(); |
376 | 380 | } |
377 | - }catch (Exceptions\RuntimeException $e) { |
|
381 | + } catch (Exceptions\RuntimeException $e) { |
|
378 | 382 | if(strpos($e->getMessage(), "connection closed") === false) { |
379 | 383 | throw $e; |
380 | 384 | } |
@@ -233,7 +233,9 @@ discard block |
||
233 | 233 | } else { |
234 | 234 | $tokens = $line; |
235 | 235 | } |
236 | - if ($this->debug) echo "<< ".$line."\n"; |
|
236 | + if ($this->debug) { |
|
237 | + echo "<< ".$line."\n"; |
|
238 | + } |
|
237 | 239 | |
238 | 240 | // if tag is wanted tag we might be at the end of a multiline response |
239 | 241 | return $tag == $wantedTag; |
@@ -298,7 +300,9 @@ discard block |
||
298 | 300 | $line .= ' ' . $token; |
299 | 301 | } |
300 | 302 | } |
301 | - if ($this->debug) echo ">> ".$line."\n"; |
|
303 | + if ($this->debug) { |
|
304 | + echo ">> ".$line."\n"; |
|
305 | + } |
|
302 | 306 | |
303 | 307 | if (fwrite($this->stream, $line . "\r\n") === false) { |
304 | 308 | throw new RuntimeException('failed to write - connection closed?'); |
@@ -448,7 +452,9 @@ discard block |
||
448 | 452 | public function getCapabilities() { |
449 | 453 | $response = $this->requestAndResponse('CAPABILITY'); |
450 | 454 | |
451 | - if (!$response) return []; |
|
455 | + if (!$response) { |
|
456 | + return []; |
|
457 | + } |
|
452 | 458 | |
453 | 459 | $capabilities = []; |
454 | 460 | foreach ($response as $line) { |
@@ -605,13 +611,14 @@ discard block |
||
605 | 611 | // if we want only one message we can ignore everything else and just return |
606 | 612 | if ($to === null && !is_array($from) && ($uid ? $tokens[2][$uidKey] == $from : $tokens[0] == $from)) { |
607 | 613 | // we still need to read all lines |
608 | - while (!$this->readLine($tokens, $tag)) |
|
609 | - |
|
614 | + while (!$this->readLine($tokens, $tag)) { |
|
615 | + |
|
610 | 616 | return $data; |
617 | + } |
|
611 | 618 | } |
612 | 619 | if ($uid) { |
613 | 620 | $result[$tokens[2][$uidKey]] = $data; |
614 | - }else{ |
|
621 | + } else{ |
|
615 | 622 | $result[$tokens[0]] = $data; |
616 | 623 | } |
617 | 624 | } |
@@ -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 | - }elseif($this->attributize == false){ |
|
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 | |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | if ($prev_header !== null) { |
231 | 231 | $headers[$prev_header][] = $line; |
232 | 232 | } |
233 | - }elseif (substr($line, 0, 1) === " ") { |
|
233 | + } elseif (substr($line, 0, 1) === " ") { |
|
234 | 234 | $line = substr($line, 1); |
235 | 235 | $line = trim(rtrim($line)); |
236 | 236 | if ($prev_header !== null) { |
@@ -239,11 +239,11 @@ discard block |
||
239 | 239 | } |
240 | 240 | if (is_array($headers[$prev_header])) { |
241 | 241 | $headers[$prev_header][] = $line; |
242 | - }else{ |
|
242 | + } else{ |
|
243 | 243 | $headers[$prev_header] .= $line; |
244 | 244 | } |
245 | 245 | } |
246 | - }else{ |
|
246 | + } else{ |
|
247 | 247 | if (($pos = strpos($line, ":")) > 0) { |
248 | 248 | $key = trim(rtrim(strtolower(substr($line, 0, $pos)))); |
249 | 249 | $key = str_replace("-", "_", $key); |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | $value = trim(rtrim(substr($line, $pos + 1))); |
252 | 252 | if (isset($headers[$key])) { |
253 | 253 | $headers[$key][] = $value; |
254 | - }else{ |
|
254 | + } else{ |
|
255 | 255 | $headers[$key] = [$value]; |
256 | 256 | } |
257 | 257 | $prev_header = $key; |
@@ -260,7 +260,9 @@ discard block |
||
260 | 260 | } |
261 | 261 | |
262 | 262 | foreach($headers as $key => $values) { |
263 | - if (isset($imap_headers[$key])) continue; |
|
263 | + if (isset($imap_headers[$key])) { |
|
264 | + continue; |
|
265 | + } |
|
264 | 266 | $value = null; |
265 | 267 | switch($key){ |
266 | 268 | case 'from': |
@@ -397,9 +399,9 @@ discard block |
||
397 | 399 | return EncodingAliases::get($parameter->value, $this->fallback_encoding); |
398 | 400 | } |
399 | 401 | } |
400 | - }elseif (property_exists($structure, 'charset')) { |
|
402 | + } elseif (property_exists($structure, 'charset')) { |
|
401 | 403 | return EncodingAliases::get($structure->charset, $this->fallback_encoding); |
402 | - }elseif (is_string($structure) === true){ |
|
404 | + } elseif (is_string($structure) === true){ |
|
403 | 405 | return mb_detect_encoding($structure); |
404 | 406 | } |
405 | 407 | |
@@ -446,9 +448,9 @@ discard block |
||
446 | 448 | } |
447 | 449 | } |
448 | 450 | } |
449 | - }elseif($decoder === 'iconv' && $is_utf8_base) { |
|
451 | + } elseif($decoder === 'iconv' && $is_utf8_base) { |
|
450 | 452 | $value = iconv_mime_decode($value); |
451 | - }elseif($is_utf8_base){ |
|
453 | + } elseif($is_utf8_base){ |
|
452 | 454 | $value = mb_decode_mimeheader($value); |
453 | 455 | } |
454 | 456 | |
@@ -481,7 +483,9 @@ discard block |
||
481 | 483 | * Try to extract the priority from a given raw header string |
482 | 484 | */ |
483 | 485 | private function findPriority() { |
484 | - if(($priority = $this->get("x_priority")) === null) return; |
|
486 | + if(($priority = $this->get("x_priority")) === null) { |
|
487 | + return; |
|
488 | + } |
|
485 | 489 | switch((int)"$priority"){ |
486 | 490 | case IMAP::MESSAGE_PRIORITY_HIGHEST; |
487 | 491 | $priority = IMAP::MESSAGE_PRIORITY_HIGHEST; |
@@ -604,7 +608,7 @@ discard block |
||
604 | 608 | foreach ($this->attributes as $key => $value) { |
605 | 609 | if (is_array($value)) { |
606 | 610 | $value = implode(", ", $value); |
607 | - }else{ |
|
611 | + } else{ |
|
608 | 612 | $value = (string)$value; |
609 | 613 | } |
610 | 614 | // Only parse strings and don't parse any attributes like the user-agent |