@@ -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 | } |
@@ -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 | } |
@@ -346,7 +346,9 @@ discard block |
||
| 346 | 346 | public function createFolder($name, $expunge = true) { |
| 347 | 347 | $this->checkConnection(); |
| 348 | 348 | $status = imap_createmailbox($this->getConnection(), $this->getAddress() . imap_utf7_encode($name)); |
| 349 | - if($expunge) $this->expunge(); |
|
| 349 | + if($expunge) { |
|
| 350 | + $this->expunge(); |
|
| 351 | + } |
|
| 350 | 352 | |
| 351 | 353 | return $status; |
| 352 | 354 | } |
@@ -363,7 +365,9 @@ discard block |
||
| 363 | 365 | public function renameFolder($old_name, $new_name, $expunge = true) { |
| 364 | 366 | $this->checkConnection(); |
| 365 | 367 | $status = imap_renamemailbox($this->getConnection(), $this->getAddress() . imap_utf7_encode($old_name), $this->getAddress() . imap_utf7_encode($new_name)); |
| 366 | - if($expunge) $this->expunge(); |
|
| 368 | + if($expunge) { |
|
| 369 | + $this->expunge(); |
|
| 370 | + } |
|
| 367 | 371 | |
| 368 | 372 | return $status; |
| 369 | 373 | } |
@@ -379,7 +383,9 @@ discard block |
||
| 379 | 383 | public function deleteFolder($name, $expunge = true) { |
| 380 | 384 | $this->checkConnection(); |
| 381 | 385 | $status = imap_deletemailbox($this->getConnection(), $this->getAddress() . imap_utf7_encode($name)); |
| 382 | - if($expunge) $this->expunge(); |
|
| 386 | + if($expunge) { |
|
| 387 | + $this->expunge(); |
|
| 388 | + } |
|
| 383 | 389 | |
| 384 | 390 | return $status; |
| 385 | 391 | } |
@@ -594,9 +600,9 @@ discard block |
||
| 594 | 600 | public function setTimeout($type, $timeout) { |
| 595 | 601 | if(is_numeric($type)) { |
| 596 | 602 | $type = (int) $type; |
| 597 | - }elseif (isset($this->timeout_type[$type])){ |
|
| 603 | + } elseif (isset($this->timeout_type[$type])){ |
|
| 598 | 604 | $type = $this->timeout_type[$type]; |
| 599 | - }else{ |
|
| 605 | + } else{ |
|
| 600 | 606 | throw new InvalidImapTimeoutTypeException("Invalid imap timeout type provided."); |
| 601 | 607 | } |
| 602 | 608 | |
@@ -613,9 +619,9 @@ discard block |
||
| 613 | 619 | public function getTimeout($type){ |
| 614 | 620 | if(is_numeric($type)) { |
| 615 | 621 | $type = (int) $type; |
| 616 | - }elseif (isset($this->timeout_type[$type])){ |
|
| 622 | + } elseif (isset($this->timeout_type[$type])){ |
|
| 617 | 623 | $type = $this->timeout_type[$type]; |
| 618 | - }else{ |
|
| 624 | + } else{ |
|
| 619 | 625 | throw new InvalidImapTimeoutTypeException("Invalid imap timeout type provided."); |
| 620 | 626 | } |
| 621 | 627 | |
@@ -229,7 +229,7 @@ |
||
| 229 | 229 | public function setName($name) { |
| 230 | 230 | if($this->config['decoder']['message']['subject'] === 'utf-8') { |
| 231 | 231 | $this->name = imap_utf8($name); |
| 232 | - }else{ |
|
| 232 | + } else{ |
|
| 233 | 233 | $this->name = mb_decode_mimeheader($name); |
| 234 | 234 | } |
| 235 | 235 | } |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | if (property_exists($header, 'subject')) { |
| 331 | 331 | if($this->config['decoder']['message']['subject'] === 'utf-8') { |
| 332 | 332 | $this->subject = imap_utf8($header->subject); |
| 333 | - }else{ |
|
| 333 | + } else{ |
|
| 334 | 334 | $this->subject = mb_decode_mimeheader($header->subject); |
| 335 | 335 | } |
| 336 | 336 | } |
@@ -788,7 +788,7 @@ discard block |
||
| 788 | 788 | return EncodingAliases::get($parameter->value); |
| 789 | 789 | } |
| 790 | 790 | } |
| 791 | - }elseif (is_string($structure) === true){ |
|
| 791 | + } elseif (is_string($structure) === true){ |
|
| 792 | 792 | return mb_detect_encoding($structure); |
| 793 | 793 | } |
| 794 | 794 | |
@@ -859,7 +859,9 @@ discard block |
||
| 859 | 859 | */ |
| 860 | 860 | public function delete($expunge = true) { |
| 861 | 861 | $status = imap_delete($this->client->getConnection(), $this->uid, FT_UID); |
| 862 | - if($expunge) $this->client->expunge(); |
|
| 862 | + if($expunge) { |
|
| 863 | + $this->client->expunge(); |
|
| 864 | + } |
|
| 863 | 865 | |
| 864 | 866 | return $status; |
| 865 | 867 | } |
@@ -873,7 +875,9 @@ discard block |
||
| 873 | 875 | */ |
| 874 | 876 | public function restore($expunge = true) { |
| 875 | 877 | $status = imap_undelete($this->client->getConnection(), $this->uid, FT_UID); |
| 876 | - if($expunge) $this->client->expunge(); |
|
| 878 | + if($expunge) { |
|
| 879 | + $this->client->expunge(); |
|
| 880 | + } |
|
| 877 | 881 | |
| 878 | 882 | return $status; |
| 879 | 883 | } |