@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | |
120 | 120 | $this->setDelimiter($structure->delimiter); |
121 | 121 | $this->path = $structure->name; |
122 | - $this->full_name = $this->decodeName($structure->name); |
|
122 | + $this->full_name = $this->decodeName($structure->name); |
|
123 | 123 | $this->name = $this->getSimpleName($this->delimiter, $this->full_name); |
124 | 124 | |
125 | 125 | $this->parseAttributes($structure->attributes); |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | * @return WhereQuery |
133 | 133 | * @throws Exceptions\ConnectionFailedException |
134 | 134 | */ |
135 | - public function query($charset = 'UTF-8'){ |
|
135 | + public function query($charset = 'UTF-8') { |
|
136 | 136 | $this->getClient()->checkConnection(); |
137 | 137 | $this->getClient()->openFolder($this->path); |
138 | 138 | |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | * @inheritdoc self::query($charset = 'UTF-8') |
144 | 144 | * @throws Exceptions\ConnectionFailedException |
145 | 145 | */ |
146 | - public function search($charset = 'UTF-8'){ |
|
146 | + public function search($charset = 'UTF-8') { |
|
147 | 147 | return $this->query($charset); |
148 | 148 | } |
149 | 149 | |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | * @inheritdoc self::query($charset = 'UTF-8') |
152 | 152 | * @throws Exceptions\ConnectionFailedException |
153 | 153 | */ |
154 | - public function messages($charset = 'UTF-8'){ |
|
154 | + public function messages($charset = 'UTF-8') { |
|
155 | 155 | return $this->query($charset); |
156 | 156 | } |
157 | 157 | |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | * @deprecated 1.2.1:2.0.0 No longer needed. Use Folder::query() instead |
317 | 317 | * @see Folder::query() |
318 | 318 | */ |
319 | - 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 | + public function searchMessages(array $where, $fetch_options = null, $fetch_body = true, $fetch_attachment = true, $fetch_flags = true, $limit = null, $page = 1, $charset = "UTF-8") { |
|
320 | 320 | $this->getClient()->checkConnection(); |
321 | 321 | |
322 | 322 | return $this->query($charset)->where($where)->setFetchOptions($fetch_options)->setFetchBody($fetch_body) |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | */ |
376 | 376 | public function delete($expunge = true) { |
377 | 377 | $status = \imap_deletemailbox($this->client->getConnection(), $this->path); |
378 | - if($expunge) $this->client->expunge(); |
|
378 | + if ($expunge) $this->client->expunge(); |
|
379 | 379 | |
380 | 380 | return $status; |
381 | 381 | } |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | */ |
393 | 393 | public function move($target_mailbox, $expunge = true) { |
394 | 394 | $status = \imap_renamemailbox($this->client->getConnection(), $this->path, $target_mailbox); |
395 | - if($expunge) $this->client->expunge(); |
|
395 | + if ($expunge) $this->client->expunge(); |
|
396 | 396 | |
397 | 397 | return $status; |
398 | 398 | } |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | */ |
434 | 434 | |
435 | 435 | if ($internal_date != null) { |
436 | - if ($internal_date instanceof \Carbon\Carbon){ |
|
436 | + if ($internal_date instanceof \Carbon\Carbon) { |
|
437 | 437 | $internal_date = $internal_date->format('d-M-Y H:i:s O'); |
438 | 438 | } |
439 | 439 | return \imap_append($this->client->getConnection(), $this->path, $message, $options, $internal_date); |
@@ -454,8 +454,8 @@ discard block |
||
454 | 454 | /** |
455 | 455 | * @param $delimiter |
456 | 456 | */ |
457 | - public function setDelimiter($delimiter){ |
|
458 | - if(in_array($delimiter, [null, '', ' ', false]) === true) { |
|
457 | + public function setDelimiter($delimiter) { |
|
458 | + if (in_array($delimiter, [null, '', ' ', false]) === true) { |
|
459 | 459 | $delimiter = config('imap.options.delimiter', '/'); |
460 | 460 | } |
461 | 461 |
@@ -375,7 +375,9 @@ discard block |
||
375 | 375 | */ |
376 | 376 | public function delete($expunge = true) { |
377 | 377 | $status = \imap_deletemailbox($this->client->getConnection(), $this->path); |
378 | - if($expunge) $this->client->expunge(); |
|
378 | + if($expunge) { |
|
379 | + $this->client->expunge(); |
|
380 | + } |
|
379 | 381 | |
380 | 382 | return $status; |
381 | 383 | } |
@@ -392,7 +394,9 @@ discard block |
||
392 | 394 | */ |
393 | 395 | public function move($target_mailbox, $expunge = true) { |
394 | 396 | $status = \imap_renamemailbox($this->client->getConnection(), $this->path, $target_mailbox); |
395 | - if($expunge) $this->client->expunge(); |
|
397 | + if($expunge) { |
|
398 | + $this->client->expunge(); |
|
399 | + } |
|
396 | 400 | |
397 | 401 | return $status; |
398 | 402 | } |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | } |
124 | 124 | |
125 | 125 | return null; |
126 | - }elseif (strtolower(substr($method, 0, 3)) === 'set') { |
|
126 | + } elseif (strtolower(substr($method, 0, 3)) === 'set') { |
|
127 | 127 | $name = Str::snake(substr($method, 3)); |
128 | 128 | |
129 | 129 | $this->attributes[$name] = array_pop($arguments); |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | public function setName($name) { |
267 | 267 | if($this->config['decoder']['message']['subject'] === 'utf-8') { |
268 | 268 | $this->name = \imap_utf8($name); |
269 | - }else{ |
|
269 | + } else{ |
|
270 | 270 | $this->name = mb_decode_mimeheader($name); |
271 | 271 | } |
272 | 272 | } |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | $this->part_number = ($part_number) ? $part_number : $this->part_number; |
98 | 98 | |
99 | 99 | $default_mask = $this->oMessage->getClient()->getDefaultAttachmentMask(); |
100 | - if($default_mask != null) { |
|
100 | + if ($default_mask != null) { |
|
101 | 101 | $this->mask = $default_mask; |
102 | 102 | } |
103 | 103 | |
@@ -114,10 +114,10 @@ discard block |
||
114 | 114 | * @throws MethodNotFoundException |
115 | 115 | */ |
116 | 116 | public function __call($method, $arguments) { |
117 | - if(strtolower(substr($method, 0, 3)) === 'get') { |
|
117 | + if (strtolower(substr($method, 0, 3)) === 'get') { |
|
118 | 118 | $name = Str::snake(substr($method, 3)); |
119 | 119 | |
120 | - if(isset($this->attributes[$name])) { |
|
120 | + if (isset($this->attributes[$name])) { |
|
121 | 121 | return $this->attributes[$name]; |
122 | 122 | } |
123 | 123 | |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | * @return mixed|null |
152 | 152 | */ |
153 | 153 | public function __get($name) { |
154 | - if(isset($this->attributes[$name])) { |
|
154 | + if (isset($this->attributes[$name])) { |
|
155 | 155 | return $this->attributes[$name]; |
156 | 156 | } |
157 | 157 | |
@@ -263,9 +263,9 @@ discard block |
||
263 | 263 | * @param $name |
264 | 264 | */ |
265 | 265 | public function setName($name) { |
266 | - if($this->config['decoder']['message']['subject'] === 'utf-8') { |
|
266 | + if ($this->config['decoder']['message']['subject'] === 'utf-8') { |
|
267 | 267 | $this->name = \imap_utf8($name); |
268 | - }else{ |
|
268 | + } else { |
|
269 | 269 | $this->name = mb_decode_mimeheader($name); |
270 | 270 | } |
271 | 271 | } |
@@ -285,16 +285,16 @@ discard block |
||
285 | 285 | /** |
286 | 286 | * @return string|null |
287 | 287 | */ |
288 | - public function getMimeType(){ |
|
288 | + public function getMimeType() { |
|
289 | 289 | return (new \finfo())->buffer($this->getContent(), FILEINFO_MIME_TYPE); |
290 | 290 | } |
291 | 291 | |
292 | 292 | /** |
293 | 293 | * @return string|null |
294 | 294 | */ |
295 | - public function getExtension(){ |
|
295 | + public function getExtension() { |
|
296 | 296 | $deprecated_guesser = "\Symfony\Component\HttpFoundation\File\MimeType\ExtensionGuesser"; |
297 | - if (class_exists($deprecated_guesser) !== false){ |
|
297 | + if (class_exists($deprecated_guesser) !== false) { |
|
298 | 298 | return $deprecated_guesser::getInstance()->guess($this->getMimeType()); |
299 | 299 | } |
300 | 300 | $guesser = "\Symfony\Component\Mime\MimeTypes"; |
@@ -305,14 +305,14 @@ discard block |
||
305 | 305 | /** |
306 | 306 | * @return array |
307 | 307 | */ |
308 | - public function getAttributes(){ |
|
308 | + public function getAttributes() { |
|
309 | 309 | return $this->attributes; |
310 | 310 | } |
311 | 311 | |
312 | 312 | /** |
313 | 313 | * @return Message |
314 | 314 | */ |
315 | - public function getMessage(){ |
|
315 | + public function getMessage() { |
|
316 | 316 | return $this->oMessage; |
317 | 317 | } |
318 | 318 | |
@@ -320,8 +320,8 @@ discard block |
||
320 | 320 | * @param $mask |
321 | 321 | * @return $this |
322 | 322 | */ |
323 | - public function setMask($mask){ |
|
324 | - if(class_exists($mask)){ |
|
323 | + public function setMask($mask) { |
|
324 | + if (class_exists($mask)) { |
|
325 | 325 | $this->mask = $mask; |
326 | 326 | } |
327 | 327 | |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | /** |
332 | 332 | * @return string |
333 | 333 | */ |
334 | - public function getMask(){ |
|
334 | + public function getMask() { |
|
335 | 335 | return $this->mask; |
336 | 336 | } |
337 | 337 | |
@@ -342,9 +342,9 @@ discard block |
||
342 | 342 | * @return mixed |
343 | 343 | * @throws MaskNotFoundException |
344 | 344 | */ |
345 | - public function mask($mask = null){ |
|
345 | + public function mask($mask = null) { |
|
346 | 346 | $mask = $mask !== null ? $mask : $this->mask; |
347 | - if(class_exists($mask)){ |
|
347 | + if (class_exists($mask)) { |
|
348 | 348 | return new $mask($this); |
349 | 349 | } |
350 | 350 |
@@ -76,18 +76,18 @@ 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 | - if (strpos(strtolower($name), "where") === false){ |
|
84 | + if (strpos(strtolower($name), "where") === false) { |
|
85 | 85 | $method = 'where'.ucfirst($name); |
86 | - }else{ |
|
86 | + } else { |
|
87 | 87 | $method = lcfirst($name); |
88 | 88 | } |
89 | 89 | |
90 | - if(method_exists($this, $method) === true){ |
|
90 | + if (method_exists($this, $method) === true) { |
|
91 | 91 | return call_user_func_array([$that, $method], $arguments); |
92 | 92 | } |
93 | 93 | |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | if (substr($criteria, 0, 6) === "CUSTOM") { |
108 | 108 | return substr($criteria, 6); |
109 | 109 | } |
110 | - if(in_array($criteria, $this->available_criteria) === false) { |
|
110 | + if (in_array($criteria, $this->available_criteria) === false) { |
|
111 | 111 | throw new InvalidWhereQueryCriteriaException(); |
112 | 112 | } |
113 | 113 | |
@@ -122,20 +122,20 @@ discard block |
||
122 | 122 | * @throws InvalidWhereQueryCriteriaException |
123 | 123 | */ |
124 | 124 | public function where($criteria, $value = null) { |
125 | - if(is_array($criteria)){ |
|
126 | - foreach($criteria as $key => $value){ |
|
127 | - if(is_numeric($key)){ |
|
125 | + if (is_array($criteria)) { |
|
126 | + foreach ($criteria as $key => $value) { |
|
127 | + if (is_numeric($key)) { |
|
128 | 128 | return $this->where($value); |
129 | 129 | } |
130 | 130 | return $this->where($key, $value); |
131 | 131 | } |
132 | - }else{ |
|
132 | + } else { |
|
133 | 133 | $criteria = $this->validate_criteria($criteria); |
134 | 134 | $value = $this->parse_value($value); |
135 | 135 | |
136 | - if($value === null || $value === ''){ |
|
136 | + if ($value === null || $value === '') { |
|
137 | 137 | $this->query->push([$criteria]); |
138 | - }else{ |
|
138 | + } else { |
|
139 | 139 | $this->query->push([$criteria, $value]); |
140 | 140 | } |
141 | 141 | } |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | */ |
151 | 151 | public function orWhere(\Closure $closure = null) { |
152 | 152 | $this->query->push(['OR']); |
153 | - if($closure !== null) $closure($this); |
|
153 | + if ($closure !== null) $closure($this); |
|
154 | 154 | |
155 | 155 | return $this; |
156 | 156 | } |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | */ |
163 | 163 | public function andWhere(\Closure $closure = null) { |
164 | 164 | $this->query->push(['AND']); |
165 | - if($closure !== null) $closure($this); |
|
165 | + if ($closure !== null) $closure($this); |
|
166 | 166 | |
167 | 167 | return $this; |
168 | 168 | } |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | * @return WhereQuery |
403 | 403 | * @throws InvalidWhereQueryCriteriaException |
404 | 404 | */ |
405 | - public function whereNoXSpam(){ |
|
405 | + public function whereNoXSpam() { |
|
406 | 406 | return $this->where("X-Spam-Flag NO"); |
407 | 407 | } |
408 | 408 | |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | * @return WhereQuery |
411 | 411 | * @throws InvalidWhereQueryCriteriaException |
412 | 412 | */ |
413 | - public function whereIsXSpam(){ |
|
413 | + public function whereIsXSpam() { |
|
414 | 414 | return $this->where("X-Spam-Flag YES"); |
415 | 415 | } |
416 | 416 | |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | * @return WhereQuery |
421 | 421 | * @throws InvalidWhereQueryCriteriaException |
422 | 422 | */ |
423 | - public function whereLanguage($country_code){ |
|
423 | + public function whereLanguage($country_code) { |
|
424 | 424 | return $this->where("Content-Language $country_code"); |
425 | 425 | } |
426 | 426 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | |
84 | 84 | if (strpos(strtolower($name), "where") === false){ |
85 | 85 | $method = 'where'.ucfirst($name); |
86 | - }else{ |
|
86 | + } else{ |
|
87 | 87 | $method = lcfirst($name); |
88 | 88 | } |
89 | 89 | |
@@ -129,13 +129,13 @@ discard block |
||
129 | 129 | } |
130 | 130 | return $this->where($key, $value); |
131 | 131 | } |
132 | - }else{ |
|
132 | + } else{ |
|
133 | 133 | $criteria = $this->validate_criteria($criteria); |
134 | 134 | $value = $this->parse_value($value); |
135 | 135 | |
136 | 136 | if($value === null || $value === ''){ |
137 | 137 | $this->query->push([$criteria]); |
138 | - }else{ |
|
138 | + } else{ |
|
139 | 139 | $this->query->push([$criteria, $value]); |
140 | 140 | } |
141 | 141 | } |
@@ -150,7 +150,9 @@ discard block |
||
150 | 150 | */ |
151 | 151 | public function orWhere(\Closure $closure = null) { |
152 | 152 | $this->query->push(['OR']); |
153 | - if($closure !== null) $closure($this); |
|
153 | + if($closure !== null) { |
|
154 | + $closure($this); |
|
155 | + } |
|
154 | 156 | |
155 | 157 | return $this; |
156 | 158 | } |
@@ -162,7 +164,9 @@ discard block |
||
162 | 164 | */ |
163 | 165 | public function andWhere(\Closure $closure = null) { |
164 | 166 | $this->query->push(['AND']); |
165 | - if($closure !== null) $closure($this); |
|
167 | + if($closure !== null) { |
|
168 | + $closure($this); |
|
169 | + } |
|
166 | 170 | |
167 | 171 | return $this; |
168 | 172 | } |