Passed
Push — master ( 0897d6...647d71 )
by Malte
03:33
created
src/Attribute.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
     public function offsetSet($offset, $value) {
116 116
         if (is_null($offset)) {
117 117
             $this->values[] = $value;
118
-        } else {
118
+        }else {
119 119
             $this->values[$offset] = $value;
120 120
         }
121 121
     }
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
             if ($this->contains($value) === false) {
189 189
                 $this->values[] = $value;
190 190
             }
191
-        }else{
191
+        }else {
192 192
             $this->values[] = $value;
193 193
         }
194 194
     }
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
      *
238 238
      * @return mixed|null
239 239
      */
240
-    public function first(){
240
+    public function first() {
241 241
         if ($this->offsetExists(0)) {
242 242
             return $this->values[0];
243 243
         }
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
      *
250 250
      * @return mixed|null
251 251
      */
252
-    public function last(){
252
+    public function last() {
253 253
         if (($cnt = $this->count()) > 0) {
254 254
             return $this->values[$cnt - 1];
255 255
         }
Please login to merge, or discard this patch.
src/Query/WhereQuery.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -85,8 +85,8 @@  discard block
 block discarded – undo
85 85
         }
86 86
 
87 87
         if (strpos(strtolower($name), "where") === false) {
88
-            $method = 'where' . ucfirst($name);
89
-        } else {
88
+            $method = 'where'.ucfirst($name);
89
+        }else {
90 90
             $method = lcfirst($name);
91 91
         }
92 92
 
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
             return call_user_func_array([$that, $method], $arguments);
95 95
         }
96 96
 
97
-        throw new MethodNotFoundException("Method " . self::class . '::' . $method . '() is not supported');
97
+        throw new MethodNotFoundException("Method ".self::class.'::'.$method.'() is not supported');
98 98
     }
99 99
 
100 100
     /**
@@ -137,11 +137,11 @@  discard block
 block discarded – undo
137 137
             foreach ($criteria as $key => $value) {
138 138
                 if (is_numeric($key)) {
139 139
                     $this->where($value);
140
-                }else{
140
+                }else {
141 141
                     $this->where($key, $value);
142 142
                 }
143 143
             }
144
-        } else {
144
+        }else {
145 145
             $this->push_search_criteria($criteria, $value);
146 146
         }
147 147
 
@@ -155,13 +155,13 @@  discard block
 block discarded – undo
155 155
      *
156 156
      * @throws InvalidWhereQueryCriteriaException
157 157
      */
158
-    protected function push_search_criteria(string $criteria, $value){
158
+    protected function push_search_criteria(string $criteria, $value) {
159 159
         $criteria = $this->validate_criteria($criteria);
160 160
         $value = $this->parse_value($value);
161 161
 
162 162
         if ($value === null || $value === '') {
163 163
             $this->query->push([$criteria]);
164
-        } else {
164
+        }else {
165 165
             $this->query->push([$criteria, $value]);
166 166
         }
167 167
     }
Please login to merge, or discard this patch.
src/Query/Query.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 
96 96
         if (ClientManager::get('options.fetch_order') === 'desc') {
97 97
             $this->fetch_order = 'desc';
98
-        } else {
98
+        }else {
99 99
             $this->fetch_order = 'asc';
100 100
         }
101 101
 
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
                 break;
127 127
         }
128 128
 
129
-        return (string)$value;
129
+        return (string) $value;
130 130
     }
131 131
 
132 132
     /**
@@ -158,14 +158,14 @@  discard block
 block discarded – undo
158 158
         $this->query->each(function($statement) use (&$query) {
159 159
             if (count($statement) == 1) {
160 160
                 $query .= $statement[0];
161
-            } else {
161
+            }else {
162 162
                 if ($statement[1] === null) {
163 163
                     $query .= $statement[0];
164
-                } else {
164
+                }else {
165 165
                     if (is_numeric($statement[1])) {
166
-                        $query .= $statement[0] . ' ' . $statement[1];
167
-                    } else {
168
-                        $query .= $statement[0] . ' "' . $statement[1] . '"';
166
+                        $query .= $statement[0].' '.$statement[1];
167
+                    }else {
168
+                        $query .= $statement[0].' "'.$statement[1].'"';
169 169
                     }
170 170
                 }
171 171
             }
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
                 $key = $message->getMessageId();
300 300
                 break;
301 301
         }
302
-        return (string)$key;
302
+        return (string) $key;
303 303
     }
304 304
 
305 305
     /**
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
             $extensions = $raw_messages["extensions"][$uid] ?? [];
348 348
 
349 349
             $message = $this->make($uid, $msglist, $header, $content, $flag);
350
-            foreach($extensions as $key => $extension) {
350
+            foreach ($extensions as $key => $extension) {
351 351
                 $message->getHeader()->set($key, $extension);
352 352
             }
353 353
             if ($message !== null) {
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
         $uids = $connection->getUid();
500 500
         $available_messages = new Collection();
501 501
         if (is_array($uids)) {
502
-            foreach ($uids as $id){
502
+            foreach ($uids as $id) {
503 503
                 if ($closure($id)) {
504 504
                     $available_messages->push($id);
505 505
                 }
Please login to merge, or discard this patch.
src/Structure.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
      * @throws MessageContentFetchingException
78 78
      * @throws InvalidMessageDateException
79 79
      */
