@@ -30,13 +30,13 @@ discard block |
||
30 | 30 | * |
31 | 31 | * @return null |
32 | 32 | */ |
33 | - public function getHtmlBody(){ |
|
33 | + public function getHtmlBody() { |
|
34 | 34 | $bodies = $this->parent->getBodies(); |
35 | 35 | if (!isset($bodies['html'])) { |
36 | 36 | return null; |
37 | 37 | } |
38 | 38 | |
39 | - if(is_object($bodies['html']) && property_exists($bodies['html'], 'content')) { |
|
39 | + if (is_object($bodies['html']) && property_exists($bodies['html'], 'content')) { |
|
40 | 40 | return $bodies['html']->content; |
41 | 41 | } |
42 | 42 | return $bodies['html']; |
@@ -50,15 +50,15 @@ discard block |
||
50 | 50 | */ |
51 | 51 | public function getCustomHTMLBody($callback = false): ?string { |
52 | 52 | $body = $this->getHtmlBody(); |
53 | - if($body === null) return null; |
|
53 | + if ($body === null) return null; |
|
54 | 54 | |
55 | 55 | if ($callback !== false) { |
56 | 56 | $aAttachment = $this->parent->getAttachments(); |
57 | 57 | $aAttachment->each(function($oAttachment) use(&$body, $callback): void { |
58 | 58 | /** @var Attachment $oAttachment */ |
59 | - if(is_callable($callback)) { |
|
59 | + if (is_callable($callback)) { |
|
60 | 60 | $body = $callback($body, $oAttachment); |
61 | - }elseif(is_string($callback)) { |
|
61 | + }elseif (is_string($callback)) { |
|
62 | 62 | call_user_func($callback, [$body, $oAttachment]); |
63 | 63 | } |
64 | 64 | }); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * @return string|null |
75 | 75 | */ |
76 | 76 | public function getHTMLBodyWithEmbeddedBase64Images(): ?string { |
77 | - return $this->getCustomHTMLBody(function($body, $oAttachment){ |
|
77 | + return $this->getCustomHTMLBody(function($body, $oAttachment) { |
|
78 | 78 | /** @var Attachment $oAttachment */ |
79 | 79 | if ($oAttachment->id) { |
80 | 80 | $body = str_replace('cid:'.$oAttachment->id, 'data:'.$oAttachment->getContentType().';base64, '.base64_encode($oAttachment->getContent()), $body); |
@@ -50,7 +50,9 @@ discard block |
||
50 | 50 | */ |
51 | 51 | public function getCustomHTMLBody($callback = false): ?string { |
52 | 52 | $body = $this->getHtmlBody(); |
53 | - if($body === null) return null; |
|
53 | + if($body === null) { |
|
54 | + return null; |
|
55 | + } |
|
54 | 56 | |
55 | 57 | if ($callback !== false) { |
56 | 58 | $aAttachment = $this->parent->getAttachments(); |
@@ -58,7 +60,7 @@ discard block |
||
58 | 60 | /** @var Attachment $oAttachment */ |
59 | 61 | if(is_callable($callback)) { |
60 | 62 | $body = $callback($body, $oAttachment); |
61 | - }elseif(is_string($callback)) { |
|
63 | + } elseif(is_string($callback)) { |
|
62 | 64 | call_user_func($callback, [$body, $oAttachment]); |
63 | 65 | } |
64 | 66 | }); |
@@ -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 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | public function __call(string $method, array $arguments) { |
114 | 114 | if (strtolower(substr($method, 0, 3)) === 'get') { |
115 | 115 | $name = Str::snake(substr($method, 3)); |
116 | - if(isset($this->attributes[$name])) { |
|
116 | + if (isset($this->attributes[$name])) { |
|
117 | 117 | return $this->attributes[$name]; |
118 | 118 | } |
119 | 119 | return null; |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | * @return mixed|null |
148 | 148 | */ |
149 | 149 | public function __get($name) { |
150 | - if(isset($this->attributes[$name])) { |
|
150 | + if (isset($this->attributes[$name])) { |
|
151 | 151 | return $this->attributes[$name]; |
152 | 152 | } |
153 | 153 | |
@@ -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): void { |
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 | } |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | * |
257 | 257 | * @return string|false |
258 | 258 | */ |
259 | - public function getMimeType(){ |
|
259 | + public function getMimeType() { |
|
260 | 260 | return (new \finfo())->buffer($this->getContent(), FILEINFO_MIME_TYPE); |
261 | 261 | } |
262 | 262 | |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | */ |
268 | 268 | public function getExtension(): ?string{ |
269 | 269 | $deprecated_guesser = "\Symfony\Component\HttpFoundation\File\MimeType\ExtensionGuesser"; |
270 | - if (class_exists($deprecated_guesser) !== false){ |
|
270 | + if (class_exists($deprecated_guesser) !== false) { |
|
271 | 271 | /** @var \Symfony\Component\HttpFoundation\File\MimeType\ExtensionGuesser $deprecated_guesser */ |
272 | 272 | return $deprecated_guesser::getInstance()->guess($this->getMimeType()); |
273 | 273 | } |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | * @return $this |
301 | 301 | */ |
302 | 302 | public function setMask(string $mask): self { |
303 | - if(class_exists($mask)){ |
|
303 | + if (class_exists($mask)) { |
|
304 | 304 | $this->mask = $mask; |
305 | 305 | } |
306 | 306 | |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | */ |
326 | 326 | public function mask($mask = null): object { |
327 | 327 | $mask ??= $this->mask; |
328 | - if(class_exists($mask)){ |
|
328 | + if (class_exists($mask)) { |
|
329 | 329 | return new $mask($this); |
330 | 330 | } |
331 | 331 |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | $this->setName($filename); |
211 | 211 | } elseif (($name = $this->part->name) !== null) { |
212 | 212 | $this->setName($name); |
213 | - }else { |
|
213 | + } else { |
|
214 | 214 | $this->setName("undefined"); |
215 | 215 | } |
216 | 216 | |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | if ($name !== null) { |
246 | 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 | } |
@@ -33,11 +33,11 @@ |
||
33 | 33 | * @param object $object |
34 | 34 | */ |
35 | 35 | public function __construct($object) { |
36 | - if (property_exists($object, "personal")){ $this->personal = $object->personal; } |
|
37 | - if (property_exists($object, "mailbox")){ $this->mailbox = $object->mailbox; } |
|
38 | - if (property_exists($object, "host")){ $this->host = $object->host; } |
|
39 | - if (property_exists($object, "mail")){ $this->mail = $object->mail; } |
|
40 | - if (property_exists($object, "full")){ $this->full = $object->full; } |
|
36 | + if (property_exists($object, "personal")) { $this->personal = $object->personal; } |
|
37 | + if (property_exists($object, "mailbox")) { $this->mailbox = $object->mailbox; } |
|
38 | + if (property_exists($object, "host")) { $this->host = $object->host; } |
|
39 | + if (property_exists($object, "mail")) { $this->mail = $object->mail; } |
|
40 | + if (property_exists($object, "full")) { $this->full = $object->full; } |
|
41 | 41 | } |
42 | 42 | |
43 | 43 |
@@ -44,9 +44,9 @@ |
||
44 | 44 | * @param array<string, array<string, string>> $events |
45 | 45 | */ |
46 | 46 | public function setEvents($events): void { |
47 | - foreach($events as $section => $sectionEvents) { |
|
47 | + foreach ($events as $section => $sectionEvents) { |
|
48 | 48 | assert(is_string($section)); |
49 | - foreach($sectionEvents as $event => $class) { |
|
49 | + foreach ($sectionEvents as $event => $class) { |
|
50 | 50 | assert(is_string($event)); |
51 | 51 | assert(is_string($class) && is_a($class, Event::class, true)); |
52 | 52 | } |