@@ -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,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 | } |