@@ -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 | } |
@@ -64,7 +64,9 @@ discard block |
||
64 | 64 | public function __construct(Client $client, $charset = 'UTF-8') { |
65 | 65 | $this->setClient($client); |
66 | 66 | |
67 | - if(config('imap.options.fetch') === FT_PEEK) $this->leaveUnread(); |
|
67 | + if(config('imap.options.fetch') === FT_PEEK) { |
|
68 | + $this->leaveUnread(); |
|
69 | + } |
|
68 | 70 | |
69 | 71 | $this->charset = $charset; |
70 | 72 | $this->query = collect(); |
@@ -100,7 +102,9 @@ discard block |
||
100 | 102 | * @throws MessageSearchValidationException |
101 | 103 | */ |
102 | 104 | protected function parse_date($date) { |
103 | - if($date instanceof \Carbon\Carbon) return $date; |
|
105 | + if($date instanceof \Carbon\Carbon) { |
|
106 | + return $date; |
|
107 | + } |
|
104 | 108 | |
105 | 109 | try { |
106 | 110 | $date = Carbon::parse($date); |
@@ -151,7 +155,7 @@ discard block |
||
151 | 155 | */ |
152 | 156 | if($this->getCharset() === null){ |
153 | 157 | $available_messages = imap_search($this->getClient()->getConnection(), $this->getRawQuery(), SE_UID); |
154 | - }else{ |
|
158 | + } else{ |
|
155 | 159 | $available_messages = imap_search($this->getClient()->getConnection(), $this->getRawQuery(), SE_UID, $this->getCharset()); |
156 | 160 | } |
157 | 161 | |
@@ -203,7 +207,7 @@ discard block |
||
203 | 207 | } else { |
204 | 208 | if($statement[1] === null){ |
205 | 209 | $query .= $statement[0]; |
206 | - }else{ |
|
210 | + } else{ |
|
207 | 211 | $query .= $statement[0].' "'.$statement[1].'"'; |
208 | 212 | } |
209 | 213 | } |
@@ -232,7 +236,9 @@ discard block |
||
232 | 236 | * @return $this |
233 | 237 | */ |
234 | 238 | public function limit($limit, $page = 1) { |
235 | - if($page >= 1) $this->page = $page; |
|
239 | + if($page >= 1) { |
|
240 | + $this->page = $page; |
|
241 | + } |
|
236 | 242 | $this->limit = $limit; |
237 | 243 | |
238 | 244 | return $this; |
@@ -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 | } |
@@ -333,7 +333,9 @@ discard block |
||
333 | 333 | public function createFolder($name, $expunge = true) { |
334 | 334 | $this->checkConnection(); |
335 | 335 | $status = imap_createmailbox($this->getConnection(), $this->getAddress() . imap_utf7_encode($name)); |
336 | - if($expunge) $this->expunge(); |
|
336 | + if($expunge) { |
|
337 | + $this->expunge(); |
|
338 | + } |
|
337 | 339 | |
338 | 340 | return $status; |
339 | 341 | } |
@@ -350,7 +352,9 @@ discard block |
||
350 | 352 | public function renameFolder($old_name, $new_name, $expunge = true) { |
351 | 353 | $this->checkConnection(); |
352 | 354 | $status = imap_renamemailbox($this->getConnection(), $this->getAddress() . imap_utf7_encode($old_name), $this->getAddress() . imap_utf7_encode($new_name)); |
353 | - if($expunge) $this->expunge(); |
|
355 | + if($expunge) { |
|
356 | + $this->expunge(); |
|
357 | + } |
|
354 | 358 | |
355 | 359 | return $status; |
356 | 360 | } |
@@ -366,7 +370,9 @@ discard block |
||
366 | 370 | public function deleteFolder($name, $expunge = true) { |
367 | 371 | $this->checkConnection(); |
368 | 372 | $status = imap_deletemailbox($this->getConnection(), $this->getAddress() . imap_utf7_encode($name)); |
369 | - if($expunge) $this->expunge(); |
|
373 | + if($expunge) { |
|
374 | + $this->expunge(); |
|
375 | + } |
|
370 | 376 | |
371 | 377 | return $status; |
372 | 378 | } |
@@ -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 | } |
@@ -722,7 +722,7 @@ discard block |
||
722 | 722 | return EncodingAliases::get($parameter->value); |
723 | 723 | } |
724 | 724 | } |
725 | - }elseif (is_string($structure) === true){ |
|
725 | + } elseif (is_string($structure) === true){ |
|
726 | 726 | return mb_detect_encoding($structure); |
727 | 727 | } |
728 | 728 | |
@@ -792,7 +792,9 @@ discard block |
||
792 | 792 | */ |
793 | 793 | public function delete($expunge = true) { |
794 | 794 | $status = imap_delete($this->client->getConnection(), $this->uid, FT_UID); |
795 | - if($expunge) $this->client->expunge(); |
|
795 | + if($expunge) { |
|
796 | + $this->client->expunge(); |
|
797 | + } |
|
796 | 798 | |
797 | 799 | return $status; |
798 | 800 | } |
@@ -806,7 +808,9 @@ discard block |
||
806 | 808 | */ |
807 | 809 | public function restore($expunge = true) { |
808 | 810 | $status = imap_undelete($this->client->getConnection(), $this->uid, FT_UID); |
809 | - if($expunge) $this->client->expunge(); |
|
811 | + if($expunge) { |
|
812 | + $this->client->expunge(); |
|
813 | + } |
|
810 | 814 | |
811 | 815 | return $status; |
812 | 816 | } |