@@ -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 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | $this->part_number = ($part_number) ? $part_number : $this->part_number; |
99 | 99 | |
100 | 100 | $default_mask = $this->oMessage->getClient()->getDefaultAttachmentMask(); |
101 | - if($default_mask != null) { |
|
101 | + if ($default_mask != null) { |
|
102 | 102 | $this->mask = $default_mask; |
103 | 103 | } |
104 | 104 | |
@@ -115,10 +115,10 @@ discard block |
||
115 | 115 | * @throws MethodNotFoundException |
116 | 116 | */ |
117 | 117 | public function __call($method, $arguments) { |
118 | - if(strtolower(substr($method, 0, 3)) === 'get') { |
|
118 | + if (strtolower(substr($method, 0, 3)) === 'get') { |
|
119 | 119 | $name = Str::snake(substr($method, 3)); |
120 | 120 | |
121 | - if(isset($this->attributes[$name])) { |
|
121 | + if (isset($this->attributes[$name])) { |
|
122 | 122 | return $this->attributes[$name]; |
123 | 123 | } |
124 | 124 | |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | * @return mixed|null |
153 | 153 | */ |
154 | 154 | public function __get($name) { |
155 | - if(isset($this->attributes[$name])) { |
|
155 | + if (isset($this->attributes[$name])) { |
|
156 | 156 | return $this->attributes[$name]; |
157 | 157 | } |
158 | 158 | |
@@ -264,9 +264,9 @@ discard block |
||
264 | 264 | * @param $name |
265 | 265 | */ |
266 | 266 | public function setName($name) { |
267 | - if($this->config['decoder']['message']['subject'] === 'utf-8') { |
|
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 | } |
@@ -286,28 +286,28 @@ discard block |
||
286 | 286 | /** |
287 | 287 | * @return string|null |
288 | 288 | */ |
289 | - public function getMimeType(){ |
|
289 | + public function getMimeType() { |
|
290 | 290 | return (new \finfo())->buffer($this->getContent(), FILEINFO_MIME_TYPE); |
291 | 291 | } |
292 | 292 | |
293 | 293 | /** |
294 | 294 | * @return string|null |
295 | 295 | */ |
296 | - public function getExtension(){ |
|
296 | + public function getExtension() { |
|
297 | 297 | return ExtensionGuesser::getInstance()->guess($this->getMimeType()); |
298 | 298 | } |
299 | 299 | |
300 | 300 | /** |
301 | 301 | * @return array |
302 | 302 | */ |
303 | - public function getAttributes(){ |
|
303 | + public function getAttributes() { |
|
304 | 304 | return $this->attributes; |
305 | 305 | } |
306 | 306 | |
307 | 307 | /** |
308 | 308 | * @return Message |
309 | 309 | */ |
310 | - public function getMessage(){ |
|
310 | + public function getMessage() { |
|
311 | 311 | return $this->oMessage; |
312 | 312 | } |
313 | 313 | |
@@ -315,8 +315,8 @@ discard block |
||
315 | 315 | * @param $mask |
316 | 316 | * @return $this |
317 | 317 | */ |
318 | - public function setMask($mask){ |
|
319 | - if(class_exists($mask)){ |
|
318 | + public function setMask($mask) { |
|
319 | + if (class_exists($mask)) { |
|
320 | 320 | $this->mask = $mask; |
321 | 321 | } |
322 | 322 | |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | /** |
327 | 327 | * @return string |
328 | 328 | */ |
329 | - public function getMask(){ |
|
329 | + public function getMask() { |
|
330 | 330 | return $this->mask; |
331 | 331 | } |
332 | 332 | |
@@ -337,9 +337,9 @@ discard block |
||
337 | 337 | * @return mixed |
338 | 338 | * @throws MaskNotFoundException |
339 | 339 | */ |
340 | - public function mask($mask = null){ |
|
340 | + public function mask($mask = null) { |
|
341 | 341 | $mask = $mask !== null ? $mask : $this->mask; |
342 | - if(class_exists($mask)){ |
|
342 | + if (class_exists($mask)) { |
|
343 | 343 | return new $mask($this); |
344 | 344 | } |
345 | 345 |
@@ -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 | } |
@@ -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 | |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | if (substr($criteria, 0, 6) === "CUSTOM") { |
103 | 103 | return substr($criteria, 6); |
104 | 104 | } |
105 | - if(in_array($criteria, $this->available_criteria) === false) { |
|
105 | + if (in_array($criteria, $this->available_criteria) === false) { |
|
106 | 106 | throw new InvalidWhereQueryCriteriaException(); |
107 | 107 | } |
108 | 108 | |
@@ -117,20 +117,20 @@ discard block |
||
117 | 117 | * @throws InvalidWhereQueryCriteriaException |
118 | 118 | */ |
119 | 119 | public function where($criteria, $value = null) { |
120 | - if(is_array($criteria)){ |
|
121 | - foreach($criteria as $key => $value){ |
|
122 | - if(is_numeric($key)){ |
|
120 | + if (is_array($criteria)) { |
|
121 | + foreach ($criteria as $key => $value) { |
|
122 | + if (is_numeric($key)) { |
|
123 | 123 | return $this->where($value); |
124 | 124 | } |
125 | 125 | return $this->where($key, $value); |
126 | 126 | } |
127 | - }else{ |
|
127 | + } else { |
|
128 | 128 | $criteria = $this->validate_criteria($criteria); |
129 | 129 | $value = $this->parse_value($value); |
130 | 130 | |
131 | - if($value === null || $value === ''){ |
|
131 | + if ($value === null || $value === '') { |
|
132 | 132 | $this->query->push([$criteria]); |
133 | - }else{ |
|
133 | + } else { |
|
134 | 134 | $this->query->push([$criteria, $value]); |
135 | 135 | } |
136 | 136 | } |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | */ |
146 | 146 | public function orWhere(\Closure $closure = null) { |
147 | 147 | $this->query->push(['OR']); |
148 | - if($closure !== null) $closure($this); |
|
148 | + if ($closure !== null) $closure($this); |
|
149 | 149 | |
150 | 150 | return $this; |
151 | 151 | } |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | */ |
158 | 158 | public function andWhere(\Closure $closure = null) { |
159 | 159 | $this->query->push(['AND']); |
160 | - if($closure !== null) $closure($this); |
|
160 | + if ($closure !== null) $closure($this); |
|
161 | 161 | |
162 | 162 | return $this; |
163 | 163 | } |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | * @return WhereQuery |
398 | 398 | * @throws InvalidWhereQueryCriteriaException |
399 | 399 | */ |
400 | - public function whereNoXSpam(){ |
|
400 | + public function whereNoXSpam() { |
|
401 | 401 | return $this->where("X-Spam-Flag NO"); |
402 | 402 | } |
403 | 403 | |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | * @return WhereQuery |
406 | 406 | * @throws InvalidWhereQueryCriteriaException |
407 | 407 | */ |
408 | - public function whereIsXSpam(){ |
|
408 | + public function whereIsXSpam() { |
|
409 | 409 | return $this->where("X-Spam-Flag YES"); |
410 | 410 | } |
411 | 411 | |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | * @return WhereQuery |
416 | 416 | * @throws InvalidWhereQueryCriteriaException |
417 | 417 | */ |
418 | - public function whereLanguage($country_code){ |
|
418 | + public function whereLanguage($country_code) { |
|
419 | 419 | return $this->where("Content-Language $country_code"); |
420 | 420 | } |
421 | 421 | } |
@@ -124,13 +124,13 @@ discard block |
||
124 | 124 | } |
125 | 125 | return $this->where($key, $value); |
126 | 126 | } |
127 | - }else{ |
|
127 | + } else{ |
|
128 | 128 | $criteria = $this->validate_criteria($criteria); |
129 | 129 | $value = $this->parse_value($value); |
130 | 130 | |
131 | 131 | if($value === null || $value === ''){ |
132 | 132 | $this->query->push([$criteria]); |
133 | - }else{ |
|
133 | + } else{ |
|
134 | 134 | $this->query->push([$criteria, $value]); |
135 | 135 | } |
136 | 136 | } |
@@ -145,7 +145,9 @@ discard block |
||
145 | 145 | */ |
146 | 146 | public function orWhere(\Closure $closure = null) { |
147 | 147 | $this->query->push(['OR']); |
148 | - if($closure !== null) $closure($this); |
|
148 | + if($closure !== null) { |
|
149 | + $closure($this); |
|
150 | + } |
|
149 | 151 | |
150 | 152 | return $this; |
151 | 153 | } |
@@ -157,7 +159,9 @@ discard block |
||
157 | 159 | */ |
158 | 160 | public function andWhere(\Closure $closure = null) { |
159 | 161 | $this->query->push(['AND']); |
160 | - if($closure !== null) $closure($this); |
|
162 | + if($closure !== null) { |
|
163 | + $closure($this); |
|
164 | + } |
|
161 | 165 | |
162 | 166 | return $this; |
163 | 167 | } |