@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | public function __construct($parent) { |
39 | 39 | $this->parent = $parent; |
40 | 40 | |
41 | - if(method_exists($this->parent, 'getAttributes')){ |
|
41 | + if (method_exists($this->parent, 'getAttributes')) { |
|
42 | 42 | $this->attributes = array_merge($this->attributes, $this->parent->getAttributes()); |
43 | 43 | } |
44 | 44 | |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | /** |
49 | 49 | * Boot method made to be used by any custom mask |
50 | 50 | */ |
51 | - protected function boot(){} |
|
51 | + protected function boot() {} |
|
52 | 52 | |
53 | 53 | /** |
54 | 54 | * Call dynamic attribute setter and getter methods and inherit the parent calls |
@@ -59,17 +59,17 @@ discard block |
||
59 | 59 | * @throws MethodNotFoundException |
60 | 60 | */ |
61 | 61 | public function __call($method, $arguments) { |
62 | - if(strtolower(substr($method, 0, 3)) === 'get') { |
|
62 | + if (strtolower(substr($method, 0, 3)) === 'get') { |
|
63 | 63 | $name = snake_case(substr($method, 3)); |
64 | 64 | |
65 | - if(isset($this->attributes[$name])) { |
|
65 | + if (isset($this->attributes[$name])) { |
|
66 | 66 | return $this->attributes[$name]; |
67 | 67 | } |
68 | 68 | |
69 | 69 | }elseif (strtolower(substr($method, 0, 3)) === 'set') { |
70 | 70 | $name = snake_case(substr($method, 3)); |
71 | 71 | |
72 | - if(isset($this->attributes[$name])) { |
|
72 | + if (isset($this->attributes[$name])) { |
|
73 | 73 | $this->attributes[$name] = array_pop($arguments); |
74 | 74 | |
75 | 75 | return $this->attributes[$name]; |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | |
78 | 78 | } |
79 | 79 | |
80 | - if(method_exists($this->parent, $method) === true){ |
|
80 | + if (method_exists($this->parent, $method) === true) { |
|
81 | 81 | return call_user_func_array([$this->parent, $method], $arguments); |
82 | 82 | } |
83 | 83 | |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | * @return mixed|null |
103 | 103 | */ |
104 | 104 | public function __get($name) { |
105 | - if(isset($this->attributes[$name])) { |
|
105 | + if (isset($this->attributes[$name])) { |
|
106 | 106 | return $this->attributes[$name]; |
107 | 107 | } |
108 | 108 | |
@@ -112,14 +112,14 @@ discard block |
||
112 | 112 | /** |
113 | 113 | * @return mixed |
114 | 114 | */ |
115 | - public function getParent(){ |
|
115 | + public function getParent() { |
|
116 | 116 | return $this->parent; |
117 | 117 | } |
118 | 118 | |
119 | 119 | /** |
120 | 120 | * @return array |
121 | 121 | */ |
122 | - public function getAttributes(){ |
|
122 | + public function getAttributes() { |
|
123 | 123 | return $this->attributes; |
124 | 124 | } |
125 | 125 |
@@ -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 | } |
@@ -406,8 +406,8 @@ discard block |
||
406 | 406 | */ |
407 | 407 | public function createFolder($name, $expunge = true) { |
408 | 408 | $this->checkConnection(); |
409 | - $status = imap_createmailbox($this->getConnection(), $this->getAddress() . imap_utf7_encode($name)); |
|
410 | - if($expunge) $this->expunge(); |
|
409 | + $status = imap_createmailbox($this->getConnection(), $this->getAddress().imap_utf7_encode($name)); |
|
410 | + if ($expunge) $this->expunge(); |
|
411 | 411 | |
412 | 412 | return $status; |
413 | 413 | } |
@@ -423,8 +423,8 @@ discard block |
||
423 | 423 | */ |
424 | 424 | public function renameFolder($old_name, $new_name, $expunge = true) { |
425 | 425 | $this->checkConnection(); |
426 | - $status = imap_renamemailbox($this->getConnection(), $this->getAddress() . imap_utf7_encode($old_name), $this->getAddress() . imap_utf7_encode($new_name)); |
|
427 | - if($expunge) $this->expunge(); |
|
426 | + $status = imap_renamemailbox($this->getConnection(), $this->getAddress().imap_utf7_encode($old_name), $this->getAddress().imap_utf7_encode($new_name)); |
|
427 | + if ($expunge) $this->expunge(); |
|
428 | 428 | |
429 | 429 | return $status; |
430 | 430 | } |
@@ -439,8 +439,8 @@ discard block |
||
439 | 439 | */ |
440 | 440 | public function deleteFolder($name, $expunge = true) { |
441 | 441 | $this->checkConnection(); |
442 | - $status = imap_deletemailbox($this->getConnection(), $this->getAddress() . imap_utf7_encode($name)); |
|
443 | - if($expunge) $this->expunge(); |
|
442 | + $status = imap_deletemailbox($this->getConnection(), $this->getAddress().imap_utf7_encode($name)); |
|
443 | + if ($expunge) $this->expunge(); |
|
444 | 444 | |
445 | 445 | return $status; |
446 | 446 | } |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | if (!$this->validate_cert) { |
535 | 535 | $address .= '/novalidate-cert'; |
536 | 536 | } |
537 | - if (in_array($this->encryption,['tls','ssl'])) { |
|
537 | + if (in_array($this->encryption, ['tls', 'ssl'])) { |
|
538 | 538 | $address .= '/'.$this->encryption; |
539 | 539 | } |
540 | 540 | |
@@ -655,7 +655,7 @@ discard block |
||
655 | 655 | * @throws InvalidImapTimeoutTypeException |
656 | 656 | */ |
657 | 657 | public function setTimeout($type, $timeout) { |
658 | - if(0 <= $type && $type <= 4) { |
|
658 | + if (0 <= $type && $type <= 4) { |
|
659 | 659 | return imap_timeout($type, $timeout); |
660 | 660 | } |
661 | 661 | |
@@ -669,8 +669,8 @@ discard block |
||
669 | 669 | * @return mixed |
670 | 670 | * @throws InvalidImapTimeoutTypeException |
671 | 671 | */ |
672 | - public function getTimeout($type){ |
|
673 | - if(0 <= $type && $type <= 4) { |
|
672 | + public function getTimeout($type) { |
|
673 | + if (0 <= $type && $type <= 4) { |
|
674 | 674 | return imap_timeout($type); |
675 | 675 | } |
676 | 676 | |
@@ -680,7 +680,7 @@ discard block |
||
680 | 680 | /** |
681 | 681 | * @return string |
682 | 682 | */ |
683 | - public function getDefaultMessageMask(){ |
|
683 | + public function getDefaultMessageMask() { |
|
684 | 684 | return $this->default_message_mask; |
685 | 685 | } |
686 | 686 | |
@@ -691,7 +691,7 @@ discard block |
||
691 | 691 | * @throws MaskNotFoundException |
692 | 692 | */ |
693 | 693 | public function setDefaultMessageMask($mask) { |
694 | - if(class_exists($mask)) { |
|
694 | + if (class_exists($mask)) { |
|
695 | 695 | $this->default_message_mask = $mask; |
696 | 696 | |
697 | 697 | return $this; |
@@ -703,7 +703,7 @@ discard block |
||
703 | 703 | /** |
704 | 704 | * @return string |
705 | 705 | */ |
706 | - public function getDefaultAttachmentMask(){ |
|
706 | + public function getDefaultAttachmentMask() { |
|
707 | 707 | return $this->default_attachment_mask; |
708 | 708 | } |
709 | 709 | |
@@ -714,7 +714,7 @@ discard block |
||
714 | 714 | * @throws MaskNotFoundException |
715 | 715 | */ |
716 | 716 | public function setDefaultAttachmentMask($mask) { |
717 | - if(class_exists($mask)) { |
|
717 | + if (class_exists($mask)) { |
|
718 | 718 | $this->default_attachment_mask = $mask; |
719 | 719 | |
720 | 720 | return $this; |