@@ -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 | } |
@@ -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 | } |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | return null; |
| 121 | - }elseif (strtolower(substr($method, 0, 3)) === 'set') { |
|
| 121 | + } elseif (strtolower(substr($method, 0, 3)) === 'set') { |
|
| 122 | 122 | $name = snake_case(substr($method, 3)); |
| 123 | 123 | |
| 124 | 124 | $this->attributes[$name] = array_pop($arguments); |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | public function setName($name) { |
| 258 | 258 | if($this->config['decoder']['message']['subject'] === 'utf-8') { |
| 259 | 259 | $this->name = imap_utf8($name); |
| 260 | - }else{ |
|
| 260 | + } else{ |
|
| 261 | 261 | $this->name = mb_decode_mimeheader($name); |
| 262 | 262 | } |
| 263 | 263 | } |
@@ -60,7 +60,7 @@ |
||
| 60 | 60 | return $this->attributes[$name]; |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | - }elseif (strtolower(substr($method, 0, 3)) === 'set') { |
|
| 63 | + } elseif (strtolower(substr($method, 0, 3)) === 'set') { |
|
| 64 | 64 | $name = snake_case(substr($method, 3)); |
| 65 | 65 | |
| 66 | 66 | if(isset($this->attributes[$name])) { |
@@ -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 | }); |
@@ -65,7 +65,9 @@ discard block |
||
| 65 | 65 | public function __construct(Client $client, $charset = 'UTF-8') { |
| 66 | 66 | $this->setClient($client); |
| 67 | 67 | |
| 68 | - if(config('imap.options.fetch') === IMAP::FT_PEEK) $this->leaveUnread(); |
|
| 68 | + if(config('imap.options.fetch') === IMAP::FT_PEEK) { |
|
| 69 | + $this->leaveUnread(); |
|
| 70 | + } |
|
| 69 | 71 | |
| 70 | 72 | $this->charset = $charset; |
| 71 | 73 | $this->query = collect(); |
@@ -101,7 +103,9 @@ discard block |
||
| 101 | 103 | * @throws MessageSearchValidationException |
| 102 | 104 | */ |
| 103 | 105 | protected function parse_date($date) { |
| 104 | - if($date instanceof \Carbon\Carbon) return $date; |
|
| 106 | + if($date instanceof \Carbon\Carbon) { |
|
| 107 | + return $date; |
|
| 108 | + } |
|
| 105 | 109 | |
| 106 | 110 | try { |
| 107 | 111 | $date = Carbon::parse($date); |
@@ -152,7 +156,7 @@ discard block |
||
| 152 | 156 | */ |
| 153 | 157 | if($this->getCharset() === null){ |
| 154 | 158 | $available_messages = imap_search($this->getClient()->getConnection(), $this->getRawQuery(), IMAP::SE_UID); |
| 155 | - }else{ |
|
| 159 | + } else{ |
|
| 156 | 160 | $available_messages = imap_search($this->getClient()->getConnection(), $this->getRawQuery(), IMAP::SE_UID, $this->getCharset()); |
| 157 | 161 | } |
| 158 | 162 | |
@@ -204,7 +208,7 @@ discard block |
||
| 204 | 208 | } else { |
| 205 | 209 | if($statement[1] === null){ |
| 206 | 210 | $query .= $statement[0]; |
| 207 | - }else{ |
|
| 211 | + } else{ |
|
| 208 | 212 | $query .= $statement[0].' "'.$statement[1].'"'; |
| 209 | 213 | } |
| 210 | 214 | } |
@@ -234,7 +238,9 @@ discard block |
||
| 234 | 238 | * @return $this |
| 235 | 239 | */ |
| 236 | 240 | public function limit($limit, $page = 1) { |
| 237 | - if($page >= 1) $this->page = $page; |
|
| 241 | + if($page >= 1) { |
|
| 242 | + $this->page = $page; |
|
| 243 | + } |
|
| 238 | 244 | $this->limit = $limit; |
| 239 | 245 | |
| 240 | 246 | return $this; |
@@ -178,39 +178,39 @@ discard block |
||
| 178 | 178 | if(isset($config['masks']['message'])) { |
| 179 | 179 | if(class_exists($config['masks']['message'])) { |
| 180 | 180 | $this->default_message_mask = $config['masks']['message']; |
| 181 | - }else{ |
|
| 181 | + } else{ |
|
| 182 | 182 | throw new MaskNotFoundException("Unknown mask provided: ".$config['masks']['message']); |
| 183 | 183 | } |
| 184 | - }else{ |
|
| 184 | + } else{ |
|
| 185 | 185 | if(class_exists($default_config['message'])) { |
| 186 | 186 | $this->default_message_mask = $default_config['message']; |
| 187 | - }else{ |
|
| 187 | + } else{ |
|
| 188 | 188 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['message']); |
| 189 | 189 | } |
| 190 | 190 | } |
| 191 | 191 | if(isset($config['masks']['attachment'])) { |
| 192 | 192 | if(class_exists($config['masks']['attachment'])) { |
| 193 | 193 | $this->default_message_mask = $config['masks']['attachment']; |
| 194 | - }else{ |
|
| 194 | + } else{ |
|
| 195 | 195 | throw new MaskNotFoundException("Unknown mask provided: ".$config['masks']['attachment']); |
| 196 | 196 | } |
| 197 | - }else{ |
|
| 197 | + } else{ |
|
| 198 | 198 | if(class_exists($default_config['attachment'])) { |
| 199 | 199 | $this->default_message_mask = $default_config['attachment']; |
| 200 | - }else{ |
|
| 200 | + } else{ |
|
| 201 | 201 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['attachment']); |
| 202 | 202 | } |
| 203 | 203 | } |
| 204 | - }else{ |
|
| 204 | + } else{ |
|
| 205 | 205 | if(class_exists($default_config['message'])) { |
| 206 | 206 | $this->default_message_mask = $default_config['message']; |
| 207 | - }else{ |
|
| 207 | + } else{ |
|
| 208 | 208 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['message']); |
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | if(class_exists($default_config['attachment'])) { |
| 212 | 212 | $this->default_message_mask = $default_config['attachment']; |
| 213 | - }else{ |
|
| 213 | + } else{ |
|
| 214 | 214 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['attachment']); |
| 215 | 215 | } |
| 216 | 216 | } |
@@ -401,7 +401,9 @@ discard block |
||
| 401 | 401 | public function createFolder($name, $expunge = true) { |
| 402 | 402 | $this->checkConnection(); |
| 403 | 403 | $status = imap_createmailbox($this->getConnection(), $this->getAddress() . imap_utf7_encode($name)); |
| 404 | - if($expunge) $this->expunge(); |
|
| 404 | + if($expunge) { |
|
| 405 | + $this->expunge(); |
|
| 406 | + } |
|
| 405 | 407 | |
| 406 | 408 | return $status; |
| 407 | 409 | } |
@@ -418,7 +420,9 @@ discard block |
||
| 418 | 420 | public function renameFolder($old_name, $new_name, $expunge = true) { |
| 419 | 421 | $this->checkConnection(); |
| 420 | 422 | $status = imap_renamemailbox($this->getConnection(), $this->getAddress() . imap_utf7_encode($old_name), $this->getAddress() . imap_utf7_encode($new_name)); |
| 421 | - if($expunge) $this->expunge(); |
|
| 423 | + if($expunge) { |
|
| 424 | + $this->expunge(); |
|
| 425 | + } |
|
| 422 | 426 | |
| 423 | 427 | return $status; |
| 424 | 428 | } |
@@ -434,7 +438,9 @@ discard block |
||
| 434 | 438 | public function deleteFolder($name, $expunge = true) { |
| 435 | 439 | $this->checkConnection(); |
| 436 | 440 | $status = imap_deletemailbox($this->getConnection(), $this->getAddress() . imap_utf7_encode($name)); |
| 437 | - if($expunge) $this->expunge(); |
|
| 441 | + if($expunge) { |
|
| 442 | + $this->expunge(); |
|
| 443 | + } |
|
| 438 | 444 | |
| 439 | 445 | return $status; |
| 440 | 446 | } |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | return $this->attributes[$name]; |
| 237 | 237 | } |
| 238 | 238 | |
| 239 | - }elseif (strtolower(substr($method, 0, 3)) === 'set') { |
|
| 239 | + } elseif (strtolower(substr($method, 0, 3)) === 'set') { |
|
| 240 | 240 | $name = snake_case(substr($method, 3)); |
| 241 | 241 | |
| 242 | 242 | if(isset($this->attributes[$name])) { |
@@ -354,9 +354,9 @@ discard block |
||
| 354 | 354 | /** @var Attachment $oAttachment */ |
| 355 | 355 | if(is_callable($replaceImages)) { |
| 356 | 356 | $body = $replaceImages($body, $oAttachment); |
| 357 | - }elseif(is_string($replaceImages)) { |
|
| 357 | + } elseif(is_string($replaceImages)) { |
|
| 358 | 358 | call_user_func($replaceImages, [$body, $oAttachment]); |
| 359 | - }else{ |
|
| 359 | + } else{ |
|
| 360 | 360 | if ($oAttachment->id && $oAttachment->getImgSrc() != null) { |
| 361 | 361 | $body = str_replace('cid:'.$oAttachment->id, $oAttachment->getImgSrc(), $body); |
| 362 | 362 | } |
@@ -386,7 +386,7 @@ discard block |
||
| 386 | 386 | if (property_exists($header, 'subject')) { |
| 387 | 387 | if($this->config['decoder']['message']['subject'] === 'utf-8') { |
| 388 | 388 | $this->subject = imap_utf8($header->subject); |
| 389 | - }else{ |
|
| 389 | + } else{ |
|
| 390 | 390 | $this->subject = mb_decode_mimeheader($header->subject); |
| 391 | 391 | } |
| 392 | 392 | } |
@@ -890,7 +890,7 @@ discard block |
||
| 890 | 890 | return EncodingAliases::get($parameter->value); |
| 891 | 891 | } |
| 892 | 892 | } |
| 893 | - }elseif (is_string($structure) === true){ |
|
| 893 | + } elseif (is_string($structure) === true){ |
|
| 894 | 894 | return mb_detect_encoding($structure); |
| 895 | 895 | } |
| 896 | 896 | |
@@ -962,7 +962,9 @@ discard block |
||
| 962 | 962 | */ |
| 963 | 963 | public function delete($expunge = true) { |
| 964 | 964 | $status = imap_delete($this->client->getConnection(), $this->uid, IMAP::FT_UID); |
| 965 | - if($expunge) $this->client->expunge(); |
|
| 965 | + if($expunge) { |
|
| 966 | + $this->client->expunge(); |
|
| 967 | + } |
|
| 966 | 968 | |
| 967 | 969 | return $status; |
| 968 | 970 | } |
@@ -976,7 +978,9 @@ discard block |
||
| 976 | 978 | */ |
| 977 | 979 | public function restore($expunge = true) { |
| 978 | 980 | $status = imap_undelete($this->client->getConnection(), $this->uid, IMAP::FT_UID); |
| 979 | - if($expunge) $this->client->expunge(); |
|
| 981 | + if($expunge) { |
|
| 982 | + $this->client->expunge(); |
|
| 983 | + } |
|
| 980 | 984 | |
| 981 | 985 | return $status; |
| 982 | 986 | } |