@@ -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 | |
@@ -433,9 +435,9 @@ discard block |
||
| 433 | 435 | } |
| 434 | 436 | } |
| 435 | 437 | } |
| 436 | - }elseif($decoder === 'iconv') { |
|
| 438 | + } elseif($decoder === 'iconv') { |
|
| 437 | 439 | $value = iconv_mime_decode($value); |
| 438 | - }else{ |
|
| 440 | + } else{ |
|
| 439 | 441 | $value = mb_decode_mimeheader($value); |
| 440 | 442 | } |
| 441 | 443 | |
@@ -468,7 +470,9 @@ discard block |
||
| 468 | 470 | * Try to extract the priority from a given raw header string |
| 469 | 471 | */ |
| 470 | 472 | private function findPriority() { |
| 471 | - if(($priority = $this->get("x_priority")) === null) return; |
|
| 473 | + if(($priority = $this->get("x_priority")) === null) { |
|
| 474 | + return; |
|
| 475 | + } |
|
| 472 | 476 | switch((int)"$priority"){ |
| 473 | 477 | case IMAP::MESSAGE_PRIORITY_HIGHEST; |
| 474 | 478 | $priority = IMAP::MESSAGE_PRIORITY_HIGHEST; |
@@ -591,7 +595,7 @@ discard block |
||
| 591 | 595 | foreach ($this->attributes as $key => $value) { |
| 592 | 596 | if (is_array($value)) { |
| 593 | 597 | $value = implode(", ", $value); |
| 594 | - }else{ |
|
| 598 | + } else{ |
|
| 595 | 599 | $value = (string)$value; |
| 596 | 600 | } |
| 597 | 601 | // Only parse strings and don't parse any attributes like the user-agent |