Completed
Push — master ( 6b8225...8354f2 )
by Malte
01:48
created
src/Message.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.