@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | |
84 | 84 | if (strpos(strtolower($name), "where") === false){ |
85 | 85 | $method = 'where'.ucfirst($name); |
86 | - }else{ |
|
86 | + } else{ |
|
87 | 87 | $method = lcfirst($name); |
88 | 88 | } |
89 | 89 | |
@@ -129,13 +129,13 @@ discard block |
||
129 | 129 | } |
130 | 130 | return $this->where($key, $value); |
131 | 131 | } |
132 | - }else{ |
|
132 | + } else{ |
|
133 | 133 | $criteria = $this->validate_criteria($criteria); |
134 | 134 | $value = $this->parse_value($value); |
135 | 135 | |
136 | 136 | if($value === null || $value === ''){ |
137 | 137 | $this->query->push([$criteria]); |
138 | - }else{ |
|
138 | + } else{ |
|
139 | 139 | $this->query->push([$criteria, $value]); |
140 | 140 | } |
141 | 141 | } |
@@ -150,7 +150,9 @@ discard block |
||
150 | 150 | */ |
151 | 151 | public function orWhere(\Closure $closure = null) { |
152 | 152 | $this->query->push(['OR']); |
153 | - if($closure !== null) $closure($this); |
|
153 | + if($closure !== null) { |
|
154 | + $closure($this); |
|
155 | + } |
|
154 | 156 | |
155 | 157 | return $this; |
156 | 158 | } |
@@ -162,7 +164,9 @@ discard block |
||
162 | 164 | */ |
163 | 165 | public function andWhere(\Closure $closure = null) { |
164 | 166 | $this->query->push(['AND']); |
165 | - if($closure !== null) $closure($this); |
|
167 | + if($closure !== null) { |
|
168 | + $closure($this); |
|
169 | + } |
|
166 | 170 | |
167 | 171 | return $this; |
168 | 172 | } |
@@ -76,18 +76,18 @@ discard block |
||
76 | 76 | |
77 | 77 | $name = Str::camel($name); |
78 | 78 | |
79 | - if(strtolower(substr($name, 0, 3)) === 'not') { |
|
79 | + if (strtolower(substr($name, 0, 3)) === 'not') { |
|
80 | 80 | $that = $that->whereNot(); |
81 | 81 | $name = substr($name, 3); |
82 | 82 | } |
83 | 83 | |
84 | - if (strpos(strtolower($name), "where") === false){ |
|
84 | + if (strpos(strtolower($name), "where") === false) { |
|
85 | 85 | $method = 'where'.ucfirst($name); |
86 | - }else{ |
|
86 | + } else { |
|
87 | 87 | $method = lcfirst($name); |
88 | 88 | } |
89 | 89 | |
90 | - if(method_exists($this, $method) === true){ |
|
90 | + if (method_exists($this, $method) === true) { |
|
91 | 91 | return call_user_func_array([$that, $method], $arguments); |
92 | 92 | } |
93 | 93 | |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | if (substr($criteria, 0, 7) === "CUSTOM ") { |
107 | 107 | return substr($criteria, 7); |
108 | 108 | } |
109 | - if(in_array($criteria, $this->available_criteria) === false) { |
|
109 | + if (in_array($criteria, $this->available_criteria) === false) { |
|
110 | 110 | throw new InvalidWhereQueryCriteriaException(); |
111 | 111 | } |
112 | 112 | |
@@ -121,20 +121,20 @@ discard block |
||
121 | 121 | * @throws InvalidWhereQueryCriteriaException |
122 | 122 | */ |
123 | 123 | public function where($criteria, $value = null) { |
124 | - if(is_array($criteria)){ |
|
125 | - foreach($criteria as $key => $value){ |
|
126 | - if(is_numeric($key)){ |
|
124 | + if (is_array($criteria)) { |
|
125 | + foreach ($criteria as $key => $value) { |
|
126 | + if (is_numeric($key)) { |
|
127 | 127 | return $this->where($value); |
128 | 128 | } |
129 | 129 | return $this->where($key, $value); |
130 | 130 | } |
131 | - }else{ |
|
131 | + } else { |
|
132 | 132 | $criteria = $this->validate_criteria($criteria); |
133 | 133 | $value = $this->parse_value($value); |
134 | 134 | |
135 | - if($value === null || $value === ''){ |
|
135 | + if ($value === null || $value === '') { |
|
136 | 136 | $this->query->push([$criteria]); |
137 | - }else{ |
|
137 | + } else { |
|
138 | 138 | $this->query->push([$criteria, $value]); |
139 | 139 | } |
140 | 140 | } |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | */ |
150 | 150 | public function orWhere(\Closure $closure = null) { |
151 | 151 | $this->query->push(['OR']); |
152 | - if($closure !== null) $closure($this); |
|
152 | + if ($closure !== null) $closure($this); |
|
153 | 153 | |
154 | 154 | return $this; |
155 | 155 | } |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | */ |
162 | 162 | public function andWhere(\Closure $closure = null) { |
163 | 163 | $this->query->push(['AND']); |
164 | - if($closure !== null) $closure($this); |
|
164 | + if ($closure !== null) $closure($this); |
|
165 | 165 | |
166 | 166 | return $this; |
167 | 167 | } |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | * @return WhereQuery |
402 | 402 | * @throws InvalidWhereQueryCriteriaException |
403 | 403 | */ |
404 | - public function whereNoXSpam(){ |
|
404 | + public function whereNoXSpam() { |
|
405 | 405 | return $this->where("CUSTOM X-Spam-Flag NO"); |
406 | 406 | } |
407 | 407 | |
@@ -409,7 +409,7 @@ discard block |
||
409 | 409 | * @return WhereQuery |
410 | 410 | * @throws InvalidWhereQueryCriteriaException |
411 | 411 | */ |
412 | - public function whereIsXSpam(){ |
|
412 | + public function whereIsXSpam() { |
|
413 | 413 | return $this->where("CUSTOM X-Spam-Flag YES"); |
414 | 414 | } |
415 | 415 | |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | * @return WhereQuery |
420 | 420 | * @throws InvalidWhereQueryCriteriaException |
421 | 421 | */ |
422 | - public function whereLanguage($country_code){ |
|
422 | + public function whereLanguage($country_code) { |
|
423 | 423 | return $this->where("Content-Language $country_code"); |
424 | 424 | } |
425 | 425 | } |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | $this->part_number = ($part_number) ? $part_number : $this->part_number; |
98 | 98 | |
99 | 99 | $default_mask = $this->oMessage->getClient()->getDefaultAttachmentMask(); |
100 | - if($default_mask != null) { |
|
100 | + if ($default_mask != null) { |
|
101 | 101 | $this->mask = $default_mask; |
102 | 102 | } |
103 | 103 | |
@@ -114,10 +114,10 @@ discard block |
||
114 | 114 | * @throws MethodNotFoundException |
115 | 115 | */ |
116 | 116 | public function __call($method, $arguments) { |
117 | - if(strtolower(substr($method, 0, 3)) === 'get') { |
|
117 | + if (strtolower(substr($method, 0, 3)) === 'get') { |
|
118 | 118 | $name = Str::snake(substr($method, 3)); |
119 | 119 | |
120 | - if(isset($this->attributes[$name])) { |
|
120 | + if (isset($this->attributes[$name])) { |
|
121 | 121 | return $this->attributes[$name]; |
122 | 122 | } |
123 | 123 | |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | * @return mixed|null |
152 | 152 | */ |
153 | 153 | public function __get($name) { |
154 | - if(isset($this->attributes[$name])) { |
|
154 | + if (isset($this->attributes[$name])) { |
|
155 | 155 | return $this->attributes[$name]; |
156 | 156 | } |
157 | 157 | |
@@ -263,11 +263,11 @@ discard block |
||
263 | 263 | * @param $name |
264 | 264 | */ |
265 | 265 | public function setName($name) { |
266 | - if($this->config['decoder']['attachment']['name'] === 'utf-8') { |
|
266 | + if ($this->config['decoder']['attachment']['name'] === 'utf-8') { |
|
267 | 267 | $this->name = \imap_utf8($name); |
268 | - }elseif($this->config['decoder']['attachment']['name'] === 'iconv') { |
|
268 | + }elseif ($this->config['decoder']['attachment']['name'] === 'iconv') { |
|
269 | 269 | $this->name = iconv_mime_decode($name); |
270 | - }else{ |
|
270 | + } else { |
|
271 | 271 | $this->name = mb_decode_mimeheader($name); |
272 | 272 | } |
273 | 273 | } |
@@ -287,16 +287,16 @@ discard block |
||
287 | 287 | /** |
288 | 288 | * @return string|null |
289 | 289 | */ |
290 | - public function getMimeType(){ |
|
290 | + public function getMimeType() { |
|
291 | 291 | return (new \finfo())->buffer($this->getContent(), FILEINFO_MIME_TYPE); |
292 | 292 | } |
293 | 293 | |
294 | 294 | /** |
295 | 295 | * @return string|null |
296 | 296 | */ |
297 | - public function getExtension(){ |
|
297 | + public function getExtension() { |
|
298 | 298 | $deprecated_guesser = "\Symfony\Component\HttpFoundation\File\MimeType\ExtensionGuesser"; |
299 | - if (class_exists($deprecated_guesser) !== false){ |
|
299 | + if (class_exists($deprecated_guesser) !== false) { |
|
300 | 300 | return $deprecated_guesser::getInstance()->guess($this->getMimeType()); |
301 | 301 | } |
302 | 302 | $guesser = "\Symfony\Component\Mime\MimeTypes"; |
@@ -307,14 +307,14 @@ discard block |
||
307 | 307 | /** |
308 | 308 | * @return array |
309 | 309 | */ |
310 | - public function getAttributes(){ |
|
310 | + public function getAttributes() { |
|
311 | 311 | return $this->attributes; |
312 | 312 | } |
313 | 313 | |
314 | 314 | /** |
315 | 315 | * @return Message |
316 | 316 | */ |
317 | - public function getMessage(){ |
|
317 | + public function getMessage() { |
|
318 | 318 | return $this->oMessage; |
319 | 319 | } |
320 | 320 | |
@@ -322,8 +322,8 @@ discard block |
||
322 | 322 | * @param $mask |
323 | 323 | * @return $this |
324 | 324 | */ |
325 | - public function setMask($mask){ |
|
326 | - if(class_exists($mask)){ |
|
325 | + public function setMask($mask) { |
|
326 | + if (class_exists($mask)) { |
|
327 | 327 | $this->mask = $mask; |
328 | 328 | } |
329 | 329 | |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | /** |
334 | 334 | * @return string |
335 | 335 | */ |
336 | - public function getMask(){ |
|
336 | + public function getMask() { |
|
337 | 337 | return $this->mask; |
338 | 338 | } |
339 | 339 | |
@@ -344,9 +344,9 @@ discard block |
||
344 | 344 | * @return mixed |
345 | 345 | * @throws MaskNotFoundException |
346 | 346 | */ |
347 | - public function mask($mask = null){ |
|
347 | + public function mask($mask = null) { |
|
348 | 348 | $mask = $mask !== null ? $mask : $this->mask; |
349 | - if(class_exists($mask)){ |
|
349 | + if (class_exists($mask)) { |
|
350 | 350 | return new $mask($this); |
351 | 351 | } |
352 | 352 |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | } |
123 | 123 | |
124 | 124 | return null; |
125 | - }elseif (strtolower(substr($method, 0, 3)) === 'set') { |
|
125 | + } elseif (strtolower(substr($method, 0, 3)) === 'set') { |
|
126 | 126 | $name = Str::snake(substr($method, 3)); |
127 | 127 | |
128 | 128 | $this->attributes[$name] = array_pop($arguments); |
@@ -265,9 +265,9 @@ discard block |
||
265 | 265 | public function setName($name) { |
266 | 266 | if($this->config['decoder']['attachment']['name'] === 'utf-8') { |
267 | 267 | $this->name = \imap_utf8($name); |
268 | - }elseif($this->config['decoder']['attachment']['name'] === 'iconv') { |
|
268 | + } elseif($this->config['decoder']['attachment']['name'] === 'iconv') { |
|
269 | 269 | $this->name = iconv_mime_decode($name); |
270 | - }else{ |
|
270 | + } else{ |
|
271 | 271 | $this->name = mb_decode_mimeheader($name); |
272 | 272 | } |
273 | 273 | } |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | public function __construct($uid, $msglist, Client $client, $fetch_options = null, $fetch_body = false, $fetch_attachment = false, $fetch_flags = false) { |
201 | 201 | |
202 | 202 | $default_mask = $client->getDefaultMessageMask(); |
203 | - if($default_mask != null) { |
|
203 | + if ($default_mask != null) { |
|
204 | 204 | $this->mask = $default_mask; |
205 | 205 | } |
206 | 206 | |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | $this->msglist = $msglist; |
220 | 220 | $this->client = $client; |
221 | 221 | |
222 | - $this->uid = ($this->fetch_options == IMAP::FT_UID) ? $uid : $uid; |
|
222 | + $this->uid = ($this->fetch_options == IMAP::FT_UID) ? $uid : $uid; |
|
223 | 223 | $this->msgn = ($this->fetch_options == IMAP::FT_UID) ? \imap_msgno($this->client->getConnection(), $uid) : $uid; |
224 | 224 | |
225 | 225 | $this->parseHeader(); |
@@ -242,17 +242,17 @@ discard block |
||
242 | 242 | * @throws MethodNotFoundException |
243 | 243 | */ |
244 | 244 | public function __call($method, $arguments) { |
245 | - if(strtolower(substr($method, 0, 3)) === 'get') { |
|
245 | + if (strtolower(substr($method, 0, 3)) === 'get') { |
|
246 | 246 | $name = Str::snake(substr($method, 3)); |
247 | 247 | |
248 | - if(in_array($name, array_keys($this->attributes))) { |
|
248 | + if (in_array($name, array_keys($this->attributes))) { |
|
249 | 249 | return $this->attributes[$name]; |
250 | 250 | } |
251 | 251 | |
252 | 252 | }elseif (strtolower(substr($method, 0, 3)) === 'set') { |
253 | 253 | $name = Str::snake(substr($method, 3)); |
254 | 254 | |
255 | - if(in_array($name, array_keys($this->attributes))) { |
|
255 | + if (in_array($name, array_keys($this->attributes))) { |
|
256 | 256 | $this->attributes[$name] = array_pop($arguments); |
257 | 257 | |
258 | 258 | return $this->attributes[$name]; |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | * @return mixed|null |
282 | 282 | */ |
283 | 283 | public function __get($name) { |
284 | - if(isset($this->attributes[$name])) { |
|
284 | + if (isset($this->attributes[$name])) { |
|
285 | 285 | return $this->attributes[$name]; |
286 | 286 | } |
287 | 287 | |
@@ -367,11 +367,11 @@ discard block |
||
367 | 367 | if ($replaceImages !== false) { |
368 | 368 | $this->attachments->each(function($oAttachment) use(&$body, $replaceImages) { |
369 | 369 | /** @var Attachment $oAttachment */ |
370 | - if(is_callable($replaceImages)) { |
|
370 | + if (is_callable($replaceImages)) { |
|
371 | 371 | $body = $replaceImages($body, $oAttachment); |
372 | - }elseif(is_string($replaceImages)) { |
|
372 | + }elseif (is_string($replaceImages)) { |
|
373 | 373 | call_user_func($replaceImages, [$body, $oAttachment]); |
374 | - }else{ |
|
374 | + } else { |
|
375 | 375 | if ($oAttachment->id && $oAttachment->getImgSrc() != null) { |
376 | 376 | $body = str_replace('cid:'.$oAttachment->id, $oAttachment->getImgSrc(), $body); |
377 | 377 | } |
@@ -400,16 +400,16 @@ discard block |
||
400 | 400 | } |
401 | 401 | |
402 | 402 | if (property_exists($header, 'subject')) { |
403 | - if($this->config['decoder']['message']['subject'] === 'utf-8') { |
|
403 | + if ($this->config['decoder']['message']['subject'] === 'utf-8') { |
|
404 | 404 | $this->subject = \imap_utf8($header->subject); |
405 | - }elseif($this->config['decoder']['message']['subject'] === 'iconv') { |
|
405 | + }elseif ($this->config['decoder']['message']['subject'] === 'iconv') { |
|
406 | 406 | $this->subject = iconv_mime_decode($header->subject); |
407 | - }else{ |
|
407 | + } else { |
|
408 | 408 | $this->subject = mb_decode_mimeheader($header->subject); |
409 | 409 | } |
410 | 410 | } |
411 | 411 | |
412 | - foreach(['from', 'to', 'cc', 'bcc', 'reply_to', 'sender'] as $part){ |
|
412 | + foreach (['from', 'to', 'cc', 'bcc', 'reply_to', 'sender'] as $part) { |
|
413 | 413 | $this->extractHeaderAddressPart($header, $part); |
414 | 414 | } |
415 | 415 | |
@@ -439,9 +439,9 @@ discard block |
||
439 | 439 | * @return int|null |
440 | 440 | */ |
441 | 441 | private function extractPriority($header) { |
442 | - if(preg_match('/x\-priority\:.*([0-9]{1,2})/i', $header, $priority)){ |
|
442 | + if (preg_match('/x\-priority\:.*([0-9]{1,2})/i', $header, $priority)) { |
|
443 | 443 | $priority = isset($priority[1]) ? (int) $priority[1] : 0; |
444 | - switch($priority){ |
|
444 | + switch ($priority) { |
|
445 | 445 | case IMAP::MESSAGE_PRIORITY_HIGHEST; |
446 | 446 | $priority = IMAP::MESSAGE_PRIORITY_HIGHEST; |
447 | 447 | break; |
@@ -492,7 +492,7 @@ discard block |
||
492 | 492 | if (property_exists($header, 'date')) { |
493 | 493 | $date = $header->date; |
494 | 494 | |
495 | - if(preg_match('/\+0580/', $date)) { |
|
495 | + if (preg_match('/\+0580/', $date)) { |
|
496 | 496 | $date = str_replace('+0580', '+0530', $date); |
497 | 497 | } |
498 | 498 | |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | $date = trim(array_pop($array)); |
516 | 516 | break; |
517 | 517 | } |
518 | - try{ |
|
518 | + try { |
|
519 | 519 | $parsed_date = Carbon::parse($date); |
520 | 520 | } catch (\Exception $_e) { |
521 | 521 | throw new InvalidMessageDateException("Invalid message date. ID:".$this->getMessageId(), 1000, $e); |
@@ -538,7 +538,7 @@ discard block |
||
538 | 538 | $this->client->openFolder($this->folder_path); |
539 | 539 | $flags = \imap_fetch_overview($this->client->getConnection(), $this->uid, IMAP::FT_UID); |
540 | 540 | if (is_array($flags) && isset($flags[0])) { |
541 | - foreach($this->available_flags as $flag) { |
|
541 | + foreach ($this->available_flags as $flag) { |
|
542 | 542 | $this->parseFlag($flags, $flag); |
543 | 543 | } |
544 | 544 | } |
@@ -610,7 +610,7 @@ discard block |
||
610 | 610 | } else { |
611 | 611 | $personalParts = \imap_mime_header_decode($address->personal); |
612 | 612 | |
613 | - if(is_array($personalParts)) { |
|
613 | + if (is_array($personalParts)) { |
|
614 | 614 | $address->personal = ''; |
615 | 615 | foreach ($personalParts as $p) { |
616 | 616 | $encoding = (property_exists($p, 'charset')) ? $p->charset : $this->getEncoding($p->text); |
@@ -638,12 +638,12 @@ discard block |
||
638 | 638 | $this->client->openFolder($this->folder_path); |
639 | 639 | $this->structure = \imap_fetchstructure($this->client->getConnection(), $this->uid, IMAP::FT_UID); |
640 | 640 | |
641 | - if(property_exists($this->structure, 'parts')){ |
|
641 | + if (property_exists($this->structure, 'parts')) { |
|
642 | 642 | $parts = $this->structure->parts; |
643 | 643 | |
644 | - foreach ($parts as $part) { |
|
645 | - foreach ($part->parameters as $parameter) { |
|
646 | - if($parameter->attribute == "charset") { |
|
644 | + foreach ($parts as $part) { |
|
645 | + foreach ($part->parameters as $parameter) { |
|
646 | + if ($parameter->attribute == "charset") { |
|
647 | 647 | $encoding = $parameter->value; |
648 | 648 | |
649 | 649 | $encoding = preg_replace('/Content-Transfer-Encoding/', '', $encoding); |
@@ -922,7 +922,7 @@ discard block |
||
922 | 922 | return EncodingAliases::get($parameter->value); |
923 | 923 | } |
924 | 924 | } |
925 | - }elseif (is_string($structure) === true){ |
|
925 | + }elseif (is_string($structure) === true) { |
|
926 | 926 | return mb_detect_encoding($structure); |
927 | 927 | } |
928 | 928 | |
@@ -972,7 +972,7 @@ discard block |
||
972 | 972 | return null; |
973 | 973 | } |
974 | 974 | |
975 | - public function getFolder(){ |
|
975 | + public function getFolder() { |
|
976 | 976 | return $this->client->getFolder($this->folder_path); |
977 | 977 | } |
978 | 978 | |
@@ -988,7 +988,7 @@ discard block |
||
988 | 988 | */ |
989 | 989 | public function moveToFolder($mailbox = 'INBOX', $expunge = false, $create_folder = true) { |
990 | 990 | |
991 | - if($create_folder) $this->client->createFolder($mailbox, true); |
|
991 | + if ($create_folder) $this->client->createFolder($mailbox, true); |
|
992 | 992 | |
993 | 993 | $target_folder = $this->client->getFolder($mailbox); |
994 | 994 | $target_status = $target_folder->getStatus(IMAP::SA_ALL); |
@@ -996,8 +996,8 @@ discard block |
||
996 | 996 | $this->client->openFolder($this->folder_path); |
997 | 997 | $status = \imap_mail_move($this->client->getConnection(), $this->uid, $mailbox, IMAP::CP_UID); |
998 | 998 | |
999 | - if($status === true){ |
|
1000 | - if($expunge) $this->client->expunge(); |
|
999 | + if ($status === true) { |
|
1000 | + if ($expunge) $this->client->expunge(); |
|
1001 | 1001 | $this->client->openFolder($target_folder->path); |
1002 | 1002 | |
1003 | 1003 | $message = $target_folder->getMessage($target_status->uidnext, null, $this->fetch_options, $this->fetch_body, $this->fetch_attachment, $this->fetch_flags); |
@@ -1019,7 +1019,7 @@ discard block |
||
1019 | 1019 | $this->client->openFolder($this->folder_path); |
1020 | 1020 | |
1021 | 1021 | $status = \imap_delete($this->client->getConnection(), $this->uid, IMAP::FT_UID); |
1022 | - if($expunge) $this->client->expunge(); |
|
1022 | + if ($expunge) $this->client->expunge(); |
|
1023 | 1023 | MessageDeletedEvent::dispatch($this); |
1024 | 1024 | |
1025 | 1025 | return $status; |
@@ -1036,7 +1036,7 @@ discard block |
||
1036 | 1036 | $this->client->openFolder($this->folder_path); |
1037 | 1037 | |
1038 | 1038 | $status = \imap_undelete($this->client->getConnection(), $this->uid, IMAP::FT_UID); |
1039 | - if($expunge) $this->client->expunge(); |
|
1039 | + if ($expunge) $this->client->expunge(); |
|
1040 | 1040 | MessageRestoredEvent::dispatch($this); |
1041 | 1041 | |
1042 | 1042 | return $status; |
@@ -1167,7 +1167,7 @@ discard block |
||
1167 | 1167 | /** |
1168 | 1168 | * @return object|null |
1169 | 1169 | */ |
1170 | - public function getStructure(){ |
|
1170 | + public function getStructure() { |
|
1171 | 1171 | return $this->structure; |
1172 | 1172 | } |
1173 | 1173 | |
@@ -1193,7 +1193,7 @@ discard block |
||
1193 | 1193 | /** |
1194 | 1194 | * @return array |
1195 | 1195 | */ |
1196 | - public function getAttributes(){ |
|
1196 | + public function getAttributes() { |
|
1197 | 1197 | return $this->attributes; |
1198 | 1198 | } |
1199 | 1199 | |
@@ -1201,8 +1201,8 @@ discard block |
||
1201 | 1201 | * @param $mask |
1202 | 1202 | * @return $this |
1203 | 1203 | */ |
1204 | - public function setMask($mask){ |
|
1205 | - if(class_exists($mask)){ |
|
1204 | + public function setMask($mask) { |
|
1205 | + if (class_exists($mask)) { |
|
1206 | 1206 | $this->mask = $mask; |
1207 | 1207 | } |
1208 | 1208 | |
@@ -1212,7 +1212,7 @@ discard block |
||
1212 | 1212 | /** |
1213 | 1213 | * @return string |
1214 | 1214 | */ |
1215 | - public function getMask(){ |
|
1215 | + public function getMask() { |
|
1216 | 1216 | return $this->mask; |
1217 | 1217 | } |
1218 | 1218 | |
@@ -1223,9 +1223,9 @@ discard block |
||
1223 | 1223 | * @return mixed |
1224 | 1224 | * @throws MaskNotFoundException |
1225 | 1225 | */ |
1226 | - public function mask($mask = null){ |
|
1226 | + public function mask($mask = null) { |
|
1227 | 1227 | $mask = $mask !== null ? $mask : $this->mask; |
1228 | - if(class_exists($mask)){ |
|
1228 | + if (class_exists($mask)) { |
|
1229 | 1229 | return new $mask($this); |
1230 | 1230 | } |
1231 | 1231 |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | return $this->attributes[$name]; |
250 | 250 | } |
251 | 251 | |
252 | - }elseif (strtolower(substr($method, 0, 3)) === 'set') { |
|
252 | + } elseif (strtolower(substr($method, 0, 3)) === 'set') { |
|
253 | 253 | $name = Str::snake(substr($method, 3)); |
254 | 254 | |
255 | 255 | if(in_array($name, array_keys($this->attributes))) { |
@@ -369,9 +369,9 @@ discard block |
||
369 | 369 | /** @var Attachment $oAttachment */ |
370 | 370 | if(is_callable($replaceImages)) { |
371 | 371 | $body = $replaceImages($body, $oAttachment); |
372 | - }elseif(is_string($replaceImages)) { |
|
372 | + } elseif(is_string($replaceImages)) { |
|
373 | 373 | call_user_func($replaceImages, [$body, $oAttachment]); |
374 | - }else{ |
|
374 | + } else{ |
|
375 | 375 | if ($oAttachment->id && $oAttachment->getImgSrc() != null) { |
376 | 376 | $body = str_replace('cid:'.$oAttachment->id, $oAttachment->getImgSrc(), $body); |
377 | 377 | } |
@@ -402,9 +402,9 @@ discard block |
||
402 | 402 | if (property_exists($header, 'subject')) { |
403 | 403 | if($this->config['decoder']['message']['subject'] === 'utf-8') { |
404 | 404 | $this->subject = \imap_utf8($header->subject); |
405 | - }elseif($this->config['decoder']['message']['subject'] === 'iconv') { |
|
405 | + } elseif($this->config['decoder']['message']['subject'] === 'iconv') { |
|
406 | 406 | $this->subject = iconv_mime_decode($header->subject); |
407 | - }else{ |
|
407 | + } else{ |
|
408 | 408 | $this->subject = mb_decode_mimeheader($header->subject); |
409 | 409 | } |
410 | 410 | } |
@@ -922,7 +922,7 @@ discard block |
||
922 | 922 | return EncodingAliases::get($parameter->value); |
923 | 923 | } |
924 | 924 | } |
925 | - }elseif (is_string($structure) === true){ |
|
925 | + } elseif (is_string($structure) === true){ |
|
926 | 926 | return mb_detect_encoding($structure); |
927 | 927 | } |
928 | 928 | |
@@ -988,7 +988,9 @@ discard block |
||
988 | 988 | */ |
989 | 989 | public function moveToFolder($mailbox = 'INBOX', $expunge = false, $create_folder = true) { |
990 | 990 | |
991 | - if($create_folder) $this->client->createFolder($mailbox, true); |
|
991 | + if($create_folder) { |
|
992 | + $this->client->createFolder($mailbox, true); |
|
993 | + } |
|
992 | 994 | |
993 | 995 | $target_folder = $this->client->getFolder($mailbox); |
994 | 996 | $target_status = $target_folder->getStatus(IMAP::SA_ALL); |
@@ -997,7 +999,9 @@ discard block |
||
997 | 999 | $status = \imap_mail_move($this->client->getConnection(), $this->uid, $mailbox, IMAP::CP_UID); |
998 | 1000 | |
999 | 1001 | if($status === true){ |
1000 | - if($expunge) $this->client->expunge(); |
|
1002 | + if($expunge) { |
|
1003 | + $this->client->expunge(); |
|
1004 | + } |
|
1001 | 1005 | $this->client->openFolder($target_folder->path); |
1002 | 1006 | |
1003 | 1007 | $message = $target_folder->getMessage($target_status->uidnext, null, $this->fetch_options, $this->fetch_body, $this->fetch_attachment, $this->fetch_flags); |
@@ -1019,7 +1023,9 @@ discard block |
||
1019 | 1023 | $this->client->openFolder($this->folder_path); |
1020 | 1024 | |
1021 | 1025 | $status = \imap_delete($this->client->getConnection(), $this->uid, IMAP::FT_UID); |
1022 | - if($expunge) $this->client->expunge(); |
|
1026 | + if($expunge) { |
|
1027 | + $this->client->expunge(); |
|
1028 | + } |
|
1023 | 1029 | MessageDeletedEvent::dispatch($this); |
1024 | 1030 | |
1025 | 1031 | return $status; |
@@ -1036,7 +1042,9 @@ discard block |
||
1036 | 1042 | $this->client->openFolder($this->folder_path); |
1037 | 1043 | |
1038 | 1044 | $status = \imap_undelete($this->client->getConnection(), $this->uid, IMAP::FT_UID); |
1039 | - if($expunge) $this->client->expunge(); |
|
1045 | + if($expunge) { |
|
1046 | + $this->client->expunge(); |
|
1047 | + } |
|
1040 | 1048 | MessageRestoredEvent::dispatch($this); |
1041 | 1049 | |
1042 | 1050 | return $status; |