@@ -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 | } |
544 | 544 | |
@@ -659,7 +659,7 @@ discard block |
||
659 | 659 | * @throws InvalidImapTimeoutTypeException |
660 | 660 | */ |
661 | 661 | public function setTimeout($type, $timeout) { |
662 | - if(0 <= $type && $type <= 4) { |
|
662 | + if (0 <= $type && $type <= 4) { |
|
663 | 663 | return imap_timeout($type, $timeout); |
664 | 664 | } |
665 | 665 | |
@@ -673,8 +673,8 @@ discard block |
||
673 | 673 | * @return mixed |
674 | 674 | * @throws InvalidImapTimeoutTypeException |
675 | 675 | */ |
676 | - public function getTimeout($type){ |
|
677 | - if(0 <= $type && $type <= 4) { |
|
676 | + public function getTimeout($type) { |
|
677 | + if (0 <= $type && $type <= 4) { |
|
678 | 678 | return imap_timeout($type); |
679 | 679 | } |
680 | 680 | |
@@ -684,7 +684,7 @@ discard block |
||
684 | 684 | /** |
685 | 685 | * @return string |
686 | 686 | */ |
687 | - public function getDefaultMessageMask(){ |
|
687 | + public function getDefaultMessageMask() { |
|
688 | 688 | return $this->default_message_mask; |
689 | 689 | } |
690 | 690 | |
@@ -695,7 +695,7 @@ discard block |
||
695 | 695 | * @throws MaskNotFoundException |
696 | 696 | */ |
697 | 697 | public function setDefaultMessageMask($mask) { |
698 | - if(class_exists($mask)) { |
|
698 | + if (class_exists($mask)) { |
|
699 | 699 | $this->default_message_mask = $mask; |
700 | 700 | |
701 | 701 | return $this; |
@@ -707,7 +707,7 @@ discard block |
||
707 | 707 | /** |
708 | 708 | * @return string |
709 | 709 | */ |
710 | - public function getDefaultAttachmentMask(){ |
|
710 | + public function getDefaultAttachmentMask() { |
|
711 | 711 | return $this->default_attachment_mask; |
712 | 712 | } |
713 | 713 | |
@@ -718,7 +718,7 @@ discard block |
||
718 | 718 | * @throws MaskNotFoundException |
719 | 719 | */ |
720 | 720 | public function setDefaultAttachmentMask($mask) { |
721 | - if(class_exists($mask)) { |
|
721 | + if (class_exists($mask)) { |
|
722 | 722 | $this->default_attachment_mask = $mask; |
723 | 723 | |
724 | 724 | return $this; |
@@ -732,7 +732,7 @@ discard block |
||
732 | 732 | * |
733 | 733 | * @return Folder |
734 | 734 | */ |
735 | - public function getFolderPath(){ |
|
735 | + public function getFolderPath() { |
|
736 | 736 | return $this->active_folder; |
737 | 737 | } |
738 | 738 | } |