@@ -203,11 +203,11 @@ discard block |
||
203 | 203 | * @param array $config |
204 | 204 | * @param array $default_config |
205 | 205 | */ |
206 | - private function setAccountConfig($key, $config, $default_config){ |
|
206 | + private function setAccountConfig($key, $config, $default_config) { |
|
207 | 207 | $value = $this->default_account_config[$key]; |
208 | - if(isset($config[$key])) { |
|
208 | + if (isset($config[$key])) { |
|
209 | 209 | $value = $config[$key]; |
210 | - }elseif(isset($default_config[$key])) { |
|
210 | + }elseif (isset($default_config[$key])) { |
|
211 | 211 | $value = $default_config[$key]; |
212 | 212 | } |
213 | 213 | $this->$key = $value; |
@@ -219,8 +219,8 @@ discard block |
||
219 | 219 | */ |
220 | 220 | protected function setEventsFromConfig($config) { |
221 | 221 | $this->events = ClientManager::get("events"); |
222 | - if(isset($config['events'])){ |
|
223 | - foreach($config['events'] as $section => $events) { |
|
222 | + if (isset($config['events'])) { |
|
223 | + foreach ($config['events'] as $section => $events) { |
|
224 | 224 | $this->events[$section] = array_merge($this->events[$section], $events); |
225 | 225 | } |
226 | 226 | } |
@@ -233,45 +233,45 @@ discard block |
||
233 | 233 | * @throws MaskNotFoundException |
234 | 234 | */ |
235 | 235 | protected function setMaskFromConfig($config) { |
236 | - $default_config = ClientManager::get("masks"); |
|
236 | + $default_config = ClientManager::get("masks"); |
|
237 | 237 | |
238 | - if(isset($config['masks'])){ |
|
239 | - if(isset($config['masks']['message'])) { |
|
240 | - if(class_exists($config['masks']['message'])) { |
|
238 | + if (isset($config['masks'])) { |
|
239 | + if (isset($config['masks']['message'])) { |
|
240 | + if (class_exists($config['masks']['message'])) { |
|
241 | 241 | $this->default_message_mask = $config['masks']['message']; |
242 | - }else{ |
|
242 | + }else { |
|
243 | 243 | throw new MaskNotFoundException("Unknown mask provided: ".$config['masks']['message']); |
244 | 244 | } |
245 | - }else{ |
|
246 | - if(class_exists($default_config['message'])) { |
|
245 | + }else { |
|
246 | + if (class_exists($default_config['message'])) { |
|
247 | 247 | $this->default_message_mask = $default_config['message']; |
248 | - }else{ |
|
248 | + }else { |
|
249 | 249 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['message']); |
250 | 250 | } |
251 | 251 | } |
252 | - if(isset($config['masks']['attachment'])) { |
|
253 | - if(class_exists($config['masks']['attachment'])) { |
|
252 | + if (isset($config['masks']['attachment'])) { |
|
253 | + if (class_exists($config['masks']['attachment'])) { |
|
254 | 254 | $this->default_attachment_mask = $config['masks']['attachment']; |
255 | - }else{ |
|
255 | + }else { |
|
256 | 256 | throw new MaskNotFoundException("Unknown mask provided: ".$config['masks']['attachment']); |
257 | 257 | } |
258 | - }else{ |
|
259 | - if(class_exists($default_config['attachment'])) { |
|
258 | + }else { |
|
259 | + if (class_exists($default_config['attachment'])) { |
|
260 | 260 | $this->default_attachment_mask = $default_config['attachment']; |
261 | - }else{ |
|
261 | + }else { |
|
262 | 262 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['attachment']); |
263 | 263 | } |
264 | 264 | } |
265 | - }else{ |
|
266 | - if(class_exists($default_config['message'])) { |
|
265 | + }else { |
|
266 | + if (class_exists($default_config['message'])) { |
|
267 | 267 | $this->default_message_mask = $default_config['message']; |
268 | - }else{ |
|
268 | + }else { |
|
269 | 269 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['message']); |
270 | 270 | } |
271 | 271 | |
272 | - if(class_exists($default_config['attachment'])) { |
|
272 | + if (class_exists($default_config['attachment'])) { |
|
273 | 273 | $this->default_attachment_mask = $default_config['attachment']; |
274 | - }else{ |
|
274 | + }else { |
|
275 | 275 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['attachment']); |
276 | 276 | } |
277 | 277 | } |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | $this->connection = new ImapProtocol($this->validate_cert, $this->encryption); |
336 | 336 | $this->connection->setConnectionTimeout($this->timeout); |
337 | 337 | $this->connection->setProxy($this->proxy); |
338 | - }else{ |
|
338 | + }else { |
|
339 | 339 | if (extension_loaded('imap') === false) { |
340 | 340 | throw new ConnectionFailedException("connection setup failed", 0, new ProtocolNotSupportedException($protocol." is an unsupported protocol")); |
341 | 341 | } |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | |
409 | 409 | // Set delimiter to false to force selection via getFolderByName (maybe useful for uncommon folder names) |
410 | 410 | $delimiter = is_null($delimiter) ? ClientManager::get('options.delimiter', "/") : $delimiter; |
411 | - if (strpos($folder_name, (string)$delimiter) !== false) { |
|
411 | + if (strpos($folder_name, (string) $delimiter) !== false) { |
|
412 | 412 | return $this->getFolderByPath($folder_name); |
413 | 413 | } |
414 | 414 | |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | $pattern = $parent_folder.($hierarchical ? '%' : '*'); |
461 | 461 | $items = $this->connection->folders('', $pattern); |
462 | 462 | |
463 | - if(is_array($items)){ |
|
463 | + if (is_array($items)) { |
|
464 | 464 | foreach ($items as $folder_name => $item) { |
465 | 465 | $folder = new Folder($this, $folder_name, $item["delimiter"], $item["flags"]); |
466 | 466 | |
@@ -475,7 +475,7 @@ discard block |
||
475 | 475 | } |
476 | 476 | |
477 | 477 | return $folders; |
478 | - }else{ |
|
478 | + }else { |
|
479 | 479 | throw new FolderFetchingException("failed to fetch any folders"); |
480 | 480 | } |
481 | 481 | } |
@@ -513,10 +513,10 @@ discard block |
||
513 | 513 | $this->checkConnection(); |
514 | 514 | $status = $this->connection->createFolder($folder); |
515 | 515 | |
516 | - if($expunge) $this->expunge(); |
|
516 | + if ($expunge) $this->expunge(); |
|
517 | 517 | |
518 | 518 | $folder = $this->getFolder($folder); |
519 | - if($status && $folder) { |
|
519 | + if ($status && $folder) { |
|
520 | 520 | $event = $this->getEvent("folder", "new"); |
521 | 521 | $event::dispatch($folder); |
522 | 522 | } |
@@ -542,7 +542,7 @@ discard block |
||
542 | 542 | * |
543 | 543 | * @return string |
544 | 544 | */ |
545 | - public function getFolderPath(){ |
|
545 | + public function getFolderPath() { |
|
546 | 546 | return $this->active_folder; |
547 | 547 | } |
548 | 548 | |
@@ -600,7 +600,7 @@ discard block |
||
600 | 600 | * @return int |
601 | 601 | * @throws ConnectionFailedException |
602 | 602 | */ |
603 | - public function getTimeout(){ |
|
603 | + public function getTimeout() { |
|
604 | 604 | $this->checkConnection(); |
605 | 605 | return $this->connection->getConnectionTimeout(); |
606 | 606 | } |
@@ -610,7 +610,7 @@ discard block |
||
610 | 610 | * |
611 | 611 | * @return string |
612 | 612 | */ |
613 | - public function getDefaultMessageMask(){ |
|
613 | + public function getDefaultMessageMask() { |
|
614 | 614 | return $this->default_message_mask; |
615 | 615 | } |
616 | 616 | |
@@ -620,7 +620,7 @@ discard block |
||
620 | 620 | * |
621 | 621 | * @return array |
622 | 622 | */ |
623 | - public function getDefaultEvents($section){ |
|
623 | + public function getDefaultEvents($section) { |
|
624 | 624 | return $this->events[$section]; |
625 | 625 | } |
626 | 626 | |
@@ -632,7 +632,7 @@ discard block |
||
632 | 632 | * @throws MaskNotFoundException |
633 | 633 | */ |
634 | 634 | public function setDefaultMessageMask($mask) { |
635 | - if(class_exists($mask)) { |
|
635 | + if (class_exists($mask)) { |
|
636 | 636 | $this->default_message_mask = $mask; |
637 | 637 | |
638 | 638 | return $this; |
@@ -646,7 +646,7 @@ discard block |
||
646 | 646 | * |
647 | 647 | * @return string |
648 | 648 | */ |
649 | - public function getDefaultAttachmentMask(){ |
|
649 | + public function getDefaultAttachmentMask() { |
|
650 | 650 | return $this->default_attachment_mask; |
651 | 651 | } |
652 | 652 | |
@@ -658,7 +658,7 @@ discard block |
||
658 | 658 | * @throws MaskNotFoundException |
659 | 659 | */ |
660 | 660 | public function setDefaultAttachmentMask($mask) { |
661 | - if(class_exists($mask)) { |
|
661 | + if (class_exists($mask)) { |
|
662 | 662 | $this->default_attachment_mask = $mask; |
663 | 663 | |
664 | 664 | return $this; |
@@ -82,10 +82,10 @@ discard block |
||
82 | 82 | * @throws MethodNotFoundException |
83 | 83 | */ |
84 | 84 | public function __call($method, $arguments) { |
85 | - if(strtolower(substr($method, 0, 3)) === 'get') { |
|
85 | + if (strtolower(substr($method, 0, 3)) === 'get') { |
|
86 | 86 | $name = preg_replace('/(.)(?=[A-Z])/u', '$1_', substr(strtolower($method), 3)); |
87 | 87 | |
88 | - if(in_array($name, array_keys($this->attributes))) { |
|
88 | + if (in_array($name, array_keys($this->attributes))) { |
|
89 | 89 | return $this->attributes[$name]; |
90 | 90 | } |
91 | 91 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | * @return Attribute|mixed |
112 | 112 | */ |
113 | 113 | public function get($name) { |
114 | - if(isset($this->attributes[$name])) { |
|
114 | + if (isset($this->attributes[$name])) { |
|
115 | 115 | return $this->attributes[$name]; |
116 | 116 | } |
117 | 117 | |
@@ -127,23 +127,23 @@ discard block |
||
127 | 127 | * @return Attribute |
128 | 128 | */ |
129 | 129 | public function set($name, $value, $strict = false) { |
130 | - if(isset($this->attributes[$name]) && $strict === false) { |
|
130 | + if (isset($this->attributes[$name]) && $strict === false) { |
|
131 | 131 | if ($this->attributize) { |
132 | 132 | $this->attributes[$name]->add($value, true); |
133 | - }else{ |
|
134 | - if(isset($this->attributes[$name])) { |
|
133 | + }else { |
|
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 | |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | public function find($pattern) { |
160 | 160 | if (preg_match_all($pattern, $this->raw, $matches)) { |
161 | 161 | if (isset($matches[1])) { |
162 | - if(count($matches[1]) > 0) { |
|
162 | + if (count($matches[1]) > 0) { |
|
163 | 163 | return $matches[1][0]; |
164 | 164 | } |
165 | 165 | } |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | * |
173 | 173 | * @return string|null |
174 | 174 | */ |
175 | - public function getBoundary(){ |
|
175 | + public function getBoundary() { |
|
176 | 176 | $boundary = $this->find("/boundary\=(.*)/i"); |
177 | 177 | |
178 | 178 | if ($boundary === null) { |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | * |
198 | 198 | * @throws InvalidMessageDateException |
199 | 199 | */ |
200 | - protected function parse(){ |
|
200 | + protected function parse() { |
|
201 | 201 | $header = $this->rfc822_parse_headers($this->raw); |
202 | 202 | |
203 | 203 | $this->extractAddresses($header); |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | $this->parseDate($header); |
216 | 216 | foreach ($header as $key => $value) { |
217 | 217 | $key = trim(rtrim(strtolower($key))); |
218 | - if(!isset($this->attributes[$key])){ |
|
218 | + if (!isset($this->attributes[$key])) { |
|
219 | 219 | $this->set($key, $value); |
220 | 220 | } |
221 | 221 | } |
@@ -231,12 +231,12 @@ discard block |
||
231 | 231 | * |
232 | 232 | * @return object |
233 | 233 | */ |
234 | - public function rfc822_parse_headers($raw_headers){ |
|
234 | + public function rfc822_parse_headers($raw_headers) { |
|
235 | 235 | $headers = []; |
236 | 236 | $imap_headers = []; |
237 | 237 | if (extension_loaded('imap') && $this->config["rfc822"]) { |
238 | 238 | $raw_imap_headers = (array) \imap_rfc822_parse_headers($this->raw); |
239 | - foreach($raw_imap_headers as $key => $values) { |
|
239 | + foreach ($raw_imap_headers as $key => $values) { |
|
240 | 240 | $key = str_replace("-", "_", $key); |
241 | 241 | $imap_headers[$key] = $values; |
242 | 242 | } |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | |
245 | 245 | $lines = explode("\r\n", $raw_headers); |
246 | 246 | $prev_header = null; |
247 | - foreach($lines as $line) { |
|
247 | + foreach ($lines as $line) { |
|
248 | 248 | if (substr($line, 0, 1) === "\n") { |
249 | 249 | $line = substr($line, 1); |
250 | 250 | } |
@@ -264,19 +264,19 @@ 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); |
275 | 275 | |
276 | 276 | $value = trim(rtrim(substr($line, $pos + 1))); |
277 | 277 | if (isset($headers[$key])) { |
278 | - $headers[$key][] = $value; |
|
279 | - }else{ |
|
278 | + $headers[$key][] = $value; |
|
279 | + }else { |
|
280 | 280 | $headers[$key] = [$value]; |
281 | 281 | } |
282 | 282 | $prev_header = $key; |
@@ -284,10 +284,10 @@ discard block |
||
284 | 284 | } |
285 | 285 | } |
286 | 286 | |
287 | - foreach($headers as $key => $values) { |
|
287 | + foreach ($headers as $key => $values) { |
|
288 | 288 | if (isset($imap_headers[$key])) continue; |
289 | 289 | $value = null; |
290 | - switch($key){ |
|
290 | + switch ($key) { |
|
291 | 291 | case 'from': |
292 | 292 | case 'to': |
293 | 293 | case 'cc': |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | break; |
303 | 303 | default: |
304 | 304 | if (is_array($values)) { |
305 | - foreach($values as $k => $v) { |
|
305 | + foreach ($values as $k => $v) { |
|
306 | 306 | if ($v == "") { |
307 | 307 | unset($values[$k]); |
308 | 308 | } |
@@ -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 | } |
@@ -334,12 +334,12 @@ discard block |
||
334 | 334 | * @return array The decoded elements are returned in an array of objects, where each |
335 | 335 | * object has two properties, charset and text. |
336 | 336 | */ |
337 | - public function mime_header_decode($text){ |
|
337 | + public function mime_header_decode($text) { |
|
338 | 338 | if (extension_loaded('imap')) { |
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 | } |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | } |
425 | 425 | }elseif (property_exists($structure, 'charset')) { |
426 | 426 | return EncodingAliases::get($structure->charset, $this->fallback_encoding); |
427 | - }elseif (is_string($structure) === true){ |
|
427 | + }elseif (is_string($structure) === true) { |
|
428 | 428 | return mb_detect_encoding($structure); |
429 | 429 | } |
430 | 430 | |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | if ($value !== null) { |
458 | 458 | $is_utf8_base = $this->is_uft8($value); |
459 | 459 | |
460 | - if($decoder === 'utf-8' && extension_loaded('imap')) { |
|
460 | + if ($decoder === 'utf-8' && extension_loaded('imap')) { |
|
461 | 461 | $value = \imap_utf8($value); |
462 | 462 | $is_utf8_base = $this->is_uft8($value); |
463 | 463 | if ($is_utf8_base) { |
@@ -466,14 +466,14 @@ discard block |
||
466 | 466 | if ($this->notDecoded($original_value, $value)) { |
467 | 467 | $decoded_value = $this->mime_header_decode($value); |
468 | 468 | if (count($decoded_value) > 0) { |
469 | - if(property_exists($decoded_value[0], "text")) { |
|
469 | + if (property_exists($decoded_value[0], "text")) { |
|
470 | 470 | $value = $decoded_value[0]->text; |
471 | 471 | } |
472 | 472 | } |
473 | 473 | } |
474 | - }elseif($decoder === 'iconv' && $is_utf8_base) { |
|
474 | + }elseif ($decoder === 'iconv' && $is_utf8_base) { |
|
475 | 475 | $value = iconv_mime_decode($value); |
476 | - }elseif($is_utf8_base){ |
|
476 | + }elseif ($is_utf8_base) { |
|
477 | 477 | $value = mb_decode_mimeheader($value); |
478 | 478 | } |
479 | 479 | |
@@ -496,7 +496,7 @@ discard block |
||
496 | 496 | * @return array |
497 | 497 | */ |
498 | 498 | private function decodeArray($values) { |
499 | - foreach($values as $key => $value) { |
|
499 | + foreach ($values as $key => $value) { |
|
500 | 500 | $values[$key] = $this->decode($value); |
501 | 501 | } |
502 | 502 | return $values; |
@@ -506,8 +506,8 @@ discard block |
||
506 | 506 | * Try to extract the priority from a given raw header string |
507 | 507 | */ |
508 | 508 | private function findPriority() { |
509 | - if(($priority = $this->get("x_priority")) === null) return; |
|
510 | - switch((int)"$priority"){ |
|
509 | + if (($priority = $this->get("x_priority")) === null) return; |
|
510 | + switch ((int) "$priority") { |
|
511 | 511 | case IMAP::MESSAGE_PRIORITY_HIGHEST; |
512 | 512 | $priority = IMAP::MESSAGE_PRIORITY_HIGHEST; |
513 | 513 | break; |
@@ -539,7 +539,7 @@ discard block |
||
539 | 539 | */ |
540 | 540 | private function decodeAddresses($values) { |
541 | 541 | $addresses = []; |
542 | - foreach($values as $address) { |
|
542 | + foreach ($values as $address) { |
|
543 | 543 | $address = trim(rtrim($address)); |
544 | 544 | if (strpos($address, ",") == strlen($address) - 1) { |
545 | 545 | $address = substr($address, 0, -1); |
@@ -548,7 +548,7 @@ discard block |
||
548 | 548 | '/^(?:(?P<name>.+)\s)?(?(name)<|<?)(?P<email>[^\s]+?)(?(name)>|>?)$/', |
549 | 549 | $address, |
550 | 550 | $matches |
551 | - )){ |
|
551 | + )) { |
|
552 | 552 | $name = trim(rtrim($matches["name"])); |
553 | 553 | $email = trim(rtrim($matches["email"])); |
554 | 554 | list($mailbox, $host) = array_pad(explode("@", $email), 2, null); |
@@ -567,7 +567,7 @@ discard block |
||
567 | 567 | * @param object $header |
568 | 568 | */ |
569 | 569 | private function extractAddresses($header) { |
570 | - foreach(['from', 'to', 'cc', 'bcc', 'reply_to', 'sender'] as $key){ |
|
570 | + foreach (['from', 'to', 'cc', 'bcc', 'reply_to', 'sender'] as $key) { |
|
571 | 571 | if (property_exists($header, $key)) { |
572 | 572 | $this->set($key, $this->parseAddresses($header->$key)); |
573 | 573 | } |
@@ -598,10 +598,10 @@ discard block |
||
598 | 598 | } |
599 | 599 | if (!property_exists($address, 'personal')) { |
600 | 600 | $address->personal = false; |
601 | - } else { |
|
601 | + }else { |
|
602 | 602 | $personalParts = $this->mime_header_decode($address->personal); |
603 | 603 | |
604 | - if(is_array($personalParts)) { |
|
604 | + if (is_array($personalParts)) { |
|
605 | 605 | $address->personal = ''; |
606 | 606 | foreach ($personalParts as $p) { |
607 | 607 | $address->personal .= $this->convertEncoding($p->text, $this->getEncoding($p)); |
@@ -625,23 +625,23 @@ discard block |
||
625 | 625 | /** |
626 | 626 | * Search and extract potential header extensions |
627 | 627 | */ |
628 | - private function extractHeaderExtensions(){ |
|
628 | + private function extractHeaderExtensions() { |
|
629 | 629 | foreach ($this->attributes as $key => $value) { |
630 | 630 | if (is_array($value)) { |
631 | 631 | $value = implode(", ", $value); |
632 | - }else{ |
|
633 | - $value = (string)$value; |
|
632 | + }else { |
|
633 | + $value = (string) $value; |
|
634 | 634 | } |
635 | 635 | // Only parse strings and don't parse any attributes like the user-agent |
636 | 636 | if (in_array($key, ["user_agent"]) === false) { |
637 | - if (($pos = strpos($value, ";")) !== false){ |
|
637 | + if (($pos = strpos($value, ";")) !== false) { |
|
638 | 638 | $original = substr($value, 0, $pos); |
639 | 639 | $this->set($key, trim(rtrim($original)), true); |
640 | 640 | |
641 | 641 | // Get all potential extensions |
642 | 642 | $extensions = explode(";", substr($value, $pos + 1)); |
643 | - foreach($extensions as $extension) { |
|
644 | - if (($pos = strpos($extension, "=")) !== false){ |
|
643 | + foreach ($extensions as $extension) { |
|
644 | + if (($pos = strpos($extension, "=")) !== false) { |
|
645 | 645 | $key = substr($extension, 0, $pos); |
646 | 646 | $key = trim(rtrim(strtolower($key))); |
647 | 647 | |
@@ -684,7 +684,7 @@ discard block |
||
684 | 684 | $parsed_date = null; |
685 | 685 | $date = $header->date; |
686 | 686 | |
687 | - if(preg_match('/\+0580/', $date)) { |
|
687 | + if (preg_match('/\+0580/', $date)) { |
|
688 | 688 | $date = str_replace('+0580', '+0530', $date); |
689 | 689 | } |
690 | 690 | |
@@ -707,7 +707,7 @@ discard block |
||
707 | 707 | $date = trim(array_pop($array)); |
708 | 708 | break; |
709 | 709 | } |
710 | - try{ |
|
710 | + try { |
|
711 | 711 | $parsed_date = Carbon::parse($date); |
712 | 712 | } catch (\Exception $_e) { |
713 | 713 | throw new InvalidMessageDateException("Invalid message date. ID:".$this->get("message_id"), 1100, $e); |