@@ -16,7 +16,7 @@ |
||
16 | 16 | * New custom method which can be called through a mask |
17 | 17 | * @return string |
18 | 18 | */ |
19 | - public function token(){ |
|
19 | + public function token() { |
|
20 | 20 | return implode('-', [$this->message_id, $this->uid, $this->message_no]); |
21 | 21 | } |
22 | 22 |
@@ -16,7 +16,7 @@ |
||
16 | 16 | * New custom method which can be called through a mask |
17 | 17 | * @return string |
18 | 18 | */ |
19 | - public function token(){ |
|
19 | + public function token() { |
|
20 | 20 | return implode('-', [$this->id, $this->getMessage()->getUid(), $this->name]); |
21 | 21 | } |
22 | 22 |
@@ -237,7 +237,9 @@ discard block |
||
237 | 237 | public function move($new_name, $expunge = true) { |
238 | 238 | $this->client->checkConnection(); |
239 | 239 | $status = $this->client->getConnection()->renameFolder($this->full_name, $new_name); |
240 | - if($expunge) $this->client->expunge(); |
|
240 | + if($expunge) { |
|
241 | + $this->client->expunge(); |
|
242 | + } |
|
241 | 243 | |
242 | 244 | $folder = $this->client->getFolder($new_name); |
243 | 245 | $event = $this->getEvent("folder", "moved"); |
@@ -300,7 +302,9 @@ discard block |
||
300 | 302 | */ |
301 | 303 | public function delete($expunge = true) { |
302 | 304 | $status = $this->client->getConnection()->deleteFolder($this->path); |
303 | - if($expunge) $this->client->expunge(); |
|
305 | + if($expunge) { |
|
306 | + $this->client->expunge(); |
|
307 | + } |
|
304 | 308 | |
305 | 309 | $event = $this->getEvent("folder", "deleted"); |
306 | 310 | $event::dispatch($this); |
@@ -368,10 +372,10 @@ discard block |
||
368 | 372 | |
369 | 373 | $connection->idle(); |
370 | 374 | } |
371 | - }catch (Exceptions\RuntimeException $e) { |
|
375 | + } catch (Exceptions\RuntimeException $e) { |
|
372 | 376 | if(strpos($e->getMessage(), "connection closed") === false) { |
373 | 377 | throw $e; |
374 | - }else{ |
|
378 | + } else{ |
|
375 | 379 | $this->client->connect(); |
376 | 380 | $this->client->openFolder($this->path); |
377 | 381 | $connection = $this->client->getConnection(); |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | |
126 | 126 | $this->setDelimiter($delimiter); |
127 | 127 | $this->path = $folder_name; |
128 | - $this->full_name = $this->decodeName($folder_name); |
|
128 | + $this->full_name = $this->decodeName($folder_name); |
|
129 | 129 | $this->name = $this->getSimpleName($this->delimiter, $this->full_name); |
130 | 130 | |
131 | 131 | $this->parseAttributes($attributes); |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | * @return WhereQuery |
139 | 139 | * @throws Exceptions\ConnectionFailedException |
140 | 140 | */ |
141 | - public function query($charset = 'UTF-8'){ |
|
141 | + public function query($charset = 'UTF-8') { |
|
142 | 142 | $this->getClient()->checkConnection(); |
143 | 143 | $this->getClient()->openFolder($this->path); |
144 | 144 | |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | * @inheritdoc self::query($charset = 'UTF-8') |
150 | 150 | * @throws Exceptions\ConnectionFailedException |
151 | 151 | */ |
152 | - public function search($charset = 'UTF-8'){ |
|
152 | + public function search($charset = 'UTF-8') { |
|
153 | 153 | return $this->query($charset); |
154 | 154 | } |
155 | 155 | |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | * @inheritdoc self::query($charset = 'UTF-8') |
158 | 158 | * @throws Exceptions\ConnectionFailedException |
159 | 159 | */ |
160 | - public function messages($charset = 'UTF-8'){ |
|
160 | + public function messages($charset = 'UTF-8') { |
|
161 | 161 | return $this->query($charset); |
162 | 162 | } |
163 | 163 | |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | public function move($new_name, $expunge = true) { |
233 | 233 | $this->client->checkConnection(); |
234 | 234 | $status = $this->client->getConnection()->renameFolder($this->full_name, $new_name); |
235 | - if($expunge) $this->client->expunge(); |
|
235 | + if ($expunge) $this->client->expunge(); |
|
236 | 236 | |
237 | 237 | $folder = $this->client->getFolder($new_name); |
238 | 238 | $event = $this->getEvent("folder", "moved"); |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | */ |
260 | 260 | |
261 | 261 | if ($internal_date != null) { |
262 | - if ($internal_date instanceof Carbon){ |
|
262 | + if ($internal_date instanceof Carbon) { |
|
263 | 263 | $internal_date = $internal_date->format('d-M-Y H:i:s O'); |
264 | 264 | } |
265 | 265 | } |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | */ |
294 | 294 | public function delete($expunge = true) { |
295 | 295 | $status = $this->client->getConnection()->deleteFolder($this->path); |
296 | - if($expunge) $this->client->expunge(); |
|
296 | + if ($expunge) $this->client->expunge(); |
|
297 | 297 | |
298 | 298 | $event = $this->getEvent("folder", "deleted"); |
299 | 299 | $event::dispatch($this); |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | try { |
349 | 349 | $line = $connection->nextLine(); |
350 | 350 | if (($pos = strpos($line, "EXISTS")) !== false) { |
351 | - $msgn = (int) substr($line, 2, $pos -2); |
|
351 | + $msgn = (int) substr($line, 2, $pos - 2); |
|
352 | 352 | $connection->done(); |
353 | 353 | |
354 | 354 | $message = $this->query()->getMessage($msgn); |
@@ -359,10 +359,10 @@ discard block |
||
359 | 359 | |
360 | 360 | $connection->idle(); |
361 | 361 | } |
362 | - }catch (Exceptions\RuntimeException $e) { |
|
363 | - if(strpos($e->getMessage(), "connection closed") === false) { |
|
362 | + } catch (Exceptions\RuntimeException $e) { |
|
363 | + if (strpos($e->getMessage(), "connection closed") === false) { |
|
364 | 364 | throw $e; |
365 | - }else{ |
|
365 | + }else { |
|
366 | 366 | $this->client->connect(); |
367 | 367 | $this->client->openFolder($this->path); |
368 | 368 | $connection = $this->client->getConnection(); |
@@ -407,8 +407,8 @@ discard block |
||
407 | 407 | * Set the delimiter |
408 | 408 | * @param $delimiter |
409 | 409 | */ |
410 | - public function setDelimiter($delimiter){ |
|
411 | - if(in_array($delimiter, [null, '', ' ', false]) === true) { |
|
410 | + public function setDelimiter($delimiter) { |
|
411 | + if (in_array($delimiter, [null, '', ' ', false]) === true) { |
|
412 | 412 | $delimiter = ClientManager::get('options.delimiter', '/'); |
413 | 413 | } |
414 | 414 |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | if(strtolower(substr($method, 0, 3)) === 'get') { |
227 | 227 | $name = Str::snake(substr($method, 3)); |
228 | 228 | return $this->get($name); |
229 | - }elseif (strtolower(substr($method, 0, 3)) === 'set') { |
|
229 | + } elseif (strtolower(substr($method, 0, 3)) === 'set') { |
|
230 | 230 | $name = Str::snake(substr($method, 3)); |
231 | 231 | |
232 | 232 | if(in_array($name, array_keys($this->attributes))) { |
@@ -612,9 +612,9 @@ discard block |
||
612 | 612 | return EncodingAliases::get($parameter->value); |
613 | 613 | } |
614 | 614 | } |
615 | - }elseif (property_exists($structure, 'charset')){ |
|
615 | + } elseif (property_exists($structure, 'charset')){ |
|
616 | 616 | return EncodingAliases::get($structure->charset); |
617 | - }elseif (is_string($structure) === true){ |
|
617 | + } elseif (is_string($structure) === true){ |
|
618 | 618 | return mb_detect_encoding($structure); |
619 | 619 | } |
620 | 620 | |
@@ -705,7 +705,9 @@ discard block |
||
705 | 705 | */ |
706 | 706 | public function delete($expunge = true) { |
707 | 707 | $status = $this->setFlag("Deleted"); |
708 | - if($expunge) $this->client->expunge(); |
|
708 | + if($expunge) { |
|
709 | + $this->client->expunge(); |
|
710 | + } |
|
709 | 711 | |
710 | 712 | $event = $this->getEvent("message", "deleted"); |
711 | 713 | $event::dispatch($this); |
@@ -724,7 +726,9 @@ discard block |
||
724 | 726 | */ |
725 | 727 | public function restore($expunge = true) { |
726 | 728 | $status = $this->unsetFlag("Deleted"); |
727 | - if($expunge) $this->client->expunge(); |
|
729 | + if($expunge) { |
|
730 | + $this->client->expunge(); |
|
731 | + } |
|
728 | 732 | |
729 | 733 | $event = $this->getEvent("message", "restored"); |
730 | 734 | $event::dispatch($this); |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | public function __construct($msgn, $msglist, Client $client, $fetch_options = null, $fetch_body = false, $fetch_flags = false) { |
196 | 196 | |
197 | 197 | $default_mask = $client->getDefaultMessageMask(); |
198 | - if($default_mask != null) { |
|
198 | + if ($default_mask != null) { |
|
199 | 199 | $this->mask = $default_mask; |
200 | 200 | } |
201 | 201 | $this->events["message"] = $client->getDefaultEvents("message"); |
@@ -240,13 +240,13 @@ discard block |
||
240 | 240 | * @throws MethodNotFoundException |
241 | 241 | */ |
242 | 242 | public function __call($method, $arguments) { |
243 | - if(strtolower(substr($method, 0, 3)) === 'get') { |
|
243 | + if (strtolower(substr($method, 0, 3)) === 'get') { |
|
244 | 244 | $name = Str::snake(substr($method, 3)); |
245 | 245 | return $this->get($name); |
246 | 246 | }elseif (strtolower(substr($method, 0, 3)) === 'set') { |
247 | 247 | $name = Str::snake(substr($method, 3)); |
248 | 248 | |
249 | - if(in_array($name, array_keys($this->attributes))) { |
|
249 | + if (in_array($name, array_keys($this->attributes))) { |
|
250 | 250 | $this->attributes[$name] = array_pop($arguments); |
251 | 251 | |
252 | 252 | return $this->attributes[$name]; |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | * @return mixed|null |
288 | 288 | */ |
289 | 289 | public function get($name) { |
290 | - if(isset($this->attributes[$name])) { |
|
290 | + if (isset($this->attributes[$name])) { |
|
291 | 291 | return $this->attributes[$name]; |
292 | 292 | } |
293 | 293 | |
@@ -369,8 +369,8 @@ discard block |
||
369 | 369 | $flags = $this->client->getConnection()->flags([$this->msgn]); |
370 | 370 | |
371 | 371 | if (isset($flags[$this->msgn])) { |
372 | - foreach($flags[$this->msgn] as $flag) { |
|
373 | - if (strpos($flag, "\\") === 0){ |
|
372 | + foreach ($flags[$this->msgn] as $flag) { |
|
373 | + if (strpos($flag, "\\") === 0) { |
|
374 | 374 | $flag = substr($flag, 1); |
375 | 375 | } |
376 | 376 | $flag_key = strtolower($flag); |
@@ -434,9 +434,9 @@ discard block |
||
434 | 434 | */ |
435 | 435 | private function fetchPart(Part $part) { |
436 | 436 | |
437 | - if ($part->type == IMAP::MESSAGE_TYPE_TEXT && ($part->ifdisposition == 0 || (empty($part->disposition) || !in_array(strtolower($part->disposition), ['attachment', 'inline'])) ) ) { |
|
437 | + if ($part->type == IMAP::MESSAGE_TYPE_TEXT && ($part->ifdisposition == 0 || (empty($part->disposition) || !in_array(strtolower($part->disposition), ['attachment', 'inline'])))) { |
|
438 | 438 | |
439 | - if ( in_array(($subtype = strtolower($part->subtype)), ["plain", "csv", "html"]) && $part->filename == null && $part->name == null) { |
|
439 | + if (in_array(($subtype = strtolower($part->subtype)), ["plain", "csv", "html"]) && $part->filename == null && $part->name == null) { |
|
440 | 440 | $encoding = $this->getEncoding($part); |
441 | 441 | |
442 | 442 | $content = $this->decodeString($part->content, $part->encoding); |
@@ -457,10 +457,10 @@ discard block |
||
457 | 457 | } |
458 | 458 | |
459 | 459 | $this->bodies[$subtype == "plain" ? "text" : $subtype] = $content; |
460 | - } else { |
|
460 | + }else { |
|
461 | 461 | $this->fetchAttachment($part); |
462 | 462 | } |
463 | - } else { |
|
463 | + }else { |
|
464 | 464 | $this->fetchAttachment($part); |
465 | 465 | } |
466 | 466 | } |
@@ -476,7 +476,7 @@ discard block |
||
476 | 476 | if ($oAttachment->getName() !== null) { |
477 | 477 | if ($oAttachment->getId() !== null) { |
478 | 478 | $this->attachments->put($oAttachment->getId(), $oAttachment); |
479 | - } else { |
|
479 | + }else { |
|
480 | 480 | $this->attachments->push($oAttachment); |
481 | 481 | } |
482 | 482 | } |
@@ -593,7 +593,7 @@ discard block |
||
593 | 593 | |
594 | 594 | if (function_exists('iconv') && $from != 'UTF-7' && $to != 'UTF-7') { |
595 | 595 | return @iconv($from, $to.'//IGNORE', $str); |
596 | - } else { |
|
596 | + }else { |
|
597 | 597 | if (!$from) { |
598 | 598 | return mb_convert_encoding($str, $to); |
599 | 599 | } |
@@ -614,9 +614,9 @@ discard block |
||
614 | 614 | return EncodingAliases::get($parameter->value); |
615 | 615 | } |
616 | 616 | } |
617 | - }elseif (property_exists($structure, 'charset')){ |
|
617 | + }elseif (property_exists($structure, 'charset')) { |
|
618 | 618 | return EncodingAliases::get($structure->charset); |
619 | - }elseif (is_string($structure) === true){ |
|
619 | + }elseif (is_string($structure) === true) { |
|
620 | 620 | return mb_detect_encoding($structure); |
621 | 621 | } |
622 | 622 | |
@@ -630,7 +630,7 @@ discard block |
||
630 | 630 | * @throws Exceptions\ConnectionFailedException |
631 | 631 | * @throws Exceptions\FolderFetchingException |
632 | 632 | */ |
633 | - public function getFolder(){ |
|
633 | + public function getFolder() { |
|
634 | 634 | return $this->client->getFolder($this->folder_path); |
635 | 635 | } |
636 | 636 | |
@@ -707,7 +707,7 @@ discard block |
||
707 | 707 | */ |
708 | 708 | public function delete($expunge = true) { |
709 | 709 | $status = $this->setFlag("Deleted"); |
710 | - if($expunge) $this->client->expunge(); |
|
710 | + if ($expunge) $this->client->expunge(); |
|
711 | 711 | |
712 | 712 | $event = $this->getEvent("message", "deleted"); |
713 | 713 | $event::dispatch($this); |
@@ -726,7 +726,7 @@ discard block |
||
726 | 726 | */ |
727 | 727 | public function restore($expunge = true) { |
728 | 728 | $status = $this->unsetFlag("Deleted"); |
729 | - if($expunge) $this->client->expunge(); |
|
729 | + if ($expunge) $this->client->expunge(); |
|
730 | 730 | |
731 | 731 | $event = $this->getEvent("message", "restored"); |
732 | 732 | $event::dispatch($this); |
@@ -879,7 +879,7 @@ discard block |
||
879 | 879 | * |
880 | 880 | * @return object|null |
881 | 881 | */ |
882 | - public function getStructure(){ |
|
882 | + public function getStructure() { |
|
883 | 883 | return $this->structure; |
884 | 884 | } |
885 | 885 | |
@@ -905,7 +905,7 @@ discard block |
||
905 | 905 | * |
906 | 906 | * @return array |
907 | 907 | */ |
908 | - public function getAttributes(){ |
|
908 | + public function getAttributes() { |
|
909 | 909 | return array_merge($this->attributes, $this->header->getAttributes()); |
910 | 910 | } |
911 | 911 | |
@@ -915,8 +915,8 @@ discard block |
||
915 | 915 | * |
916 | 916 | * @return $this |
917 | 917 | */ |
918 | - public function setMask($mask){ |
|
919 | - if(class_exists($mask)){ |
|
918 | + public function setMask($mask) { |
|
919 | + if (class_exists($mask)) { |
|
920 | 920 | $this->mask = $mask; |
921 | 921 | } |
922 | 922 | |
@@ -928,7 +928,7 @@ discard block |
||
928 | 928 | * |
929 | 929 | * @return string |
930 | 930 | */ |
931 | - public function getMask(){ |
|
931 | + public function getMask() { |
|
932 | 932 | return $this->mask; |
933 | 933 | } |
934 | 934 | |
@@ -939,9 +939,9 @@ discard block |
||
939 | 939 | * @return mixed |
940 | 940 | * @throws MaskNotFoundException |
941 | 941 | */ |
942 | - public function mask($mask = null){ |
|
942 | + public function mask($mask = null) { |
|
943 | 943 | $mask = $mask !== null ? $mask : $this->mask; |
944 | - if(class_exists($mask)){ |
|
944 | + if (class_exists($mask)) { |
|
945 | 945 | return new $mask($this); |
946 | 946 | } |
947 | 947 |
@@ -46,7 +46,9 @@ discard block |
||
46 | 46 | */ |
47 | 47 | public function getCustomHTMLBody($callback = false) { |
48 | 48 | $body = $this->getHtmlBody(); |
49 | - if($body === null) return null; |
|
49 | + if($body === null) { |
|
50 | + return null; |
|
51 | + } |
|
50 | 52 | |
51 | 53 | if ($callback !== false) { |
52 | 54 | $aAttachment = $this->parent->getAttachments(); |
@@ -54,7 +56,7 @@ discard block |
||
54 | 56 | /** @var Attachment $oAttachment */ |
55 | 57 | if(is_callable($callback)) { |
56 | 58 | $body = $callback($body, $oAttachment); |
57 | - }elseif(is_string($callback)) { |
|
59 | + } elseif(is_string($callback)) { |
|
58 | 60 | call_user_func($callback, [$body, $oAttachment]); |
59 | 61 | } |
60 | 62 | }); |
@@ -30,13 +30,13 @@ discard block |
||
30 | 30 | * |
31 | 31 | * @return null |
32 | 32 | */ |
33 | - public function getHtmlBody(){ |
|
33 | + public function getHtmlBody() { |
|
34 | 34 | $bodies = $this->parent->getBodies(); |
35 | 35 | if (!isset($bodies['html'])) { |
36 | 36 | return null; |
37 | 37 | } |
38 | 38 | |
39 | - if(is_object($bodies['html']) && property_exists($bodies['html'], 'content')) { |
|
39 | + if (is_object($bodies['html']) && property_exists($bodies['html'], 'content')) { |
|
40 | 40 | return $bodies['html']->content; |
41 | 41 | } |
42 | 42 | return $bodies['html']; |
@@ -50,15 +50,15 @@ discard block |
||
50 | 50 | */ |
51 | 51 | public function getCustomHTMLBody($callback = false) { |
52 | 52 | $body = $this->getHtmlBody(); |
53 | - if($body === null) return null; |
|
53 | + if ($body === null) return null; |
|
54 | 54 | |
55 | 55 | if ($callback !== false) { |
56 | 56 | $aAttachment = $this->parent->getAttachments(); |
57 | 57 | $aAttachment->each(function($oAttachment) use(&$body, $callback) { |
58 | 58 | /** @var Attachment $oAttachment */ |
59 | - if(is_callable($callback)) { |
|
59 | + if (is_callable($callback)) { |
|
60 | 60 | $body = $callback($body, $oAttachment); |
61 | - }elseif(is_string($callback)) { |
|
61 | + }elseif (is_string($callback)) { |
|
62 | 62 | call_user_func($callback, [$body, $oAttachment]); |
63 | 63 | } |
64 | 64 | }); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * @return string|null |
75 | 75 | */ |
76 | 76 | public function getHTMLBodyWithEmbeddedBase64Images() { |
77 | - return $this->getCustomHTMLBody(function($body, $oAttachment){ |
|
77 | + return $this->getCustomHTMLBody(function($body, $oAttachment) { |
|
78 | 78 | /** @var \Webklex\PHPIMAP\Attachment $oAttachment */ |
79 | 79 | if ($oAttachment->id) { |
80 | 80 | $body = str_replace('cid:'.$oAttachment->id, 'data:'.$oAttachment->getContentType().';base64, '.base64_encode($oAttachment->getContent()), $body); |
@@ -67,7 +67,7 @@ |
||
67 | 67 | return $this->attributes[$name]; |
68 | 68 | } |
69 | 69 | |
70 | - }elseif (strtolower(substr($method, 0, 3)) === 'set') { |
|
70 | + } elseif (strtolower(substr($method, 0, 3)) === 'set') { |
|
71 | 71 | $name = Str::snake(substr($method, 3)); |
72 | 72 | |
73 | 73 | if(isset($this->attributes[$name])) { |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | public function __construct($parent) { |
44 | 44 | $this->parent = $parent; |
45 | 45 | |
46 | - if(method_exists($this->parent, 'getAttributes')){ |
|
46 | + if (method_exists($this->parent, 'getAttributes')) { |
|
47 | 47 | $this->attributes = array_merge($this->attributes, $this->parent->getAttributes()); |
48 | 48 | } |
49 | 49 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | /** |
54 | 54 | * Boot method made to be used by any custom mask |
55 | 55 | */ |
56 | - protected function boot(){} |
|
56 | + protected function boot() {} |
|
57 | 57 | |
58 | 58 | /** |
59 | 59 | * Call dynamic attribute setter and getter methods and inherit the parent calls |
@@ -64,17 +64,17 @@ discard block |
||
64 | 64 | * @throws MethodNotFoundException |
65 | 65 | */ |
66 | 66 | public function __call($method, $arguments) { |
67 | - if(strtolower(substr($method, 0, 3)) === 'get') { |
|
67 | + if (strtolower(substr($method, 0, 3)) === 'get') { |
|
68 | 68 | $name = Str::snake(substr($method, 3)); |
69 | 69 | |
70 | - if(isset($this->attributes[$name])) { |
|
70 | + if (isset($this->attributes[$name])) { |
|
71 | 71 | return $this->attributes[$name]; |
72 | 72 | } |
73 | 73 | |
74 | 74 | }elseif (strtolower(substr($method, 0, 3)) === 'set') { |
75 | 75 | $name = Str::snake(substr($method, 3)); |
76 | 76 | |
77 | - if(isset($this->attributes[$name])) { |
|
77 | + if (isset($this->attributes[$name])) { |
|
78 | 78 | $this->attributes[$name] = array_pop($arguments); |
79 | 79 | |
80 | 80 | return $this->attributes[$name]; |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | |
83 | 83 | } |
84 | 84 | |
85 | - if(method_exists($this->parent, $method) === true){ |
|
85 | + if (method_exists($this->parent, $method) === true) { |
|
86 | 86 | return call_user_func_array([$this->parent, $method], $arguments); |
87 | 87 | } |
88 | 88 | |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | * @return mixed|null |
110 | 110 | */ |
111 | 111 | public function __get($name) { |
112 | - if(isset($this->attributes[$name])) { |
|
112 | + if (isset($this->attributes[$name])) { |
|
113 | 113 | return $this->attributes[$name]; |
114 | 114 | } |
115 | 115 | |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | * |
122 | 122 | * @return mixed |
123 | 123 | */ |
124 | - public function getParent(){ |
|
124 | + public function getParent() { |
|
125 | 125 | return $this->parent; |
126 | 126 | } |
127 | 127 | |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | * |
131 | 131 | * @return array |
132 | 132 | */ |
133 | - public function getAttributes(){ |
|
133 | + public function getAttributes() { |
|
134 | 134 | return $this->attributes; |
135 | 135 | } |
136 | 136 |
@@ -69,7 +69,7 @@ |
||
69 | 69 | * @return int|null |
70 | 70 | */ |
71 | 71 | public function total($total = null) { |
72 | - if($total === null) { |
|
72 | + if ($total === null) { |
|
73 | 73 | return $this->total; |
74 | 74 | } |
75 | 75 |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | throw new AuthFailedException($message); |
86 | 86 | } |
87 | 87 | |
88 | - if(!$this->stream) { |
|
88 | + if (!$this->stream) { |
|
89 | 89 | $errors = \imap_errors(); |
90 | 90 | $message = implode("; ", (is_array($errors) ? $errors : array())); |
91 | 91 | throw new AuthFailedException($message); |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | if (!$this->cert_validation) { |
117 | 117 | $address .= '/novalidate-cert'; |
118 | 118 | } |
119 | - if (in_array($this->encryption,['tls', 'notls', 'ssl'])) { |
|
119 | + if (in_array($this->encryption, ['tls', 'notls', 'ssl'])) { |
|
120 | 120 | $address .= '/'.$this->encryption; |
121 | 121 | } elseif ($this->encryption === "starttls") { |
122 | 122 | $address .= '/tls'; |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | * |
145 | 145 | * @return bool |
146 | 146 | */ |
147 | - public function connected(){ |
|
147 | + public function connected() { |
|
148 | 148 | return !$this->stream; |
149 | 149 | } |
150 | 150 | |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | * |
211 | 211 | * @return array |
212 | 212 | */ |
213 | - public function headers($uids, $rfc = "RFC822"){ |
|
213 | + public function headers($uids, $rfc = "RFC822") { |
|
214 | 214 | $headers = \imap_fetchheader($this->stream, $uids[0], IMAP::FT_UID); |
215 | 215 | return [$uids[0] => $headers]; |
216 | 216 | } |
@@ -221,13 +221,13 @@ discard block |
||
221 | 221 | * |
222 | 222 | * @return array |
223 | 223 | */ |
224 | - public function flags($uids){ |
|
224 | + public function flags($uids) { |
|
225 | 225 | $flags = \imap_fetch_overview($this->stream, $uids[0], IMAP::FT_UID); |
226 | 226 | $result = []; |
227 | 227 | if (is_array($flags) && isset($flags[0])) { |
228 | 228 | $flags = (array) $flags[0]; |
229 | - foreach($flags as $flag => $value) { |
|
230 | - if ($value === 1 && in_array($flag, ["size", "uid", "msgno", "update"]) === false){ |
|
229 | + foreach ($flags as $flag => $value) { |
|
230 | + if ($value === 1 && in_array($flag, ["size", "uid", "msgno", "update"]) === false) { |
|
231 | 231 | $result[] = "\\".ucfirst($flag); |
232 | 232 | } |
233 | 233 | } |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | if ($id === null) { |
246 | 246 | $overview = $this->overview("1:*"); |
247 | 247 | $uids = []; |
248 | - foreach($overview as $set){ |
|
248 | + foreach ($overview as $set) { |
|
249 | 249 | $uids[$set->msgno] = $set->uid; |
250 | 250 | } |
251 | 251 | return $uids; |
@@ -285,12 +285,12 @@ discard block |
||
285 | 285 | $result = []; |
286 | 286 | |
287 | 287 | $items = \imap_getmailboxes($this->stream, $this->getAddress(), $reference.$folder); |
288 | - if(is_array($items)){ |
|
288 | + if (is_array($items)) { |
|
289 | 289 | foreach ($items as $item) { |
290 | 290 | $name = $this->decodeFolderName($item->name); |
291 | 291 | $result[$name] = ['delimiter' => $item->delimiter, 'flags' => []]; |
292 | 292 | } |
293 | - }else{ |
|
293 | + }else { |
|
294 | 294 | throw new RuntimeException(\imap_last_error()); |
295 | 295 | } |
296 | 296 | |
@@ -311,9 +311,9 @@ discard block |
||
311 | 311 | public function store(array $flags, $from, $to = null, $mode = null, $silent = true) { |
312 | 312 | $flag = "\\".trim(is_array($flags) ? implode(" \\", $flags) : $flags); |
313 | 313 | |
314 | - if ($mode == "+"){ |
|
314 | + if ($mode == "+") { |
|
315 | 315 | $status = \imap_setflag_full($this->stream, $from, $flag, IMAP::SE_UID); |
316 | - }else{ |
|
316 | + }else { |
|
317 | 317 | $status = \imap_clearflag_full($this->stream, $from, $flag, IMAP::SE_UID); |
318 | 318 | } |
319 | 319 | |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | */ |
336 | 336 | public function appendMessage($folder, $message, $flags = null, $date = null) { |
337 | 337 | if ($date != null) { |
338 | - if ($date instanceof \Carbon\Carbon){ |
|
338 | + if ($date instanceof \Carbon\Carbon) { |
|
339 | 339 | $date = $date->format('d-M-Y H:i:s O'); |
340 | 340 | } |
341 | 341 | return \imap_append($this->stream, $folder, $message, $flags, $date); |
@@ -457,14 +457,14 @@ discard block |
||
457 | 457 | /** |
458 | 458 | * Enable the debug mode |
459 | 459 | */ |
460 | - public function enableDebug(){ |
|
460 | + public function enableDebug() { |
|
461 | 461 | $this->debug = true; |
462 | 462 | } |
463 | 463 | |
464 | 464 | /** |
465 | 465 | * Disable the debug mode |
466 | 466 | */ |
467 | - public function disableDebug(){ |
|
467 | + public function disableDebug() { |
|
468 | 468 | $this->debug = false; |
469 | 469 | } |
470 | 470 |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | $name = $this->decodeFolderName($item->name); |
291 | 291 | $result[$name] = ['delimiter' => $item->delimiter, 'flags' => []]; |
292 | 292 | } |
293 | - }else{ |
|
293 | + } else{ |
|
294 | 294 | throw new RuntimeException(\imap_last_error()); |
295 | 295 | } |
296 | 296 | |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | |
314 | 314 | if ($mode == "+"){ |
315 | 315 | $status = \imap_setflag_full($this->stream, $from, $flag, IMAP::SE_UID); |
316 | - }else{ |
|
316 | + } else{ |
|
317 | 317 | $status = \imap_clearflag_full($this->stream, $from, $flag, IMAP::SE_UID); |
318 | 318 | } |
319 | 319 |
@@ -55,7 +55,7 @@ |
||
55 | 55 | // so add them back in manually if we can |
56 | 56 | if (defined('STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT')) { |
57 | 57 | $cryptoMethod = STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT; |
58 | - }elseif (defined('STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT')) { |
|
58 | + } elseif (defined('STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT')) { |
|
59 | 59 | $cryptoMethod = STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT; |
60 | 60 | } |
61 | 61 |