@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | * @throws MessageContentFetchingException |
| 78 | 78 | * @throws InvalidMessageDateException |
| 79 | 79 | */ |
| 80 | - protected function parse(){ |
|
| 80 | + protected function parse() { |
|
| 81 | 81 | $this->findContentType(); |
| 82 | 82 | $this->parts = $this->find_parts(); |
| 83 | 83 | } |
@@ -85,13 +85,13 @@ discard block |
||
| 85 | 85 | /** |
| 86 | 86 | * Determine the message content type |
| 87 | 87 | */ |
| 88 | - public function findContentType(){ |
|
| 88 | + public function findContentType() { |
|
| 89 | 89 | |
| 90 | 90 | $content_type = $this->header->get("content-type"); |
| 91 | 91 | $content_type = (is_array($content_type)) ? implode(' ', $content_type) : $content_type; |
| 92 | - if(stripos($content_type, 'multipart') === 0) { |
|
| 92 | + if (stripos($content_type, 'multipart') === 0) { |
|
| 93 | 93 | $this->type = IMAP::MESSAGE_TYPE_MULTIPART; |
| 94 | - }else{ |
|
| 94 | + }else { |
|
| 95 | 95 | $this->type = IMAP::MESSAGE_TYPE_TEXT; |
| 96 | 96 | } |
| 97 | 97 | } |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | /** |
| 100 | 100 | * Determine the message content type |
| 101 | 101 | */ |
| 102 | - public function getBoundary(){ |
|
| 102 | + public function getBoundary() { |
|
| 103 | 103 | $boundary = $this->header->find("/boundary=\"?([^\"]*)[\";\s]/"); |
| 104 | 104 | return str_replace('"', '', $boundary); |
| 105 | 105 | } |
@@ -111,9 +111,9 @@ discard block |
||
| 111 | 111 | * @throws MessageContentFetchingException |
| 112 | 112 | * @throws InvalidMessageDateException |
| 113 | 113 | */ |
| 114 | - public function find_parts(){ |
|
| 115 | - if($this->type === IMAP::MESSAGE_TYPE_MULTIPART) { |
|
| 116 | - if (($boundary = $this->getBoundary()) === null) { |
|
| 114 | + public function find_parts() { |
|
| 115 | + if ($this->type === IMAP::MESSAGE_TYPE_MULTIPART) { |
|
| 116 | + if (($boundary = $this->getBoundary()) === null) { |
|
| 117 | 117 | throw new MessageContentFetchingException("no content found", 0); |
| 118 | 118 | } |
| 119 | 119 | |
@@ -122,21 +122,21 @@ discard block |
||
| 122 | 122 | ]; |
| 123 | 123 | |
| 124 | 124 | if (preg_match("/boundary\=\"?(.*)\"?/", $this->raw, $match) == 1) { |
| 125 | - if(is_array($match[1])){ |
|
| 126 | - foreach($match[1] as $matched){ |
|
| 125 | + if (is_array($match[1])) { |
|
| 126 | + foreach ($match[1] as $matched) { |
|
| 127 | 127 | $boundaries[] = str_replace('"', '', $matched); |
| 128 | 128 | } |
| 129 | - }else{ |
|
| 130 | - if(!empty($match[1])) { |
|
| 129 | + }else { |
|
| 130 | + if (!empty($match[1])) { |
|
| 131 | 131 | $boundaries[] = str_replace('"', '', $match[1]); |
| 132 | 132 | } |
| 133 | 133 | } |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | - $raw_parts = explode( $boundaries[0], str_replace($boundaries, $boundaries[0], $this->raw) ); |
|
| 136 | + $raw_parts = explode($boundaries[0], str_replace($boundaries, $boundaries[0], $this->raw)); |
|
| 137 | 137 | $parts = []; |
| 138 | 138 | $part_number = 0; |
| 139 | - foreach($raw_parts as $part) { |
|
| 139 | + foreach ($raw_parts as $part) { |
|
| 140 | 140 | $part = trim(rtrim($part)); |
| 141 | 141 | if ($part !== "--") { |
| 142 | 142 | $parts[] = new Part($part, null, $part_number); |