@@ -173,45 +173,45 @@ discard block |
||
173 | 173 | * @throws MaskNotFoundException |
174 | 174 | */ |
175 | 175 | protected function setMaskFromConfig($config) { |
176 | - $default_config = config("imap.masks"); |
|
176 | + $default_config = config("imap.masks"); |
|
177 | 177 | |
178 | - if(isset($config['masks'])){ |
|
179 | - if(isset($config['masks']['message'])) { |
|
180 | - if(class_exists($config['masks']['message'])) { |
|
178 | + if (isset($config['masks'])) { |
|
179 | + if (isset($config['masks']['message'])) { |
|
180 | + if (class_exists($config['masks']['message'])) { |
|
181 | 181 | $this->default_message_mask = $config['masks']['message']; |
182 | - }else{ |
|
182 | + } else { |
|
183 | 183 | throw new MaskNotFoundException("Unknown mask provided: ".$config['masks']['message']); |
184 | 184 | } |
185 | - }else{ |
|
186 | - if(class_exists($default_config['message'])) { |
|
185 | + } else { |
|
186 | + if (class_exists($default_config['message'])) { |
|
187 | 187 | $this->default_message_mask = $default_config['message']; |
188 | - }else{ |
|
188 | + } else { |
|
189 | 189 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['message']); |
190 | 190 | } |
191 | 191 | } |
192 | - if(isset($config['masks']['attachment'])) { |
|
193 | - if(class_exists($config['masks']['attachment'])) { |
|
192 | + if (isset($config['masks']['attachment'])) { |
|
193 | + if (class_exists($config['masks']['attachment'])) { |
|
194 | 194 | $this->default_message_mask = $config['masks']['attachment']; |
195 | - }else{ |
|
195 | + } else { |
|
196 | 196 | throw new MaskNotFoundException("Unknown mask provided: ".$config['masks']['attachment']); |
197 | 197 | } |
198 | - }else{ |
|
199 | - if(class_exists($default_config['attachment'])) { |
|
198 | + } else { |
|
199 | + if (class_exists($default_config['attachment'])) { |
|
200 | 200 | $this->default_message_mask = $default_config['attachment']; |
201 | - }else{ |
|
201 | + } else { |
|
202 | 202 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['attachment']); |
203 | 203 | } |
204 | 204 | } |
205 | - }else{ |
|
206 | - if(class_exists($default_config['message'])) { |
|
205 | + } else { |
|
206 | + if (class_exists($default_config['message'])) { |
|
207 | 207 | $this->default_message_mask = $default_config['message']; |
208 | - }else{ |
|
208 | + } else { |
|
209 | 209 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['message']); |
210 | 210 | } |
211 | 211 | |
212 | - if(class_exists($default_config['attachment'])) { |
|
212 | + if (class_exists($default_config['attachment'])) { |
|
213 | 213 | $this->default_message_mask = $default_config['attachment']; |
214 | - }else{ |
|
214 | + } else { |
|
215 | 215 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['attachment']); |
216 | 216 | } |
217 | 217 | } |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | $pattern = $parent_folder.($hierarchical ? '%' : '*'); |
359 | 359 | |
360 | 360 | $items = imap_getmailboxes($this->connection, $this->getAddress(), $pattern); |
361 | - if(is_array($items)){ |
|
361 | + if (is_array($items)) { |
|
362 | 362 | foreach ($items as $item) { |
363 | 363 | $folder = new Folder($this, $item); |
364 | 364 | |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | } |
374 | 374 | |
375 | 375 | return $folders; |
376 | - }else{ |
|
376 | + } else { |
|
377 | 377 | throw new MailboxFetchingException($this->getLastError()); |
378 | 378 | } |
379 | 379 | } |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | public function openFolder($folder_path, $attempts = 3) { |
390 | 390 | $this->checkConnection(); |
391 | 391 | |
392 | - if(property_exists($folder_path, 'path')) { |
|
392 | + if (property_exists($folder_path, 'path')) { |
|
393 | 393 | $folder_path = $folder_path->path; |
394 | 394 | } |
395 | 395 | |
@@ -410,8 +410,8 @@ discard block |
||
410 | 410 | */ |
411 | 411 | public function createFolder($name, $expunge = true) { |
412 | 412 | $this->checkConnection(); |
413 | - $status = imap_createmailbox($this->getConnection(), $this->getAddress() . imap_utf7_encode($name)); |
|
414 | - if($expunge) $this->expunge(); |
|
413 | + $status = imap_createmailbox($this->getConnection(), $this->getAddress().imap_utf7_encode($name)); |
|
414 | + if ($expunge) $this->expunge(); |
|
415 | 415 | |
416 | 416 | return $status; |
417 | 417 | } |
@@ -427,8 +427,8 @@ discard block |
||
427 | 427 | */ |
428 | 428 | public function renameFolder($old_name, $new_name, $expunge = true) { |
429 | 429 | $this->checkConnection(); |
430 | - $status = imap_renamemailbox($this->getConnection(), $this->getAddress() . imap_utf7_encode($old_name), $this->getAddress() . imap_utf7_encode($new_name)); |
|
431 | - if($expunge) $this->expunge(); |
|
430 | + $status = imap_renamemailbox($this->getConnection(), $this->getAddress().imap_utf7_encode($old_name), $this->getAddress().imap_utf7_encode($new_name)); |
|
431 | + if ($expunge) $this->expunge(); |
|
432 | 432 | |
433 | 433 | return $status; |
434 | 434 | } |
@@ -443,8 +443,8 @@ discard block |
||
443 | 443 | */ |
444 | 444 | public function deleteFolder($name, $expunge = true) { |
445 | 445 | $this->checkConnection(); |
446 | - $status = imap_deletemailbox($this->getConnection(), $this->getAddress() . imap_utf7_encode($name)); |
|
447 | - if($expunge) $this->expunge(); |
|
446 | + $status = imap_deletemailbox($this->getConnection(), $this->getAddress().imap_utf7_encode($name)); |
|
447 | + if ($expunge) $this->expunge(); |
|
448 | 448 | |
449 | 449 | return $status; |
450 | 450 | } |
@@ -538,7 +538,7 @@ discard block |
||
538 | 538 | if (!$this->validate_cert) { |
539 | 539 | $address .= '/novalidate-cert'; |
540 | 540 | } |
541 | - if (in_array($this->encryption,['tls', 'notls', 'ssl'])) { |
|
541 | + if (in_array($this->encryption, ['tls', 'notls', 'ssl'])) { |
|
542 | 542 | $address .= '/'.$this->encryption; |
543 | 543 | } elseif ($this->encryption === "starttls") { |
544 | 544 | $address .= '/tls'; |
@@ -661,7 +661,7 @@ discard block |
||
661 | 661 | * @throws InvalidImapTimeoutTypeException |
662 | 662 | */ |
663 | 663 | public function setTimeout($type, $timeout) { |
664 | - if(0 <= $type && $type <= 4) { |
|
664 | + if (0 <= $type && $type <= 4) { |
|
665 | 665 | return imap_timeout($type, $timeout); |
666 | 666 | } |
667 | 667 | |
@@ -675,8 +675,8 @@ discard block |
||
675 | 675 | * @return mixed |
676 | 676 | * @throws InvalidImapTimeoutTypeException |
677 | 677 | */ |
678 | - public function getTimeout($type){ |
|
679 | - if(0 <= $type && $type <= 4) { |
|
678 | + public function getTimeout($type) { |
|
679 | + if (0 <= $type && $type <= 4) { |
|
680 | 680 | return imap_timeout($type); |
681 | 681 | } |
682 | 682 | |
@@ -686,7 +686,7 @@ discard block |
||
686 | 686 | /** |
687 | 687 | * @return string |
688 | 688 | */ |
689 | - public function getDefaultMessageMask(){ |
|
689 | + public function getDefaultMessageMask() { |
|
690 | 690 | return $this->default_message_mask; |
691 | 691 | } |
692 | 692 | |
@@ -697,7 +697,7 @@ discard block |
||
697 | 697 | * @throws MaskNotFoundException |
698 | 698 | */ |
699 | 699 | public function setDefaultMessageMask($mask) { |
700 | - if(class_exists($mask)) { |
|
700 | + if (class_exists($mask)) { |
|
701 | 701 | $this->default_message_mask = $mask; |
702 | 702 | |
703 | 703 | return $this; |
@@ -709,7 +709,7 @@ discard block |
||
709 | 709 | /** |
710 | 710 | * @return string |
711 | 711 | */ |
712 | - public function getDefaultAttachmentMask(){ |
|
712 | + public function getDefaultAttachmentMask() { |
|
713 | 713 | return $this->default_attachment_mask; |
714 | 714 | } |
715 | 715 | |
@@ -720,7 +720,7 @@ discard block |
||
720 | 720 | * @throws MaskNotFoundException |
721 | 721 | */ |
722 | 722 | public function setDefaultAttachmentMask($mask) { |
723 | - if(class_exists($mask)) { |
|
723 | + if (class_exists($mask)) { |
|
724 | 724 | $this->default_attachment_mask = $mask; |
725 | 725 | |
726 | 726 | return $this; |
@@ -734,7 +734,7 @@ discard block |
||
734 | 734 | * |
735 | 735 | * @return Folder |
736 | 736 | */ |
737 | - public function getFolderPath(){ |
|
737 | + public function getFolderPath() { |
|
738 | 738 | return $this->active_folder; |
739 | 739 | } |
740 | 740 | } |