| @@ -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]/i"); | 
| 104 | 104 | |
| 105 | 105 |          if ($boundary === null) { | 
| @@ -116,9 +116,9 @@ discard block | ||
| 116 | 116 | * @throws MessageContentFetchingException | 
| 117 | 117 | * @throws InvalidMessageDateException | 
| 118 | 118 | */ | 
| 119 | -    public function find_parts(){ | |
| 120 | -        if($this->type === IMAP::MESSAGE_TYPE_MULTIPART) { | |
| 121 | -            if (($boundary = $this->getBoundary()) === null)  { | |
| 119 | +    public function find_parts() { | |
| 120 | +        if ($this->type === IMAP::MESSAGE_TYPE_MULTIPART) { | |
| 121 | +            if (($boundary = $this->getBoundary()) === null) { | |
| 122 | 122 |                  throw new MessageContentFetchingException("no content found", 0); | 
| 123 | 123 | } | 
| 124 | 124 | |
| @@ -127,21 +127,21 @@ discard block | ||
| 127 | 127 | ]; | 
| 128 | 128 | |
| 129 | 129 |              if (preg_match("/boundary\=\"?(.*)\"?/", $this->raw, $match) == 1) { | 
| 130 | -                if(is_array($match[1])){ | |
| 131 | -                    foreach($match[1] as $matched){ | |
| 130 | +                if (is_array($match[1])) { | |
| 131 | +                    foreach ($match[1] as $matched) { | |
| 132 | 132 |                          $boundaries[] = str_replace('"', '', $matched); | 
| 133 | 133 | } | 
| 134 | -                }else{ | |
| 135 | -                    if(!empty($match[1])) { | |
| 134 | +                }else { | |
| 135 | +                    if (!empty($match[1])) { | |
| 136 | 136 |                          $boundaries[] = str_replace('"', '', $match[1]); | 
| 137 | 137 | } | 
| 138 | 138 | } | 
| 139 | 139 | } | 
| 140 | 140 | |
| 141 | - $raw_parts = explode( $boundaries[0], str_replace($boundaries, $boundaries[0], $this->raw) ); | |
| 141 | + $raw_parts = explode($boundaries[0], str_replace($boundaries, $boundaries[0], $this->raw)); | |
| 142 | 142 | $parts = []; | 
| 143 | 143 | $part_number = 0; | 
| 144 | -            foreach($raw_parts as $part) { | |
| 144 | +            foreach ($raw_parts as $part) { | |
| 145 | 145 | $part = trim(rtrim($part)); | 
| 146 | 146 |                  if ($part !== "--") { | 
| 147 | 147 | $parts[] = new Part($part, null, $part_number); |