@@ -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,10 +85,10 @@ discard block |
||
| 85 | 85 | /** |
| 86 | 86 | * Determine the message content type |
| 87 | 87 | */ |
| 88 | - public function findContentType(){ |
|
| 89 | - if(stripos($this->header->get("content-type"), 'multipart') === 0) { |
|
| 88 | + public function findContentType() { |
|
| 89 | + if (stripos($this->header->get("content-type"), 'multipart') === 0) { |
|
| 90 | 90 | $this->type = IMAP::MESSAGE_TYPE_MULTIPART; |
| 91 | - }else{ |
|
| 91 | + }else { |
|
| 92 | 92 | $this->type = IMAP::MESSAGE_TYPE_TEXT; |
| 93 | 93 | } |
| 94 | 94 | } |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | /** |
| 97 | 97 | * Determine the message content type |
| 98 | 98 | */ |
| 99 | - public function getBoundary(){ |
|
| 99 | + public function getBoundary() { |
|
| 100 | 100 | return $this->header->find("/boundary\=\"(.*)\"/"); |
| 101 | 101 | } |
| 102 | 102 | |
@@ -107,9 +107,9 @@ discard block |
||
| 107 | 107 | * @throws MessageContentFetchingException |
| 108 | 108 | * @throws InvalidMessageDateException |
| 109 | 109 | */ |
| 110 | - public function find_parts(){ |
|
| 111 | - if($this->type === IMAP::MESSAGE_TYPE_MULTIPART) { |
|
| 112 | - if (($boundary = $this->getBoundary()) === null) { |
|
| 110 | + public function find_parts() { |
|
| 111 | + if ($this->type === IMAP::MESSAGE_TYPE_MULTIPART) { |
|
| 112 | + if (($boundary = $this->getBoundary()) === null) { |
|
| 113 | 113 | throw new MessageContentFetchingException("no content found", 0); |
| 114 | 114 | } |
| 115 | 115 | |
@@ -118,21 +118,21 @@ discard block |
||
| 118 | 118 | ]; |
| 119 | 119 | |
| 120 | 120 | if (preg_match("/boundary\=\"(.*)\"/", $this->raw, $match) == 1) { |
| 121 | - if(is_array($match[1])){ |
|
| 122 | - foreach($match[1] as $matched){ |
|
| 121 | + if (is_array($match[1])) { |
|
| 122 | + foreach ($match[1] as $matched) { |
|
| 123 | 123 | $boundaries[] = $matched; |
| 124 | 124 | } |
| 125 | - }else{ |
|
| 126 | - if(!empty($match[1])) { |
|
| 125 | + }else { |
|
| 126 | + if (!empty($match[1])) { |
|
| 127 | 127 | $boundaries[] = $match[1]; |
| 128 | 128 | } |
| 129 | 129 | } |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | - $raw_parts = explode( $boundaries[0], str_replace($boundaries, $boundaries[0], $this->raw) ); |
|
| 132 | + $raw_parts = explode($boundaries[0], str_replace($boundaries, $boundaries[0], $this->raw)); |
|
| 133 | 133 | $parts = []; |
| 134 | 134 | $part_number = 0; |
| 135 | - foreach($raw_parts as $part) { |
|
| 135 | + foreach ($raw_parts as $part) { |
|
| 136 | 136 | $part = trim(rtrim($part)); |
| 137 | 137 | if ($part !== "--") { |
| 138 | 138 | $parts[] = new Part($part, null, $part_number); |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | public function findContentType(){ |
| 89 | 89 | if(stripos($this->header->get("content-type"), 'multipart') === 0) { |
| 90 | 90 | $this->type = IMAP::MESSAGE_TYPE_MULTIPART; |
| 91 | - }else{ |
|
| 91 | + } else{ |
|
| 92 | 92 | $this->type = IMAP::MESSAGE_TYPE_TEXT; |
| 93 | 93 | } |
| 94 | 94 | } |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | foreach($match[1] as $matched){ |
| 123 | 123 | $boundaries[] = $matched; |
| 124 | 124 | } |
| 125 | - }else{ |
|
| 125 | + } else{ |
|
| 126 | 126 | if(!empty($match[1])) { |
| 127 | 127 | $boundaries[] = $match[1]; |
| 128 | 128 | } |