@@ -77,17 +77,17 @@ discard block |
||
77 | 77 | foreach($criteria as $arguments){ |
78 | 78 | if(count($arguments) == 1){ |
79 | 79 | $this->where($arguments[0]); |
80 | - }elseif(count($arguments) == 2){ |
|
80 | + } elseif(count($arguments) == 2){ |
|
81 | 81 | $this->where($arguments[0], $arguments[1]); |
82 | 82 | } |
83 | 83 | } |
84 | - }else{ |
|
84 | + } else{ |
|
85 | 85 | $criteria = $this->validate_criteria($criteria); |
86 | 86 | $value = $this->parse_value($value); |
87 | 87 | |
88 | 88 | if($value === null || $value === ''){ |
89 | 89 | $this->query->push([$criteria]); |
90 | - }else{ |
|
90 | + } else{ |
|
91 | 91 | $this->query->push([$criteria, $value]); |
92 | 92 | } |
93 | 93 | } |
@@ -102,7 +102,9 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public function orWhere(\Closure $closure = null) { |
104 | 104 | $this->query->push(['OR']); |
105 | - if($closure !== null) $closure($this); |
|
105 | + if($closure !== null) { |
|
106 | + $closure($this); |
|
107 | + } |
|
106 | 108 | |
107 | 109 | return $this; |
108 | 110 | } |
@@ -114,7 +116,9 @@ discard block |
||
114 | 116 | */ |
115 | 117 | public function andWhere(\Closure $closure = null) { |
116 | 118 | $this->query->push(['AND']); |
117 | - if($closure !== null) $closure($this); |
|
119 | + if($closure !== null) { |
|
120 | + $closure($this); |
|
121 | + } |
|
118 | 122 | |
119 | 123 | return $this; |
120 | 124 | } |
@@ -76,13 +76,13 @@ 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 | 84 | $method = 'where'.ucfirst($name); |
85 | - if(method_exists($this, $method) === true){ |
|
85 | + if (method_exists($this, $method) === true) { |
|
86 | 86 | return call_user_func_array([$that, $method], $arguments); |
87 | 87 | } |
88 | 88 | |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | protected function validate_criteria($criteria) { |
100 | 100 | $criteria = strtoupper($criteria); |
101 | 101 | |
102 | - if(in_array($criteria, $this->available_criteria) === false) { |
|
102 | + if (in_array($criteria, $this->available_criteria) === false) { |
|
103 | 103 | throw new InvalidWhereQueryCriteriaException(); |
104 | 104 | } |
105 | 105 | |
@@ -114,21 +114,21 @@ discard block |
||
114 | 114 | * @throws InvalidWhereQueryCriteriaException |
115 | 115 | */ |
116 | 116 | public function where($criteria, $value = null) { |
117 | - if(is_array($criteria)){ |
|
118 | - foreach($criteria as $arguments){ |
|
119 | - if(count($arguments) == 1){ |
|
117 | + if (is_array($criteria)) { |
|
118 | + foreach ($criteria as $arguments) { |
|
119 | + if (count($arguments) == 1) { |
|
120 | 120 | $this->where($arguments[0]); |
121 | - }elseif(count($arguments) == 2){ |
|
121 | + }elseif (count($arguments) == 2) { |
|
122 | 122 | $this->where($arguments[0], $arguments[1]); |
123 | 123 | } |
124 | 124 | } |
125 | - }else{ |
|
125 | + } else { |
|
126 | 126 | $criteria = $this->validate_criteria($criteria); |
127 | 127 | $value = $this->parse_value($value); |
128 | 128 | |
129 | - if($value === null || $value === ''){ |
|
129 | + if ($value === null || $value === '') { |
|
130 | 130 | $this->query->push([$criteria]); |
131 | - }else{ |
|
131 | + } else { |
|
132 | 132 | $this->query->push([$criteria, $value]); |
133 | 133 | } |
134 | 134 | } |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | */ |
144 | 144 | public function orWhere(\Closure $closure = null) { |
145 | 145 | $this->query->push(['OR']); |
146 | - if($closure !== null) $closure($this); |
|
146 | + if ($closure !== null) $closure($this); |
|
147 | 147 | |
148 | 148 | return $this; |
149 | 149 | } |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | */ |
156 | 156 | public function andWhere(\Closure $closure = null) { |
157 | 157 | $this->query->push(['AND']); |
158 | - if($closure !== null) $closure($this); |
|
158 | + if ($closure !== null) $closure($this); |
|
159 | 159 | |
160 | 160 | return $this; |
161 | 161 | } |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | * @return WhereQuery |
406 | 406 | * @throws InvalidWhereQueryCriteriaException |
407 | 407 | */ |
408 | - public function whereNoXSpam(){ |
|
408 | + public function whereNoXSpam() { |
|
409 | 409 | return $this->where("X-Spam-Flag NO"); |
410 | 410 | } |
411 | 411 | |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | * @return WhereQuery |
414 | 414 | * @throws InvalidWhereQueryCriteriaException |
415 | 415 | */ |
416 | - public function whereIsXSpam(){ |
|
416 | + public function whereIsXSpam() { |
|
417 | 417 | return $this->where("X-Spam-Flag YES"); |
418 | 418 | } |
419 | 419 | |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | * @return WhereQuery |
424 | 424 | * @throws InvalidWhereQueryCriteriaException |
425 | 425 | */ |
426 | - public function whereLanguage($country_code){ |
|
426 | + public function whereLanguage($country_code) { |
|
427 | 427 | return $this->where("Content-Language $country_code"); |
428 | 428 | } |
429 | 429 | } |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | * If however the default account is missing a parameter the package default account parameter will be used. |
59 | 59 | * This can be disabled by setting imap.default in your config file to 'false' |
60 | 60 | */ |
61 | - private function setVendorConfig(){ |
|
61 | + private function setVendorConfig() { |
|
62 | 62 | |
63 | 63 | $config_key = 'imap'; |
64 | 64 | $path = __DIR__.'/../../config/'.$config_key.'.php'; |
@@ -70,17 +70,17 @@ discard block |
||
70 | 70 | |
71 | 71 | $config = $this->app['config']->get($config_key); |
72 | 72 | |
73 | - if(is_array($config)){ |
|
74 | - if(isset($config['default'])){ |
|
75 | - if(isset($config['accounts']) && $config['default'] != false){ |
|
73 | + if (is_array($config)) { |
|
74 | + if (isset($config['default'])) { |
|
75 | + if (isset($config['accounts']) && $config['default'] != false) { |
|
76 | 76 | |
77 | 77 | $default_config = $vendor_config['accounts']['default']; |
78 | - if(isset($config['accounts'][$config['default']])){ |
|
78 | + if (isset($config['accounts'][$config['default']])) { |
|
79 | 79 | $default_config = array_merge($default_config, $config['accounts'][$config['default']]); |
80 | 80 | } |
81 | 81 | |
82 | - if(is_array($config['accounts'])){ |
|
83 | - foreach($config['accounts'] as $account_key => $account){ |
|
82 | + if (is_array($config['accounts'])) { |
|
83 | + foreach ($config['accounts'] as $account_key => $account) { |
|
84 | 84 | $config['accounts'][$account_key] = array_merge($default_config, $account); |
85 | 85 | } |
86 | 86 | } |
@@ -114,23 +114,23 @@ discard block |
||
114 | 114 | $arrays = func_get_args(); |
115 | 115 | $base = array_shift($arrays); |
116 | 116 | |
117 | - if(!is_array($base)) $base = empty($base) ? array() : array($base); |
|
117 | + if (!is_array($base)) $base = empty($base) ? array() : array($base); |
|
118 | 118 | |
119 | - foreach($arrays as $append) { |
|
119 | + foreach ($arrays as $append) { |
|
120 | 120 | |
121 | - if(!is_array($append)) $append = array($append); |
|
121 | + if (!is_array($append)) $append = array($append); |
|
122 | 122 | |
123 | - foreach($append as $key => $value) { |
|
123 | + foreach ($append as $key => $value) { |
|
124 | 124 | |
125 | - if(!array_key_exists($key, $base) and !is_numeric($key)) { |
|
125 | + if (!array_key_exists($key, $base) and !is_numeric($key)) { |
|
126 | 126 | $base[$key] = $append[$key]; |
127 | 127 | continue; |
128 | 128 | } |
129 | 129 | |
130 | - if(is_array($value) or is_array($base[$key])) { |
|
130 | + if (is_array($value) or is_array($base[$key])) { |
|
131 | 131 | $base[$key] = $this->array_merge_recursive_distinct($base[$key], $append[$key]); |
132 | - } else if(is_numeric($key)) { |
|
133 | - if(!in_array($value, $base)) $base[] = $value; |
|
132 | + } else if (is_numeric($key)) { |
|
133 | + if (!in_array($value, $base)) $base[] = $value; |
|
134 | 134 | } else { |
135 | 135 | $base[$key] = $value; |
136 | 136 | } |
@@ -114,11 +114,15 @@ discard block |
||
114 | 114 | $arrays = func_get_args(); |
115 | 115 | $base = array_shift($arrays); |
116 | 116 | |
117 | - if(!is_array($base)) $base = empty($base) ? array() : array($base); |
|
117 | + if(!is_array($base)) { |
|
118 | + $base = empty($base) ? array() : array($base); |
|
119 | + } |
|
118 | 120 | |
119 | 121 | foreach($arrays as $append) { |
120 | 122 | |
121 | - if(!is_array($append)) $append = array($append); |
|
123 | + if(!is_array($append)) { |
|
124 | + $append = array($append); |
|
125 | + } |
|
122 | 126 | |
123 | 127 | foreach($append as $key => $value) { |
124 | 128 | |
@@ -130,7 +134,9 @@ discard block |
||
130 | 134 | if(is_array($value) or is_array($base[$key])) { |
131 | 135 | $base[$key] = $this->array_merge_recursive_distinct($base[$key], $append[$key]); |
132 | 136 | } else if(is_numeric($key)) { |
133 | - if(!in_array($value, $base)) $base[] = $value; |
|
137 | + if(!in_array($value, $base)) { |
|
138 | + $base[] = $value; |
|
139 | + } |
|
134 | 140 | } else { |
135 | 141 | $base[$key] = $value; |
136 | 142 | } |
@@ -355,14 +355,14 @@ |
||
355 | 355 | return $status; |
356 | 356 | } |
357 | 357 | |
358 | - /** |
|
359 | - * Delete Folder |
|
360 | - * @param string $name |
|
361 | - * @param boolean $expunge |
|
362 | - * |
|
363 | - * @return bool |
|
364 | - * @throws ConnectionFailedException |
|
365 | - */ |
|
358 | + /** |
|
359 | + * Delete Folder |
|
360 | + * @param string $name |
|
361 | + * @param boolean $expunge |
|
362 | + * |
|
363 | + * @return bool |
|
364 | + * @throws ConnectionFailedException |
|
365 | + */ |
|
366 | 366 | public function deleteFolder($name, $expunge = true) { |
367 | 367 | $this->checkConnection(); |
368 | 368 | $status = imap_deletemailbox($this->getConnection(), $this->getAddress() . imap_utf7_encode($name)); |
@@ -179,39 +179,39 @@ discard block |
||
179 | 179 | if(isset($config['masks']['message'])) { |
180 | 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{ |
|
185 | + } else{ |
|
186 | 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 | 192 | if(isset($config['masks']['attachment'])) { |
193 | 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{ |
|
198 | + } else{ |
|
199 | 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{ |
|
205 | + } else{ |
|
206 | 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 | 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 | } |
@@ -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 | } |
@@ -407,7 +407,9 @@ discard block |
||
407 | 407 | public function createFolder($name, $expunge = true) { |
408 | 408 | $this->checkConnection(); |
409 | 409 | $status = imap_createmailbox($this->getConnection(), $this->getAddress() . imap_utf7_encode($name)); |
410 | - if($expunge) $this->expunge(); |
|
410 | + if($expunge) { |
|
411 | + $this->expunge(); |
|
412 | + } |
|
411 | 413 | |
412 | 414 | return $status; |
413 | 415 | } |
@@ -424,7 +426,9 @@ discard block |
||
424 | 426 | public function renameFolder($old_name, $new_name, $expunge = true) { |
425 | 427 | $this->checkConnection(); |
426 | 428 | $status = imap_renamemailbox($this->getConnection(), $this->getAddress() . imap_utf7_encode($old_name), $this->getAddress() . imap_utf7_encode($new_name)); |
427 | - if($expunge) $this->expunge(); |
|
429 | + if($expunge) { |
|
430 | + $this->expunge(); |
|
431 | + } |
|
428 | 432 | |
429 | 433 | return $status; |
430 | 434 | } |
@@ -440,7 +444,9 @@ discard block |
||
440 | 444 | public function deleteFolder($name, $expunge = true) { |
441 | 445 | $this->checkConnection(); |
442 | 446 | $status = imap_deletemailbox($this->getConnection(), $this->getAddress() . imap_utf7_encode($name)); |
443 | - if($expunge) $this->expunge(); |
|
447 | + if($expunge) { |
|
448 | + $this->expunge(); |
|
449 | + } |
|
444 | 450 | |
445 | 451 | return $status; |
446 | 452 | } |
@@ -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 | } |
@@ -370,7 +370,9 @@ discard block |
||
370 | 370 | */ |
371 | 371 | public function delete($expunge = true) { |
372 | 372 | $status = imap_deletemailbox($this->client->getConnection(), $this->path); |
373 | - if($expunge) $this->client->expunge(); |
|
373 | + if($expunge) { |
|
374 | + $this->client->expunge(); |
|
375 | + } |
|
374 | 376 | |
375 | 377 | return $status; |
376 | 378 | } |
@@ -387,7 +389,9 @@ discard block |
||
387 | 389 | */ |
388 | 390 | public function move($target_mailbox, $expunge = true) { |
389 | 391 | $status = imap_renamemailbox($this->client->getConnection(), $this->path, $target_mailbox); |
390 | - if($expunge) $this->client->expunge(); |
|
392 | + if($expunge) { |
|
393 | + $this->client->expunge(); |
|
394 | + } |
|
391 | 395 | |
392 | 396 | return $status; |
393 | 397 | } |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | |
119 | 119 | $this->setDelimiter($structure->delimiter); |
120 | 120 | $this->path = $structure->name; |
121 | - $this->full_name = $this->decodeName($structure->name); |
|
121 | + $this->full_name = $this->decodeName($structure->name); |
|
122 | 122 | $this->name = $this->getSimpleName($this->delimiter, $this->full_name); |
123 | 123 | |
124 | 124 | $this->parseAttributes($structure->attributes); |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | * @return WhereQuery |
132 | 132 | * @throws Exceptions\ConnectionFailedException |
133 | 133 | */ |
134 | - public function query($charset = 'UTF-8'){ |
|
134 | + public function query($charset = 'UTF-8') { |
|
135 | 135 | $this->getClient()->checkConnection(); |
136 | 136 | $this->getClient()->openFolder($this->path); |
137 | 137 | |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | * @inheritdoc self::query($charset = 'UTF-8') |
143 | 143 | * @throws Exceptions\ConnectionFailedException |
144 | 144 | */ |
145 | - public function search($charset = 'UTF-8'){ |
|
145 | + public function search($charset = 'UTF-8') { |
|
146 | 146 | return $this->query($charset); |
147 | 147 | } |
148 | 148 | |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | * @inheritdoc self::query($charset = 'UTF-8') |
151 | 151 | * @throws Exceptions\ConnectionFailedException |
152 | 152 | */ |
153 | - public function messages($charset = 'UTF-8'){ |
|
153 | + public function messages($charset = 'UTF-8') { |
|
154 | 154 | return $this->query($charset); |
155 | 155 | } |
156 | 156 | |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | * @deprecated 1.2.1:2.0.0 No longer needed. Use Folder::query() instead |
316 | 316 | * @see Folder::query() |
317 | 317 | */ |
318 | - public function searchMessages(array $where, $fetch_options = null, $fetch_body = true, $fetch_attachment = true, $fetch_flags = true, $limit = null, $page = 1, $charset = "UTF-8") { |
|
318 | + public function searchMessages(array $where, $fetch_options = null, $fetch_body = true, $fetch_attachment = true, $fetch_flags = true, $limit = null, $page = 1, $charset = "UTF-8") { |
|
319 | 319 | $this->getClient()->checkConnection(); |
320 | 320 | |
321 | 321 | return $this->query($charset)->where($where)->setFetchOptions($fetch_options)->setFetchBody($fetch_body) |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | */ |
375 | 375 | public function delete($expunge = true) { |
376 | 376 | $status = imap_deletemailbox($this->client->getConnection(), $this->path); |
377 | - if($expunge) $this->client->expunge(); |
|
377 | + if ($expunge) $this->client->expunge(); |
|
378 | 378 | |
379 | 379 | return $status; |
380 | 380 | } |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | */ |
392 | 392 | public function move($target_mailbox, $expunge = true) { |
393 | 393 | $status = imap_renamemailbox($this->client->getConnection(), $this->path, $target_mailbox); |
394 | - if($expunge) $this->client->expunge(); |
|
394 | + if ($expunge) $this->client->expunge(); |
|
395 | 395 | |
396 | 396 | return $status; |
397 | 397 | } |
@@ -440,8 +440,8 @@ discard block |
||
440 | 440 | /** |
441 | 441 | * @param $delimiter |
442 | 442 | */ |
443 | - public function setDelimiter($delimiter){ |
|
444 | - if(in_array($delimiter, [null, '', ' ', false]) === true) { |
|
443 | + public function setDelimiter($delimiter) { |
|
444 | + if (in_array($delimiter, [null, '', ' ', false]) === true) { |
|
445 | 445 | $delimiter = config('imap.options.delimiter', '/'); |
446 | 446 | } |
447 | 447 |
@@ -45,7 +45,9 @@ discard block |
||
45 | 45 | */ |
46 | 46 | public function getCustomHTMLBody($callback = false) { |
47 | 47 | $body = $this->getHtmlBody(); |
48 | - if($body === null) return null; |
|
48 | + if($body === null) { |
|
49 | + return null; |
|
50 | + } |
|
49 | 51 | |
50 | 52 | if ($callback !== false) { |
51 | 53 | $aAttachment = $this->parent->getAttachments(); |
@@ -53,7 +55,7 @@ discard block |
||
53 | 55 | /** @var Attachment $oAttachment */ |
54 | 56 | if(is_callable($callback)) { |
55 | 57 | $body = $callback($body, $oAttachment); |
56 | - }elseif(is_string($callback)) { |
|
58 | + } elseif(is_string($callback)) { |
|
57 | 59 | call_user_func($callback, [$body, $oAttachment]); |
58 | 60 | } |
59 | 61 | }); |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * Get the message html body |
30 | 30 | * @return null |
31 | 31 | */ |
32 | - public function getHtmlBody(){ |
|
32 | + public function getHtmlBody() { |
|
33 | 33 | $bodies = $this->parent->getBodies(); |
34 | 34 | if (!isset($bodies['html'])) { |
35 | 35 | return null; |
@@ -46,15 +46,15 @@ discard block |
||
46 | 46 | */ |
47 | 47 | public function getCustomHTMLBody($callback = false) { |
48 | 48 | $body = $this->getHtmlBody(); |
49 | - if($body === null) return null; |
|
49 | + if ($body === null) return null; |
|
50 | 50 | |
51 | 51 | if ($callback !== false) { |
52 | 52 | $aAttachment = $this->parent->getAttachments(); |
53 | 53 | $aAttachment->each(function($oAttachment) use(&$body, $callback) { |
54 | 54 | /** @var Attachment $oAttachment */ |
55 | - if(is_callable($callback)) { |
|
55 | + if (is_callable($callback)) { |
|
56 | 56 | $body = $callback($body, $oAttachment); |
57 | - }elseif(is_string($callback)) { |
|
57 | + }elseif (is_string($callback)) { |
|
58 | 58 | call_user_func($callback, [$body, $oAttachment]); |
59 | 59 | } |
60 | 60 | }); |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @return string|null |
71 | 71 | */ |
72 | 72 | public function getHTMLBodyWithEmbeddedBase64Images() { |
73 | - return $this->getCustomHTMLBody(function($body, $oAttachment){ |
|
73 | + return $this->getCustomHTMLBody(function($body, $oAttachment) { |
|
74 | 74 | /** @var \Webklex\IMAP\Attachment $oAttachment */ |
75 | 75 | if ($oAttachment->id && $oAttachment->getImgSrc() != null) { |
76 | 76 | $body = str_replace('cid:'.$oAttachment->id, $oAttachment->getImgSrc(), $body); |
@@ -16,7 +16,7 @@ |
||
16 | 16 | * New custom method which can be called through a mask |
17 | 17 | * @return string |
18 | 18 | */ |
19 | - public function token(){ |
|
19 | + public function token() { |
|
20 | 20 | return implode('-', [$this->message_id, $this->uid, $this->message_no]); |
21 | 21 | } |
22 | 22 |
@@ -16,7 +16,7 @@ |
||
16 | 16 | * New custom method which can be called through a mask |
17 | 17 | * @return string |
18 | 18 | */ |
19 | - public function token(){ |
|
19 | + public function token() { |
|
20 | 20 | return implode('-', [$this->id, $this->getMessage()->getUid(), $this->name]); |
21 | 21 | } |
22 | 22 |
@@ -20,7 +20,7 @@ |
||
20 | 20 | /** @var \Webklex\IMAP\Message $message */ |
21 | 21 | $message = $folder->query()->limit(1)->get()->first(); |
22 | 22 | |
23 | -$html = $message->getHTMLBody(function($body, $oAttachment){ |
|
23 | +$html = $message->getHTMLBody(function($body, $oAttachment) { |
|
24 | 24 | /** @var \Webklex\IMAP\Attachment $oAttachment */ |
25 | 25 | if ($oAttachment->id && $oAttachment->getImgSrc() != null) { |
26 | 26 | $oMessage = $oAttachment->getMessage(); |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | public function __construct(Client $client, $charset = 'UTF-8') { |
69 | 69 | $this->setClient($client); |
70 | 70 | |
71 | - if(config('imap.options.fetch') === IMAP::FT_PEEK) $this->leaveUnread(); |
|
71 | + if (config('imap.options.fetch') === IMAP::FT_PEEK) $this->leaveUnread(); |
|
72 | 72 | |
73 | 73 | $this->date_format = config('imap.date_format', 'd M y'); |
74 | 74 | |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | /** |
81 | 81 | * Instance boot method for additional functionality |
82 | 82 | */ |
83 | - protected function boot(){} |
|
83 | + protected function boot() {} |
|
84 | 84 | |
85 | 85 | /** |
86 | 86 | * Parse a given value |
@@ -88,8 +88,8 @@ discard block |
||
88 | 88 | * |
89 | 89 | * @return string |
90 | 90 | */ |
91 | - protected function parse_value($value){ |
|
92 | - switch(true){ |
|
91 | + protected function parse_value($value) { |
|
92 | + switch (true) { |
|
93 | 93 | case $value instanceof \Carbon\Carbon: |
94 | 94 | $value = $value->format($this->date_format); |
95 | 95 | break; |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | * @throws MessageSearchValidationException |
107 | 107 | */ |
108 | 108 | protected function parse_date($date) { |
109 | - if($date instanceof \Carbon\Carbon) return $date; |
|
109 | + if ($date instanceof \Carbon\Carbon) return $date; |
|
110 | 110 | |
111 | 111 | try { |
112 | 112 | $date = Carbon::parse($date); |
@@ -145,16 +145,16 @@ discard block |
||
145 | 145 | * @return \Illuminate\Support\Collection |
146 | 146 | * @throws \Webklex\IMAP\Exceptions\ConnectionFailedException |
147 | 147 | */ |
148 | - protected function search(){ |
|
148 | + protected function search() { |
|
149 | 149 | $this->generate_query(); |
150 | 150 | |
151 | 151 | /** |
152 | 152 | * Don't set the charset if it isn't used - prevent strange outlook mail server errors |
153 | 153 | * @see https://github.com/Webklex/laravel-imap/issues/100 |
154 | 154 | */ |
155 | - if($this->getCharset() === null){ |
|
155 | + if ($this->getCharset() === null) { |
|
156 | 156 | $available_messages = imap_search($this->getClient()->getConnection(), $this->getRawQuery(), IMAP::SE_UID); |
157 | - }else{ |
|
157 | + } else { |
|
158 | 158 | $available_messages = imap_search($this->getClient()->getConnection(), $this->getRawQuery(), IMAP::SE_UID, $this->getCharset()); |
159 | 159 | } |
160 | 160 | |
@@ -184,15 +184,15 @@ discard block |
||
184 | 184 | |
185 | 185 | $options = config('imap.options'); |
186 | 186 | |
187 | - if(strtolower($options['fetch_order']) === 'desc'){ |
|
187 | + if (strtolower($options['fetch_order']) === 'desc') { |
|
188 | 188 | $available_messages = $available_messages->reverse(); |
189 | 189 | } |
190 | 190 | |
191 | - $query =& $this; |
|
191 | + $query = & $this; |
|
192 | 192 | |
193 | 193 | $available_messages->forPage($this->page, $this->limit)->each(function($msgno, $msglist) use(&$messages, $options, $query) { |
194 | 194 | $oMessage = new Message($msgno, $msglist, $query->getClient(), $query->getFetchOptions(), $query->getFetchBody(), $query->getFetchAttachment(), $query->getFetchFlags()); |
195 | - switch ($options['message_key']){ |
|
195 | + switch ($options['message_key']) { |
|
196 | 196 | case 'number': |
197 | 197 | $message_key = $oMessage->getMessageNo(); |
198 | 198 | break; |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | * @return \Illuminate\Pagination\LengthAwarePaginator |
224 | 224 | * @throws GetMessagesFailedException |
225 | 225 | */ |
226 | - public function paginate($per_page = 5, $page = null, $page_name = 'imap_page'){ |
|
226 | + public function paginate($per_page = 5, $page = null, $page_name = 'imap_page') { |
|
227 | 227 | $this->page = $page > $this->page ? $page : $this->page; |
228 | 228 | $this->limit = $per_page; |
229 | 229 | |
@@ -241,9 +241,9 @@ discard block |
||
241 | 241 | if (count($statement) == 1) { |
242 | 242 | $query .= $statement[0]; |
243 | 243 | } else { |
244 | - if($statement[1] === null){ |
|
244 | + if ($statement[1] === null) { |
|
245 | 245 | $query .= $statement[0]; |
246 | - }else{ |
|
246 | + } else { |
|
247 | 247 | $query .= $statement[0].' "'.$statement[1].'"'; |
248 | 248 | } |
249 | 249 | } |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | * @return $this |
274 | 274 | */ |
275 | 275 | public function limit($limit, $page = 1) { |
276 | - if($page >= 1) $this->page = $page; |
|
276 | + if ($page >= 1) $this->page = $page; |
|
277 | 277 | $this->limit = $limit; |
278 | 278 | |
279 | 279 | return $this; |
@@ -68,7 +68,9 @@ discard block |
||
68 | 68 | public function __construct(Client $client, $charset = 'UTF-8') { |
69 | 69 | $this->setClient($client); |
70 | 70 | |
71 | - if(config('imap.options.fetch') === IMAP::FT_PEEK) $this->leaveUnread(); |
|
71 | + if(config('imap.options.fetch') === IMAP::FT_PEEK) { |
|
72 | + $this->leaveUnread(); |
|
73 | + } |
|
72 | 74 | |
73 | 75 | $this->date_format = config('imap.date_format', 'd M y'); |
74 | 76 | |
@@ -106,7 +108,9 @@ discard block |
||
106 | 108 | * @throws MessageSearchValidationException |
107 | 109 | */ |
108 | 110 | protected function parse_date($date) { |
109 | - if($date instanceof \Carbon\Carbon) return $date; |
|
111 | + if($date instanceof \Carbon\Carbon) { |
|
112 | + return $date; |
|
113 | + } |
|
110 | 114 | |
111 | 115 | try { |
112 | 116 | $date = Carbon::parse($date); |
@@ -154,7 +158,7 @@ discard block |
||
154 | 158 | */ |
155 | 159 | if($this->getCharset() === null){ |
156 | 160 | $available_messages = imap_search($this->getClient()->getConnection(), $this->getRawQuery(), IMAP::SE_UID); |
157 | - }else{ |
|
161 | + } else{ |
|
158 | 162 | $available_messages = imap_search($this->getClient()->getConnection(), $this->getRawQuery(), IMAP::SE_UID, $this->getCharset()); |
159 | 163 | } |
160 | 164 | |
@@ -243,7 +247,7 @@ discard block |
||
243 | 247 | } else { |
244 | 248 | if($statement[1] === null){ |
245 | 249 | $query .= $statement[0]; |
246 | - }else{ |
|
250 | + } else{ |
|
247 | 251 | $query .= $statement[0].' "'.$statement[1].'"'; |
248 | 252 | } |
249 | 253 | } |
@@ -273,7 +277,9 @@ discard block |
||
273 | 277 | * @return $this |
274 | 278 | */ |
275 | 279 | public function limit($limit, $page = 1) { |
276 | - if($page >= 1) $this->page = $page; |
|
280 | + if($page >= 1) { |
|
281 | + $this->page = $page; |
|
282 | + } |
|
277 | 283 | $this->limit = $limit; |
278 | 284 | |
279 | 285 | return $this; |