80
-    protected function parse(){
80
+    protected function parse() {
81 81
         $this->findContentType();
82 82
         $this->parts = $this->find_parts();
83 83
     }
@@ -85,12 +85,12 @@  discard block
 block discarded – undo
85 85
     /**
86 86
      * Determine the message content type
87 87
      */
88
-    public function findContentType(){
88
+    public function findContentType() {
89 89
         $content_type = $this->header->get("content_type");
90 90
         $content_type = (is_array($content_type)) ? implode(' ', $content_type) : $content_type;
91
-        if(stripos($content_type, 'multipart') === 0) {
91
+        if (stripos($content_type, 'multipart') === 0) {
92 92
             $this->type = IMAP::MESSAGE_TYPE_MULTIPART;
93
-        }else{
93
+        }else {
94 94
             $this->type = IMAP::MESSAGE_TYPE_TEXT;
95 95
         }
96 96
     }
@@ -127,9 +127,9 @@  discard block
 block discarded – undo
127 127
      * @throws InvalidMessageDateException
128 128
      */
129 129
     private function detectParts(string $boundary, string $context, int $part_number = 0): array {
130
-        $base_parts = explode( $boundary, $context);
130
+        $base_parts = explode($boundary, $context);
131 131
         $final_parts = [];
132
-        foreach($base_parts as $ctx) {
132
+        foreach ($base_parts as $ctx) {
133 133
             $ctx = substr($ctx, 2);
134 134
             if ($ctx !== "--" && $ctx != "") {
135 135
                 $parts = $this->parsePart($ctx, $part_number);
@@ -151,8 +151,8 @@  discard block
 block discarded – undo
151 151
      * @throws InvalidMessageDateException
152 152
      */
153 153
     public function find_parts(): array {
154
-        if($this->type === IMAP::MESSAGE_TYPE_MULTIPART) {
155
-            if (($boundary = $this->header->getBoundary()) === null)  {
154
+        if ($this->type === IMAP::MESSAGE_TYPE_MULTIPART) {
155
+            if (($boundary = $this->header->getBoundary()) === null) {
156 156
                 throw new MessageContentFetchingException("no content found", 0);
157 157
             }
158 158
 
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
      * @return string|null
169 169
      * @Depricated since version 2.4.4
170 170
      */
171
-    public function getBoundary(){
171
+    public function getBoundary() {
172 172
         return $this->header->getBoundary();
173 173
     }
174 174
 }
Please login to merge, or discard this patch.
src/Attachment.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
         $this->part_number = $part->part_number;
104 104
 
105 105
         $default_mask = $this->oMessage->getClient()->getDefaultAttachmentMask();
106
-        if($default_mask != null) {
106
+        if ($default_mask != null) {
107 107
             $this->mask = $default_mask;
108 108
         }
109 109
 
@@ -120,10 +120,10 @@  discard block
 block discarded – undo
120 120
      * @throws MethodNotFoundException
121 121
      */
122 122
     public function __call(string $method, array $arguments) {
123
-        if(strtolower(substr($method, 0, 3)) === 'get') {
123
+        if (strtolower(substr($method, 0, 3)) === 'get') {
124 124
             $name = Str::snake(substr($method, 3));
125 125
 
126
-            if(isset($this->attributes[$name])) {
126
+            if (isset($this->attributes[$name])) {
127 127
                 return $this->attributes[$name];
128 128
             }
129 129
 
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
      * @return mixed|null
160 160
      */
161 161
     public function __get($name) {
162
-        if(isset($this->attributes[$name])) {
162
+        if (isset($this->attributes[$name])) {
163 163
             return $this->attributes[$name];
164 164
         }
165 165
 
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
         if (IMAP::ATTACHMENT_TYPE_MESSAGE == $this->part->type) {
230 230
             if ($this->part->ifdescription) {
231 231
                 $this->setName($this->part->description);
232
-            } else {
232
+            }else {
233 233
                 $this->setName($this->part->subtype);
234 234
             }
235 235
         }
@@ -255,9 +255,9 @@  discard block
 block discarded – undo
255 255
     public function setName($name) {
256 256
         $decoder = $this->config['decoder']['attachment'];
257 257
         if ($name !== null) {
258
-            if($decoder === 'utf-8' && extension_loaded('imap')) {
258
+            if ($decoder === 'utf-8' && extension_loaded('imap')) {
259 259
                 $this->name = \imap_utf8($name);
260
-            }else{
260
+            }else {
261 261
                 $this->name = mb_decode_mimeheader($name);
262 262
             }
263 263
         }
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
      *
269 269
      * @return string|null
270 270
      */
271
-    public function getMimeType(){
271
+    public function getMimeType() {
272 272
         return (new \finfo())->buffer($this->getContent(), FILEINFO_MIME_TYPE);
273 273
     }
274 274
 
@@ -277,9 +277,9 @@  discard block
 block discarded – undo
277 277
      *
278 278
      * @return string|null
279 279
      */
280
-    public function getExtension(){
280
+    public function getExtension() {
281 281
         $deprecated_guesser = "\Symfony\Component\HttpFoundation\File\MimeType\ExtensionGuesser";
282
-        if (class_exists($deprecated_guesser) !== false){
282
+        if (class_exists($deprecated_guesser) !== false) {
283 283
             /** @var \Symfony\Component\HttpFoundation\File\MimeType\ExtensionGuesser $deprecated_guesser */
284 284
             return $deprecated_guesser::getInstance()->guess($this->getMimeType());
285 285
         }
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
      * @return $this
313 313
      */
314 314
     public function setMask($mask): Attachment {
315
-        if(class_exists($mask)){
315
+        if (class_exists($mask)) {
316 316
             $this->mask = $mask;
317 317
         }
318 318
 
@@ -335,9 +335,9 @@  discard block
 block discarded – undo
335 335
      * @return mixed
336 336
      * @throws MaskNotFoundException
337 337
      */
338
-    public function mask($mask = null){
338
+    public function mask($mask = null) {
339 339
         $mask = $mask !== null ? $mask : $this->mask;
340
-        if(class_exists($mask)){
340
+        if (class_exists($mask)) {
341 341
             return new $mask($this);
342 342
         }
343 343
 
Please login to merge, or discard this patch.
src/Client.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -210,11 +210,11 @@  discard block
 block discarded – undo
210 210
      * @param array $config
211 211
      * @param array $default_config
212 212
      */
213
-    private function setAccountConfig(string $key, array $config, array $default_config){
213
+    private function setAccountConfig(string $key, array $config, array $default_config) {
214 214
         $value = $this->default_account_config[$key];
215
-        if(isset($config[$key])) {
215
+        if (isset($config[$key])) {
216 216
             $value = $config[$key];
217
-        }elseif(isset($default_config[$key])) {
217
+        }elseif (isset($default_config[$key])) {
218 218
             $value = $default_config[$key];
219 219
         }
220 220
         $this->$key = $value;
@@ -226,8 +226,8 @@  discard block
 block discarded – undo
226 226
      */
227 227
     protected function setEventsFromConfig($config) {
228 228
         $this->events = ClientManager::get("events");
229
-        if(isset($config['events'])){
230
-            foreach($config['events'] as $section => $events) {
229
+        if (isset($config['events'])) {
230
+            foreach ($config['events'] as $section => $events) {
231 231
                 $this->events[$section] = array_merge($this->events[$section], $events);
232 232
             }
233 233
         }
@@ -240,45 +240,45 @@  discard block
 block discarded – undo
240 240
      * @throws MaskNotFoundException
241 241
      */
242 242
     protected function setMaskFromConfig($config) {
243
-        $default_config  = ClientManager::get("masks");
243
+        $default_config = ClientManager::get("masks");
244 244
 
245
-        if(isset($config['masks'])){
246
-            if(isset($config['masks']['message'])) {
247
-                if(class_exists($config['masks']['message'])) {
245
+        if (isset($config['masks'])) {
246
+            if (isset($config['masks']['message'])) {
247
+                if (class_exists($config['masks']['message'])) {
248 248
                     $this->default_message_mask = $config['masks']['message'];
249
-                }else{
249
+                }else {
250 250
                     throw new MaskNotFoundException("Unknown mask provided: ".$config['masks']['message']);
251 251
                 }
252
-            }else{
253
-                if(class_exists($default_config['message'])) {
252
+            }else {
253
+                if (class_exists($default_config['message'])) {
254 254
                     $this->default_message_mask = $default_config['message'];
255
-                }else{
255
+                }else {
256 256
                     throw new MaskNotFoundException("Unknown mask provided: ".$default_config['message']);
257 257
                 }
258 258
             }
259
-            if(isset($config['masks']['attachment'])) {
260
-                if(class_exists($config['masks']['attachment'])) {
259
+            if (isset($config['masks']['attachment'])) {
260
+                if (class_exists($config['masks']['attachment'])) {
261 261
                     $this->default_attachment_mask = $config['masks']['attachment'];
262
-                }else{
262
+                }else {
263 263
                     throw new MaskNotFoundException("Unknown mask provided: ".$config['masks']['attachment']);
264 264
                 }
265
-            }else{
266
-                if(class_exists($default_config['attachment'])) {
265
+            }else {
266
+                if (class_exists($default_config['attachment'])) {
267 267
                     $this->default_attachment_mask = $default_config['attachment'];
268
-                }else{
268
+                }else {
269 269
                     throw new MaskNotFoundException("Unknown mask provided: ".$default_config['attachment']);
270 270
                 }
271 271
             }
272
-        }else{
273
-            if(class_exists($default_config['message'])) {
272
+        }else {
273
+            if (class_exists($default_config['message'])) {
274 274
                 $this->default_message_mask = $default_config['message'];
275
-            }else{
275
+            }else {
276 276
                 throw new MaskNotFoundException("Unknown mask provided: ".$default_config['message']);
277 277
             }
278 278
 
279
-            if(class_exists($default_config['attachment'])) {
279
+            if (class_exists($default_config['attachment'])) {
280 280
                 $this->default_attachment_mask = $default_config['attachment'];
281
-            }else{
281
+            }else {
282 282
                 throw new MaskNotFoundException("Unknown mask provided: ".$default_config['attachment']);
283 283
             }
284 284
         }
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
             $this->connection = new ImapProtocol($this->validate_cert, $this->encryption);
343 343
             $this->connection->setConnectionTimeout($this->timeout);
344 344
             $this->connection->setProxy($this->proxy);
345
-        }else{
345
+        }else {
346 346
             if (extension_loaded('imap') === false) {
347 347
                 throw new ConnectionFailedException("connection setup failed", 0, new ProtocolNotSupportedException($protocol." is an unsupported protocol"));
348 348
             }
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
 
424 424
         // Set delimiter to false to force selection via getFolderByName (maybe useful for uncommon folder names)
425 425
         $delimiter = is_null($delimiter) ? ClientManager::get('options.delimiter', "/") : $delimiter;
426
-        if (strpos($folder_name, (string)$delimiter) !== false) {
426
+        if (strpos($folder_name, (string) $delimiter) !== false) {
427 427
             return $this->getFolderByPath($folder_name);
428 428
         }
429 429
 
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
         $pattern = $parent_folder.($hierarchical ? '%' : '*');
476 476
         $items = $this->connection->folders('', $pattern);
477 477
 
478
-        if(is_array($items)){
478
+        if (is_array($items)) {
479 479
             foreach ($items as $folder_name => $item) {
480 480
                 $folder = new Folder($this, $folder_name, $item["delimiter"], $item["flags"]);
481 481
 
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
             }
491 491
 
492 492
             return $folders;
493
-        }else{
493
+        }else {
494 494
             throw new FolderFetchingException("failed to fetch any folders");
495 495
         }
496 496
     }
@@ -528,10 +528,10 @@  discard block
 block discarded – undo
528 528
         $this->checkConnection();
529 529
         $status = $this->connection->createFolder($folder);
530 530
 
531
-        if($expunge) $this->expunge();
531
+        if ($expunge) $this->expunge();
532 532
 
533 533
         $folder = $this->getFolder($folder);
534
-        if($status && $folder) {
534
+        if ($status && $folder) {
535 535
             $event = $this->getEvent("folder", "new");
536 536
             $event::dispatch($folder);
537 537
         }
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
      *
558 558
      * @return string
559 559
      */
560
-    public function getFolderPath(){
560
+    public function getFolderPath() {
561 561
         return $this->active_folder;
562 562
     }
563 563
 
@@ -662,7 +662,7 @@  discard block
 block discarded – undo
662 662
      * @throws MaskNotFoundException
663 663
      */
664 664
     public function setDefaultMessageMask(string $mask): Client {
665
-        if(class_exists($mask)) {
665
+        if (class_exists($mask)) {
666 666
             $this->default_message_mask = $mask;
667 667
 
668 668
             return $this;
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
      * @throws MaskNotFoundException
689 689
      */
690 690
     public function setDefaultAttachmentMask(string $mask): Client {
691
-        if(class_exists($mask)) {
691
+        if (class_exists($mask)) {
692 692
             $this->default_attachment_mask = $mask;
693 693
 
694 694
             return $this;
Please login to merge, or discard this patch.
src/Connection/Protocols/LegacyProtocol.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -89,16 +89,16 @@  discard block
 block discarded – undo
89 89
             throw new AuthFailedException($message);
90 90
         }
91 91
 
92
-        if(!$this->stream) {
92
+        if (!$this->stream) {
93 93
             $errors = \imap_errors();
94 94
             $message = implode("; ", (is_array($errors) ? $errors : array()));
95 95
             throw new AuthFailedException($message);
96 96
         }
97 97
 
98 98
         $errors = \imap_errors();
99
-        if(is_array($errors)) {
99
+        if (is_array($errors)) {
100 100
             $status = $this->examineFolder();
101
-            if($status['exists'] !== 0) {
101
+            if ($status['exists'] !== 0) {
102 102
                 $message = implode("; ", (is_array($errors) ? $errors : array()));
103 103
                 throw new RuntimeException($message);
104 104
             }
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
         if (!$this->cert_validation) {
130 130
             $address .= '/novalidate-cert';
131 131
         }
132
-        if (in_array($this->encryption,['tls', 'notls', 'ssl'])) {
132
+        if (in_array($this->encryption, ['tls', 'notls', 'ssl'])) {
133 133
             $address .= '/'.$this->encryption;
134 134
         } elseif ($this->encryption === "starttls") {
135 135
             $address .= '/tls';
@@ -257,8 +257,8 @@  discard block
 block discarded – undo
257 257
             $flags = [];
258 258
             if (is_array($raw_flags) && isset($raw_flags[0])) {
259 259
                 $raw_flags = (array) $raw_flags[0];
260
-                foreach($raw_flags as $flag => $value) {
261
-                    if ($value === 1 && in_array($flag, ["size", "uid", "msgno", "update"]) === false){
260
+                foreach ($raw_flags as $flag => $value) {
261
+                    if ($value === 1 && in_array($flag, ["size", "uid", "msgno", "update"]) === false) {
262 262
                         $flags[] = "\\".ucfirst($flag);
263 263
                     }
264 264
                 }
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 
284 284
             $overview = $this->overview("1:*");
285 285
             $uids = [];
286
-            foreach($overview as $set){
286
+            foreach ($overview as $set) {
287 287
                 $uids[$set->msgno] = $set->uid;
288 288
             }
289 289
 
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
      * @return array
313 313
      */
314 314
     public function overview(string $sequence, $uid = IMAP::ST_UID): array {
315
-        return \imap_fetch_overview($this->stream, $sequence,$uid ? IMAP::ST_UID : IMAP::NIL);
315
+        return \imap_fetch_overview($this->stream, $sequence, $uid ? IMAP::ST_UID : IMAP::NIL);
316 316
     }
317 317
 
318 318
     /**
@@ -327,12 +327,12 @@  discard block
 block discarded – undo
327 327
         $result = [];
328 328
 
329 329
         $items = \imap_getmailboxes($this->stream, $this->getAddress(), $reference.$folder);
330
-        if(is_array($items)){
330
+        if (is_array($items)) {
331 331
             foreach ($items as $item) {
332 332
                 $name = $this->decodeFolderName($item->name);
333 333
                 $result[$name] = ['delimiter' => $item->delimiter, 'flags' => []];
334 334
             }
335
-        }else{
335
+        }else {
336 336
             throw new RuntimeException(\imap_last_error());
337 337
         }
338 338
 
@@ -355,9 +355,9 @@  discard block
 block discarded – undo
355 355
     public function store(array $flags, int $from, $to = null, $mode = null, bool $silent = true, $uid = IMAP::ST_UID, $item = null) {
356 356
         $flag = trim(is_array($flags) ? implode(" ", $flags) : $flags);
357 357
 
358
-        if ($mode == "+"){
358
+        if ($mode == "+") {
359 359
             $status = \imap_setflag_full($this->stream, $from, $flag, $uid ? IMAP::ST_UID : IMAP::NIL);
360
-        }else{
360
+        }else {
361 361
             $status = \imap_clearflag_full($this->stream, $from, $flag, $uid ? IMAP::ST_UID : IMAP::NIL);
362 362
         }
363 363
 
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
      */
380 380
     public function appendMessage(string $folder, string $message, $flags = null, $date = null): bool {
381 381
         if ($date != null) {
382
-            if ($date instanceof \Carbon\Carbon){
382
+            if ($date instanceof \Carbon\Carbon) {
383 383
                 $date = $date->format('d-M-Y H:i:s O');
384 384
             }
385 385
             return \imap_append($this->stream, $folder, $message, $flags, $date);
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
      * @return array|bool Tokens if operation successful, false if an error occurred
412 412
      */
413 413
     public function copyManyMessages(array $messages, string $folder, $uid = IMAP::ST_UID) {
414
-        foreach($messages as $msg) {
414
+        foreach ($messages as $msg) {
415 415
             if ($this->copyMessage($folder, $msg, null, $uid) == false) {
416 416
                 return false;
417 417
             }
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
      * @return array|bool Tokens if operation successful, false if an error occurred
444 444
      */
445 445
     public function moveManyMessages(array $messages, string $folder, $uid = IMAP::ST_UID) {
446
-        foreach($messages as $msg) {
446
+        foreach ($messages as $msg) {
447 447
             if ($this->moveMessage($folder, $msg, null, $uid) == false) {
448 448
                 return false;
449 449
             }
@@ -570,14 +570,14 @@  discard block
 block discarded – undo
570 570
     /**
571 571
      * Enable the debug mode
572 572
      */
573
-    public function enableDebug(){
573
+    public function enableDebug() {
574 574
         $this->debug = true;
575 575
     }
576 576
 
577 577
     /**
578 578
      * Disable the debug mode
579 579
      */
580
-    public function disableDebug(){
580
+    public function disableDebug() {
581 581
         $this->debug = false;
582 582
     }
583 583
 
Please login to merge, or discard this patch.
src/Support/Masks/Mask.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
64 64
      * @throws MethodNotFoundException
65 65
      */
66 66
     public function __call(string $method, array $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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
121 121
      *
122 122
      * @return object
123 123
      */
124
-    public function getParent(){
124
+    public function getParent() {
125 125
         return $this->parent;
126 126
     }
127 127
 
Please login to merge, or discard this patch.
src/Message.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
         $this->boot();
192 192
 
193 193
         $default_mask = $client->getDefaultMessageMask();
194
-        if($default_mask != null) {
194
+        if ($default_mask != null) {
195 195
             $this->mask = $default_mask;
196 196
         }
197 197
         $this->events["message"] = $client->getDefaultEvents("message");
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
         $instance->boot();
253 253
 
254 254
         $default_mask = $client->getDefaultMessageMask();
255
-        if($default_mask != null) {
255
+        if ($default_mask != null) {
256 256
             $instance->setMask($default_mask);
257 257
         }
258 258
         $instance->setEvents([
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
     /**
278 278
      * Boot a new instance
279 279
      */
280
-    public function boot(){
280
+    public function boot() {
281 281
         $this->attributes = [];
282 282
 
283 283
         $this->config = ClientManager::get('options');
@@ -296,13 +296,13 @@  discard block
 block discarded – undo
296 296
      * @throws MethodNotFoundException
297 297
      */
298 298
     public function __call(string $method, array $arguments) {
299
-        if(strtolower(substr($method, 0, 3)) === 'get') {
299
+        if (strtolower(substr($method, 0, 3)) === 'get') {
300 300
             $name = Str::snake(substr($method, 3));
301 301
             return $this->get($name);
302 302
         }elseif (strtolower(substr($method, 0, 3)) === 'set') {
303 303
             $name = Str::snake(substr($method, 3));
304 304
 
305
-            if(in_array($name, array_keys($this->attributes))) {
305
+            if (in_array($name, array_keys($this->attributes))) {
306 306
                 return $this->__set($name, array_pop($arguments));
307 307
             }
308 308
 
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
      * @return Attribute|mixed|null
342 342
      */
343 343
     public function get($name) {
344
-        if(isset($this->attributes[$name])) {
344
+        if (isset($this->attributes[$name])) {
345 345
             return $this->attributes[$name];
346 346
         }
347 347
 
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
      *
416 416
      * @throws InvalidMessageDateException
417 417
      */
418
-    public function parseRawHeader(string $raw_header){
418
+    public function parseRawHeader(string $raw_header) {
419 419
         $this->header = new Header($raw_header);
420 420
     }
421 421
 
@@ -426,8 +426,8 @@  discard block
 block discarded – undo
426 426
     public function parseRawFlags(array $raw_flags) {
427 427
         $this->flags = FlagCollection::make([]);
428 428
 
429
-        foreach($raw_flags as $flag) {
430
-            if (strpos($flag, "\\") === 0){
429
+        foreach ($raw_flags as $flag) {
430
+            if (strpos($flag, "\\") === 0) {
431 431
                 $flag = substr($flag, 1);
432 432
             }
433 433
             $flag_key = strtolower($flag);
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
      * @throws MessageFlagException
501 501
      * @throws Exceptions\RuntimeException
502 502
      */
503
-    public function peek(){
503
+    public function peek() {
504 504
         if ($this->fetch_options == IMAP::FT_PEEK) {
505 505
             if ($this->getFlags()->get("seen") == null) {
506 506
                 $this->unsetFlag("Seen");
@@ -549,7 +549,7 @@  discard block
 block discarded – undo
549 549
     private function fetchPart(Part $part) {
550 550
         if ($part->isAttachment()) {
551 551
             $this->fetchAttachment($part);
552
-        }else{
552
+        }else {
553 553
             $encoding = $this->getEncoding($part);
554 554
 
555 555
             $content = $this->decodeString($part->content, $part->encoding);
@@ -574,7 +574,7 @@  discard block
 block discarded – undo
574 574
 
575 575
             if (isset($this->bodies[$subtype])) {
576 576
                 $this->bodies[$subtype] .= "\n".$content;
577
-            }else{
577
+            }else {
578 578
                 $this->bodies[$subtype] = $content;
579 579
             }
580 580
         }
@@ -590,7 +590,7 @@  discard block
 block discarded – undo
590 590
         if ($oAttachment->getName() !== null && $oAttachment->getSize() > 0) {
591 591
             if ($oAttachment->getId() !== null) {
592 592
                 $this->attachments->put($oAttachment->getId(), $oAttachment);
593
-            } else {
593
+            }else {
594 594
                 $this->attachments->push($oAttachment);
595 595
             }
596 596
         }
@@ -724,7 +724,7 @@  discard block
 block discarded – undo
724 724
 
725 725
         if (function_exists('iconv') && $from != 'UTF-7' && $to != 'UTF-7') {
726 726
             return @iconv($from, $to.'//IGNORE', $str);
727
-        } else {
727
+        }else {
728 728
             if (!$from) {
729 729
                 return mb_convert_encoding($str, $to);
730 730
             }
@@ -745,9 +745,9 @@  discard block
 block discarded – undo
745 745
                     return EncodingAliases::get($parameter->value, "ISO-8859-2");
746 746
                 }
747 747
             }
748
-        }elseif (property_exists($structure, 'charset')){
748
+        }elseif (property_exists($structure, 'charset')) {
749 749
             return EncodingAliases::get($structure->charset, "ISO-8859-2");
750
-        }elseif (is_string($structure) === true){
750
+        }elseif (is_string($structure) === true) {
751 751
             return mb_detect_encoding($structure);
752 752
         }
753 753
 
@@ -762,7 +762,7 @@  discard block
 block discarded – undo
762 762
      * @throws Exceptions\FolderFetchingException
763 763
      * @throws Exceptions\RuntimeException
764 764
      */
765
-    public function getFolder(){
765
+    public function getFolder() {
766 766
         return $this->client->getFolderByPath($this->folder_path);
767 767
     }
768 768
 
@@ -778,13 +778,13 @@  discard block
 block discarded – undo
778 778
      * @throws Exceptions\GetMessagesFailedException
779 779
      * @throws Exceptions\RuntimeException
780 780
      */
781
-    public function thread(Folder $sent_folder = null, MessageCollection &$thread = null, Folder $folder = null): MessageCollection {
781
+    public function thread(Folder $sent_folder = null, MessageCollection & $thread = null, Folder $folder = null): MessageCollection {
782 782
         $thread = $thread ?: MessageCollection::make([]);
783
-        $folder = $folder ?:  $this->getFolder();
783
+        $folder = $folder ?: $this->getFolder();
784 784
         $sent_folder = $sent_folder ?: $this->client->getFolderByPath(ClientManager::get("options.common_folders.sent", "INBOX/Sent"));
785 785
 
786 786
         /** @var Message $message */
787
-        foreach($thread as $message) {
787
+        foreach ($thread as $message) {
788 788
             if ($message->message_id->first() == $this->message_id->first()) {
789 789
                 return $thread;
790 790
             }
@@ -795,7 +795,7 @@  discard block
 block discarded – undo
795 795
         $this->fetchThreadByInReplyTo($thread, $this->message_id, $sent_folder, $folder, $sent_folder);
796 796
 
797 797
         if (is_array($this->in_reply_to)) {
798
-            foreach($this->in_reply_to as $in_reply_to) {
798
+            foreach ($this->in_reply_to as $in_reply_to) {
799 799
                 $this->fetchThreadByMessageId($thread, $in_reply_to, $folder, $folder, $sent_folder);
800 800
                 $this->fetchThreadByMessageId($thread, $in_reply_to, $sent_folder, $folder, $sent_folder);
801 801
             }
@@ -817,7 +817,7 @@  discard block
 block discarded – undo
817 817
      * @throws Exceptions\RuntimeException
818 818
      * @throws Exceptions\FolderFetchingException
819 819
      */
820
-    protected function fetchThreadByInReplyTo(MessageCollection &$thread, string $in_reply_to, Folder $primary_folder, Folder $secondary_folder, Folder $sent_folder){
820
+    protected function fetchThreadByInReplyTo(MessageCollection & $thread, string $in_reply_to, Folder $primary_folder, Folder $secondary_folder, Folder $sent_folder) {
821 821
         $primary_folder->query()->inReplyTo($in_reply_to)
822 822
         ->setFetchBody($this->getFetchBodyOption())
823 823
         ->leaveUnread()->get()->each(function($message) use(&$thread, $secondary_folder, $sent_folder){
@@ -839,7 +839,7 @@  discard block
 block discarded – undo
839 839
      * @throws Exceptions\RuntimeException
840 840
      * @throws Exceptions\FolderFetchingException
841 841
      */
842
-    protected function fetchThreadByMessageId(MessageCollection &$thread, string $message_id, Folder $primary_folder, Folder $secondary_folder, Folder $sent_folder){
842
+    protected function fetchThreadByMessageId(MessageCollection & $thread, string $message_id, Folder $primary_folder, Folder $secondary_folder, Folder $sent_folder) {
843 843
         $primary_folder->query()->messageId($message_id)
844 844
         ->setFetchBody($this->getFetchBodyOption())
845 845
         ->leaveUnread()->get()->each(function($message) use(&$thread, $secondary_folder, $sent_folder){
@@ -936,13 +936,13 @@  discard block
 block discarded – undo
936 936
      * @throws MessageHeaderFetchingException
937 937
      */
938 938
     protected function fetchNewMail(Folder $folder, int $next_uid, string $event, bool $expunge): Message {
939
-        if($expunge) $this->client->expunge();
939
+        if ($expunge) $this->client->expunge();
940 940
 
941 941
         $this->client->openFolder($folder->path);
942 942
 
943 943
         if ($this->sequence === IMAP::ST_UID) {
944 944
             $sequence_id = $next_uid;
945
-        }else{
945
+        }else {
946 946
             $sequence_id = $this->client->getConnection()->getMessageNumber($next_uid);
947 947
         }
948 948
 
@@ -972,11 +972,11 @@  discard block
 block discarded – undo
972 972
      */
973 973
     public function delete(bool $expunge = true, string $trash_path = null, bool $force_move = false) {
974 974
         $status = $this->setFlag("Deleted");
975
-        if($force_move) {
976
-            $trash_path = $trash_path === null ? $this->config["common_folders"]["trash"]: $trash_path;
975
+        if ($force_move) {
976
+            $trash_path = $trash_path === null ? $this->config["common_folders"]["trash"] : $trash_path;
977 977
             $status = $this->move($trash_path);
978 978
         }
979
-        if($expunge) $this->client->expunge();
979
+        if ($expunge) $this->client->expunge();
980 980
 
981 981
         $event = $this->getEvent("message", "deleted");
982 982
         $event::dispatch($this);
@@ -996,7 +996,7 @@  discard block
 block discarded – undo
996 996
      */
997 997
     public function restore(bool $expunge = true): bool {
998 998
         $status = $this->unsetFlag("Deleted");
999
-        if($expunge) $this->client->expunge();
999
+        if ($expunge) $this->client->expunge();
1000 1000
 
1001 1001
         $event = $this->getEvent("message", "restored");
1002 1002
         $event::dispatch($this);
@@ -1208,7 +1208,7 @@  discard block
 block discarded – undo
1208 1208
      *
1209 1209
      * @return Structure|null
1210 1210
      */
1211
-    public function getStructure(){
1211
+    public function getStructure() {
1212 1212
         return $this->structure;
1213 1213
     }
1214 1214
 
@@ -1245,7 +1245,7 @@  discard block
 block discarded – undo
1245 1245
      * @return $this
1246 1246
      */
1247 1247
     public function setMask($mask): Message {
1248
-        if(class_exists($mask)){
1248
+        if (class_exists($mask)) {
1249 1249
             $this->mask = $mask;
1250 1250
         }
1251 1251
 
@@ -1268,9 +1268,9 @@  discard block
 block discarded – undo
1268 1268
      * @return mixed
1269 1269
      * @throws MaskNotFoundException
1270 1270
      */
1271
-    public function mask($mask = null){
1271
+    public function mask($mask = null) {
1272 1272
         $mask = $mask !== null ? $mask : $this->mask;
1273
-        if(class_exists($mask)){
1273
+        if (class_exists($mask)) {
1274 1274
             return new $mask($this);
1275 1275
         }
1276 1276
 
@@ -1420,11 +1420,11 @@  discard block
 block discarded – undo
1420 1420
      * @throws Exceptions\ConnectionFailedException
1421 1421
      * @throws Exceptions\MessageNotFoundException
1422 1422
      */
1423
-    public function setSequenceId($uid, int $msglist = null){
1423
+    public function setSequenceId($uid, int $msglist = null) {
1424 1424
         if ($this->getSequence() === IMAP::ST_UID) {
1425 1425
             $this->setUid($uid);
1426 1426
             $this->setMsglist($msglist);
1427
-        }else{
1427
+        }else {
1428 1428
             $this->setMsgn($uid, $msglist);
1429 1429
         }
1430 1430
     }
Please login to merge, or discard this patch.