@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | $this->part_number = $part->part_number; |
| 95 | 95 | |
| 96 | 96 | $default_mask = $this->oMessage->getClient()->getDefaultAttachmentMask(); |
| 97 | - if($default_mask != null) { |
|
| 97 | + if ($default_mask != null) { |
|
| 98 | 98 | $this->mask = $default_mask; |
| 99 | 99 | } |
| 100 | 100 | |
@@ -111,10 +111,10 @@ discard block |
||
| 111 | 111 | * @throws MethodNotFoundException |
| 112 | 112 | */ |
| 113 | 113 | public function __call($method, $arguments) { |
| 114 | - if(strtolower(substr($method, 0, 3)) === 'get') { |
|
| 114 | + if (strtolower(substr($method, 0, 3)) === 'get') { |
|
| 115 | 115 | $name = Str::snake(substr($method, 3)); |
| 116 | 116 | |
| 117 | - if(isset($this->attributes[$name])) { |
|
| 117 | + if (isset($this->attributes[$name])) { |
|
| 118 | 118 | return $this->attributes[$name]; |
| 119 | 119 | } |
| 120 | 120 | |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | * @return mixed|null |
| 149 | 149 | */ |
| 150 | 150 | public function __get($name) { |
| 151 | - if(isset($this->attributes[$name])) { |
|
| 151 | + if (isset($this->attributes[$name])) { |
|
| 152 | 152 | return $this->attributes[$name]; |
| 153 | 153 | } |
| 154 | 154 | |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | if (IMAP::ATTACHMENT_TYPE_MESSAGE == $this->part->type) { |
| 218 | 218 | if ($this->part->ifdescription) { |
| 219 | 219 | $this->setName($this->part->description); |
| 220 | - } else { |
|
| 220 | + }else { |
|
| 221 | 221 | $this->setName($this->part->subtype); |
| 222 | 222 | } |
| 223 | 223 | } |
@@ -243,9 +243,9 @@ discard block |
||
| 243 | 243 | public function setName($name) { |
| 244 | 244 | $decoder = $this->config['decoder']['attachment']; |
| 245 | 245 | if ($name !== null) { |
| 246 | - if($decoder === 'utf-8' && extension_loaded('imap')) { |
|
| 246 | + if ($decoder === 'utf-8' && extension_loaded('imap')) { |
|
| 247 | 247 | $this->name = \imap_utf8($name); |
| 248 | - }else{ |
|
| 248 | + }else { |
|
| 249 | 249 | $this->name = mb_decode_mimeheader($name); |
| 250 | 250 | } |
| 251 | 251 | } |
@@ -254,16 +254,16 @@ discard block |
||
| 254 | 254 | /** |
| 255 | 255 | * @return string|null |
| 256 | 256 | */ |
| 257 | - public function getMimeType(){ |
|
| 257 | + public function getMimeType() { |
|
| 258 | 258 | return (new \finfo())->buffer($this->getContent(), FILEINFO_MIME_TYPE); |
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | /** |
| 262 | 262 | * @return string|null |
| 263 | 263 | */ |
| 264 | - public function getExtension(){ |
|
| 264 | + public function getExtension() { |
|
| 265 | 265 | $deprecated_guesser = "\Symfony\Component\HttpFoundation\File\MimeType\ExtensionGuesser"; |
| 266 | - if (class_exists($deprecated_guesser) !== false){ |
|
| 266 | + if (class_exists($deprecated_guesser) !== false) { |
|
| 267 | 267 | return $deprecated_guesser::getInstance()->guess($this->getMimeType()); |
| 268 | 268 | } |
| 269 | 269 | $guesser = "\Symfony\Component\Mime\MimeTypes"; |
@@ -274,14 +274,14 @@ discard block |
||
| 274 | 274 | /** |
| 275 | 275 | * @return array |
| 276 | 276 | */ |
| 277 | - public function getAttributes(){ |
|
| 277 | + public function getAttributes() { |
|
| 278 | 278 | return $this->attributes; |
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | /** |
| 282 | 282 | * @return Message |
| 283 | 283 | */ |
| 284 | - public function getMessage(){ |
|
| 284 | + public function getMessage() { |
|
| 285 | 285 | return $this->oMessage; |
| 286 | 286 | } |
| 287 | 287 | |
@@ -289,8 +289,8 @@ discard block |
||
| 289 | 289 | * @param $mask |
| 290 | 290 | * @return $this |
| 291 | 291 | */ |
| 292 | - public function setMask($mask){ |
|
| 293 | - if(class_exists($mask)){ |
|
| 292 | + public function setMask($mask) { |
|
| 293 | + if (class_exists($mask)) { |
|
| 294 | 294 | $this->mask = $mask; |
| 295 | 295 | } |
| 296 | 296 | |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | /** |
| 301 | 301 | * @return string |
| 302 | 302 | */ |
| 303 | - public function getMask(){ |
|
| 303 | + public function getMask() { |
|
| 304 | 304 | return $this->mask; |
| 305 | 305 | } |
| 306 | 306 | |
@@ -311,9 +311,9 @@ discard block |
||
| 311 | 311 | * @return mixed |
| 312 | 312 | * @throws MaskNotFoundException |
| 313 | 313 | */ |
| 314 | - public function mask($mask = null){ |
|
| 314 | + public function mask($mask = null) { |
|
| 315 | 315 | $mask = $mask !== null ? $mask : $this->mask; |
| 316 | - if(class_exists($mask)){ |
|
| 316 | + if (class_exists($mask)) { |
|
| 317 | 317 | return new $mask($this); |
| 318 | 318 | } |
| 319 | 319 | |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | * @throws MessageContentFetchingException |
| 70 | 70 | * @throws InvalidMessageDateException |
| 71 | 71 | */ |
| 72 | - protected function parse(){ |
|
| 72 | + protected function parse() { |
|
| 73 | 73 | $this->findContentType(); |
| 74 | 74 | $this->parts = $this->find_parts(); |
| 75 | 75 | } |
@@ -77,10 +77,10 @@ discard block |
||
| 77 | 77 | /** |
| 78 | 78 | * Determine the message content type |
| 79 | 79 | */ |
| 80 | - public function findContentType(){ |
|
| 81 | - if(stripos($this->header->get("content-type"), 'multipart') === 0) { |
|
| 80 | + public function findContentType() { |
|
| 81 | + if (stripos($this->header->get("content-type"), 'multipart') === 0) { |
|
| 82 | 82 | $this->type = IMAP::MESSAGE_TYPE_MULTIPART; |
| 83 | - }else{ |
|
| 83 | + }else { |
|
| 84 | 84 | $this->type = IMAP::MESSAGE_TYPE_TEXT; |
| 85 | 85 | } |
| 86 | 86 | } |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | /** |
| 89 | 89 | * Determine the message content type |
| 90 | 90 | */ |
| 91 | - public function getBoundary(){ |
|
| 91 | + public function getBoundary() { |
|
| 92 | 92 | return $this->header->find("/boundary\=\"(.*)\"/"); |
| 93 | 93 | } |
| 94 | 94 | |
@@ -97,16 +97,16 @@ discard block |
||
| 97 | 97 | * @throws MessageContentFetchingException |
| 98 | 98 | * @throws InvalidMessageDateException |
| 99 | 99 | */ |
| 100 | - public function find_parts(){ |
|
| 101 | - if($this->type === IMAP::MESSAGE_TYPE_MULTIPART) { |
|
| 102 | - if (($boundary = $this->getBoundary()) === null) { |
|
| 100 | + public function find_parts() { |
|
| 101 | + if ($this->type === IMAP::MESSAGE_TYPE_MULTIPART) { |
|
| 102 | + if (($boundary = $this->getBoundary()) === null) { |
|
| 103 | 103 | throw new MessageContentFetchingException("no content found", 0); |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | $raw_parts = explode($boundary, $this->raw); |
| 107 | 107 | $parts = []; |
| 108 | 108 | $part_number = 0; |
| 109 | - foreach($raw_parts as $part) { |
|
| 109 | + foreach ($raw_parts as $part) { |
|
| 110 | 110 | $part = trim(rtrim($part)); |
| 111 | 111 | if ($part !== "--") { |
| 112 | 112 | $parts[] = new Part($part, null, $part_number); |