Passed
Push — master ( 4dc410...354c27 )
by Malte
03:19
created
src/Attachment.php 2 patches
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
         $this->part_number = $part->part_number;
105 105
 
106 106
         $default_mask = $this->oMessage->getClient()->getDefaultAttachmentMask();
107
-        if($default_mask != null) {
107
+        if ($default_mask != null) {
108 108
             $this->mask = $default_mask;
109 109
         }
110 110
 
@@ -121,10 +121,10 @@  discard block
 block discarded – undo
121 121
      * @throws MethodNotFoundException
122 122
      */
123 123
     public function __call($method, $arguments) {
124
-        if(strtolower(substr($method, 0, 3)) === 'get') {
124
+        if (strtolower(substr($method, 0, 3)) === 'get') {
125 125
             $name = Str::snake(substr($method, 3));
126 126
 
127
-            if(isset($this->attributes[$name])) {
127
+            if (isset($this->attributes[$name])) {
128 128
                 return $this->attributes[$name];
129 129
             }
130 130
 
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
      * @return mixed|null
161 161
      */
162 162
     public function __get($name) {
163
-        if(isset($this->attributes[$name])) {
163
+        if (isset($this->attributes[$name])) {
164 164
             return $this->attributes[$name];
165 165
         }
166 166
 
@@ -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
             return $deprecated_guesser::getInstance()->guess($this->getMimeType());
284 284
         }
285 285
         $guesser = "\Symfony\Component\Mime\MimeTypes";
@@ -292,14 +292,14 @@  discard block
 block discarded – undo
292 292
      *
293 293
      * @return array
294 294
      */
295
-    public function getAttributes(){
295
+    public function getAttributes() {
296 296
         return $this->attributes;
297 297
     }
298 298
 
299 299
     /**
300 300
      * @return Message
301 301
      */
302
-    public function getMessage(){
302
+    public function getMessage() {
303 303
         return $this->oMessage;
304 304
     }
305 305
 
@@ -309,8 +309,8 @@  discard block
 block discarded – undo
309 309
      *
310 310
      * @return $this
311 311
      */
312
-    public function setMask($mask){
313
-        if(class_exists($mask)){
312
+    public function setMask($mask) {
313
+        if (class_exists($mask)) {
314 314
             $this->mask = $mask;
315 315
         }
316 316
 
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
      *
323 323
      * @return string
324 324
      */
325
-    public function getMask(){
325
+    public function getMask() {
326 326
         return $this->mask;
327 327
     }
328 328
 
@@ -333,9 +333,9 @@  discard block
 block discarded – undo
333 333
      * @return mixed
334 334
      * @throws MaskNotFoundException
335 335
      */
336
-    public function mask($mask = null){
336
+    public function mask($mask = null) {
337 337
         $mask = $mask !== null ? $mask : $this->mask;
338
-        if(class_exists($mask)){
338
+        if (class_exists($mask)) {
339 339
             return new $mask($this);
340 340
         }
341 341
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
             }
129 129
 
130 130
             return null;
131
-        }elseif (strtolower(substr($method, 0, 3)) === 'set') {
131
+        } elseif (strtolower(substr($method, 0, 3)) === 'set') {
132 132
             $name = Str::snake(substr($method, 3));
133 133
 
134 134
             $this->attributes[$name] = array_pop($arguments);
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
             $this->setName($filename);
223 223
         } elseif (($name = $this->part->name) !== null) {
224 224
             $this->setName($name);
225
-        }else {
225
+        } else {
226 226
             $this->setName("undefined");
227 227
         }
228 228
 
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
         if ($name !== null) {
258 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
         }
Please login to merge, or discard this patch.
src/Folder.php 2 patches
Braces   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -232,7 +232,9 @@  discard block
 block discarded – undo
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) {
236
+            $this->client->expunge();
237
+        }
236 238
 
237 239
         $folder = $this->client->getFolder($new_name);
238 240
         $event = $this->getEvent("folder", "moved");
@@ -306,7 +308,9 @@  discard block
 block discarded – undo
306 308
      */
307 309
     public function delete($expunge = true) {
308 310
         $status = $this->client->getConnection()->deleteFolder($this->path);
309
-        if($expunge) $this->client->expunge();
311
+        if($expunge) {
312
+            $this->client->expunge();
313
+        }
310 314
 
311 315
         $event = $this->getEvent("folder", "deleted");
312 316
         $event::dispatch($this);
@@ -374,7 +378,7 @@  discard block
 block discarded – undo
374 378
 
375 379
                     $connection->idle();
376 380
                 }
377
-            }catch (Exceptions\RuntimeException $e) {
381
+            } catch (Exceptions\RuntimeException $e) {
378 382
                 if(strpos($e->getMessage(), "connection closed") === false) {
379 383
                     throw $e;
380 384
                 }
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 
123 123
         $this->setDelimiter($delimiter);
124 124
         $this->path      = $folder_name;
125
-        $this->full_name  = $this->decodeName($folder_name);
125
+        $this->full_name = $this->decodeName($folder_name);
126 126
         $this->name      = $this->getSimpleName($this->delimiter, $this->full_name);
127 127
 
128 128
         $this->parseAttributes($attributes);
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
      * @throws Exceptions\ConnectionFailedException
137 137
      * @throws Exceptions\RuntimeException
138 138
      */
139
-    public function query($extensions = []){
139
+    public function query($extensions = []) {
140 140
         $this->getClient()->checkConnection();
141 141
         $this->getClient()->openFolder($this->path);
142 142
         $extensions = count($extensions) > 0 ? $extensions : $this->getClient()->extensions;
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
      * @throws Exceptions\ConnectionFailedException
150 150
      * @throws Exceptions\RuntimeException
151 151
      */
152
-    public function search($extensions = 'UTF-8'){
152
+    public function search($extensions = 'UTF-8') {
153 153
         return $this->query($extensions);
154 154
     }
155 155
 
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
      * @throws Exceptions\ConnectionFailedException
159 159
      * @throws Exceptions\RuntimeException
160 160
      */
161
-    public function messages($extensions = []){
161
+    public function messages($extensions = []) {
162 162
         return $this->query($extensions);
163 163
     }
164 164
 
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
     public function move($new_name, $expunge = true) {
234 234
         $this->client->checkConnection();
235 235
         $status = $this->client->getConnection()->renameFolder($this->full_name, $new_name);
236
-        if($expunge) $this->client->expunge();
236
+        if ($expunge) $this->client->expunge();
237 237
 
238 238
         $folder = $this->client->getFolder($new_name);
239 239
         $event = $this->getEvent("folder", "moved");
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
      * @throws Exceptions\MessageNotFoundException
253 253
      * @throws Exceptions\RuntimeException
254 254
      */
255
-    public function overview($sequence = null){
255
+    public function overview($sequence = null) {
256 256
         $this->client->openFolder($this->path);
257 257
         $sequence = $sequence === null ? "1:*" : $sequence;
258 258
         $uid = ClientManager::get('options.sequence', IMAP::ST_MSGN) == IMAP::ST_UID;
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
          */
278 278
 
279 279
         if ($internal_date != null) {
280
-            if ($internal_date instanceof Carbon){
280
+            if ($internal_date instanceof Carbon) {
281 281
                 $internal_date = $internal_date->format('d-M-Y H:i:s O');
282 282
             }
283 283
         }
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
      */
312 312
     public function delete($expunge = true) {
313 313
         $status = $this->client->getConnection()->deleteFolder($this->path);
314
-        if($expunge) $this->client->expunge();
314
+        if ($expunge) $this->client->expunge();
315 315
 
316 316
         $event = $this->getEvent("folder", "deleted");
317 317
         $event::dispatch($this);
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
             try {
373 373
                 $line = $connection->nextLine();
374 374
                 if (($pos = strpos($line, "EXISTS")) !== false) {
375
-                    $msgn = (int) substr($line, 2, $pos -2);
375
+                    $msgn = (int) substr($line, 2, $pos - 2);
376 376
                     $connection->done();
377 377
 
378 378
                     $this->client->openFolder($this->path, true);
@@ -385,8 +385,8 @@  discard block
 block discarded – undo
385 385
 
386 386
                     $connection->idle();
387 387
                 }
388
-            }catch (Exceptions\RuntimeException $e) {
389
-                if(strpos($e->getMessage(), "connection closed") === false) {
388
+            } catch (Exceptions\RuntimeException $e) {
389
+                if (strpos($e->getMessage(), "connection closed") === false) {
390 390
                     throw $e;
391 391
                 }
392 392
                 if ($auto_reconnect === true) {
@@ -435,8 +435,8 @@  discard block
 block discarded – undo
435 435
      * Set the delimiter
436 436
      * @param $delimiter
437 437
      */
438
-    public function setDelimiter($delimiter){
439
-        if(in_array($delimiter, [null, '', ' ', false]) === true) {
438
+    public function setDelimiter($delimiter) {
439
+        if (in_array($delimiter, [null, '', ' ', false]) === true) {
440 440
             $delimiter = ClientManager::get('options.delimiter', '/');
441 441
         }
442 442
 
Please login to merge, or discard this patch.
src/Address.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -44,11 +44,11 @@  discard block
 block discarded – undo
44 44
      * @param object   $object
45 45
      */
46 46
     public function __construct($object) {
47
-        if (property_exists($object, "personal")){ $this->personal = $object->personal; }
48
-        if (property_exists($object, "mailbox")){ $this->mailbox = $object->mailbox; }
49
-        if (property_exists($object, "host")){ $this->host = $object->host; }
50
-        if (property_exists($object, "mail")){ $this->mail = $object->mail; }
51
-        if (property_exists($object, "full")){ $this->full = $object->full; }
47
+        if (property_exists($object, "personal")) { $this->personal = $object->personal; }
48
+        if (property_exists($object, "mailbox")) { $this->mailbox = $object->mailbox; }
49
+        if (property_exists($object, "host")) { $this->host = $object->host; }
50
+        if (property_exists($object, "mail")) { $this->mail = $object->mail; }
51
+        if (property_exists($object, "full")) { $this->full = $object->full; }
52 52
     }
53 53
 
54 54
 
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
      *
67 67
      * @return array
68 68
      */
69
-    public function __serialize(){
69
+    public function __serialize() {
70 70
         return [
71 71
             "personal" => $this->personal,
72 72
             "mailbox" => $this->mailbox,
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
      *
82 82
      * @return array
83 83
      */
84
-    public function toArray(){
84
+    public function toArray() {
85 85
         return $this->__serialize();
86 86
     }
87 87
 
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
      *
91 91
      * @return string
92 92
      */
93
-    public function toString(){
93
+    public function toString() {
94 94
         return $this->__toString();
95 95
     }
96 96
 }
97 97
\ No newline at end of file
Please login to merge, or discard this patch.
src/Connection/Protocols/ImapProtocol.php 2 patches
Braces   +13 added lines, -6 removed lines patch added patch discarded remove patch
@@ -233,7 +233,9 @@  discard block
 block discarded – undo
233 233
         } else {
234 234
             $tokens = $line;
235 235
         }
236
-        if ($this->debug) echo "<< ".$line."\n";
236
+        if ($this->debug) {
237
+            echo "<< ".$line."\n";
238
+        }
237 239
 
238 240
         // if tag is wanted tag we might be at the end of a multiline response
239 241
         return $tag == $wantedTag;
@@ -298,7 +300,9 @@  discard block
 block discarded – undo
298 300
                 $line .= ' ' . $token;
299 301
             }
300 302
         }
301
-        if ($this->debug) echo ">> ".$line."\n";
303
+        if ($this->debug) {
304
+            echo ">> ".$line."\n";
305
+        }
302 306
 
303 307
         if (fwrite($this->stream, $line . "\r\n") === false) {
304 308
             throw new RuntimeException('failed to write - connection closed?');
@@ -448,7 +452,9 @@  discard block
 block discarded – undo
448 452
     public function getCapabilities() {
449 453
         $response = $this->requestAndResponse('CAPABILITY');
450 454
 
451
-        if (!$response) return [];
455
+        if (!$response) {
456
+            return [];
457
+        }
452 458
 
453 459
         $capabilities = [];
454 460
         foreach ($response as $line) {
@@ -605,13 +611,14 @@  discard block
 block discarded – undo
605 611
             // if we want only one message we can ignore everything else and just return
606 612
             if ($to === null && !is_array($from) && ($uid ? $tokens[2][$uidKey] == $from : $tokens[0] == $from)) {
607 613
                 // we still need to read all lines
608
-                while (!$this->readLine($tokens, $tag))
609
-
614
+                while (!$this->readLine($tokens, $tag)) {
615
+                
610 616
                     return $data;
617
+                }
611 618
             }
612 619
             if ($uid) {
613 620
                 $result[$tokens[2][$uidKey]] = $data;
614
-            }else{
621
+            } else{
615 622
                 $result[$tokens[0]] = $data;
616 623
             }
617 624
         }
Please login to merge, or discard this patch.
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
      * @throws ConnectionFailedException
90 90
      * @throws RuntimeException
91 91
      */
92
-    protected function enableStartTls(){
92
+    protected function enableStartTls() {
93 93
         $response = $this->requestAndResponse('STARTTLS');
94 94
         $result = $response && stream_socket_enable_crypto($this->stream, true, $this->getCryptoMethod());
95 95
         if (!$result) {
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
         $stack = [];
152 152
 
153 153
         //  replace any trailing <NL> including spaces with a single space
154
-        $line = rtrim($line) . ' ';
154
+        $line = rtrim($line).' ';
155 155
         while (($pos = strpos($line, ' ')) !== false) {
156 156
             $token = substr($line, 0, $pos);
157 157
             if (!strlen($token)) {
@@ -181,11 +181,11 @@  discard block
 block discarded – undo
181 181
                     if (strlen($token) > $chars) {
182 182
                         $line = substr($token, $chars);
183 183
                         $token = substr($token, 0, $chars);
184
-                    } else {
184
+                    }else {
185 185
                         $line .= $this->nextLine();
186 186
                     }
187 187
                     $tokens[] = $token;
188
-                    $line = trim($line) . ' ';
188
+                    $line = trim($line).' ';
189 189
                     continue;
190 190
                 }
191 191
             }
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
         $line = $this->nextTaggedLine($tag); // get next tag
236 236
         if (!$dontParse) {
237 237
             $tokens = $this->decodeLine($line);
238
-        } else {
238
+        }else {
239 239
             $tokens = $line;
240 240
         }
241 241
         if ($this->debug) echo "<< ".$line."\n";
@@ -286,27 +286,27 @@  discard block
 block discarded – undo
286 286
     public function sendRequest($command, $tokens = [], &$tag = null) {
287 287
         if (!$tag) {
288 288
             $this->noun++;
289
-            $tag = 'TAG' . $this->noun;
289
+            $tag = 'TAG'.$this->noun;
290 290
         }
291 291
 
292
-        $line = $tag . ' ' . $command;
292
+        $line = $tag.' '.$command;
293 293
 
294 294
         foreach ($tokens as $token) {
295 295
             if (is_array($token)) {
296
-                if (fwrite($this->stream, $line . ' ' . $token[0] . "\r\n") === false) {
296
+                if (fwrite($this->stream, $line.' '.$token[0]."\r\n") === false) {
297 297
                     throw new RuntimeException('failed to write - connection closed?');
298 298
                 }
299 299
                 if (!$this->assumedNextLine('+ ')) {
300 300
                     throw new RuntimeException('failed to send literal string');
301 301
                 }
302 302
                 $line = $token[1];
303
-            } else {
304
-                $line .= ' ' . $token;
303
+            }else {
304
+                $line .= ' '.$token;
305 305
             }
306 306
         }
307 307
         if ($this->debug) echo ">> ".$line."\n";
308 308
 
309
-        if (fwrite($this->stream, $line . "\r\n") === false) {
309
+        if (fwrite($this->stream, $line."\r\n") === false) {
310 310
             throw new RuntimeException('failed to write - connection closed?');
311 311
         }
312 312
     }
@@ -336,9 +336,9 @@  discard block
 block discarded – undo
336 336
     public function escapeString($string) {
337 337
         if (func_num_args() < 2) {
338 338
             if (strpos($string, "\n") !== false) {
339
-                return ['{' . strlen($string) . '}', $string];
340
-            } else {
341
-                return '"' . str_replace(['\\', '"'], ['\\\\', '\\"'], $string) . '"';
339
+                return ['{'.strlen($string).'}', $string];
340
+            }else {
341
+                return '"'.str_replace(['\\', '"'], ['\\\\', '\\"'], $string).'"';
342 342
             }
343 343
         }
344 344
         $result = [];
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
             }
364 364
             $result[] = $this->escapeList($v);
365 365
         }
366
-        return '(' . implode(' ', $result) . ')';
366
+        return '('.implode(' ', $result).')';
367 367
     }
368 368
 
369 369
     /**
@@ -403,12 +403,12 @@  discard block
 block discarded – undo
403 403
                     error_log("got an extra server challenge: $response");
404 404
                     // respond with an empty response.
405 405
                     $this->sendRequest('');
406
-                } else {
406
+                }else {
407 407
                     if (preg_match('/^NO /i', $response) ||
408 408
                         preg_match('/^BAD /i', $response)) {
409 409
                         error_log("got failure response: $response");
410 410
                         return false;
411
-                    } else if (preg_match("/^OK /i", $response)) {
411
+                    }else if (preg_match("/^OK /i", $response)) {
412 412
                         return true;
413 413
                     }
414 414
                 }
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
      *
444 444
      * @return bool
445 445
      */
446
-    public function connected(){
446
+    public function connected() {
447 447
         return (boolean) $this->stream;
448 448
     }
449 449
 
@@ -490,10 +490,10 @@  discard block
 block discarded – undo
490 490
                     $result[strtolower($tokens[1])] = $tokens[0];
491 491
                     break;
492 492
                 case '[UIDVALIDITY':
493
-                    $result['uidvalidity'] = (int)$tokens[2];
493
+                    $result['uidvalidity'] = (int) $tokens[2];
494 494
                     break;
495 495
                 case '[UIDNEXT':
496
-                    $result['uidnext'] = (int)$tokens[2];
496
+                    $result['uidnext'] = (int) $tokens[2];
497 497
                     break;
498 498
                 default:
499 499
                     // ignore
@@ -550,14 +550,14 @@  discard block
 block discarded – undo
550 550
         if (is_array($from)) {
551 551
             $set = implode(',', $from);
552 552
         } elseif ($to === null) {
553
-            $set = (int)$from;
553
+            $set = (int) $from;
554 554
         } elseif ($to === INF) {
555
-            $set = (int)$from . ':*';
556
-        } else {
557
-            $set = (int)$from . ':' . (int)$to;
555
+            $set = (int) $from.':*';
556
+        }else {
557
+            $set = (int) $from.':'.(int) $to;
558 558
         }
559 559
 
560
-        $items = (array)$items;
560
+        $items = (array) $items;
561 561
         $itemList = $this->escapeList($items);
562 562
 
563 563
         $this->sendRequest($this->buildUIDCommand("FETCH", $uid), [$set, $itemList], $tag);
@@ -574,9 +574,9 @@  discard block
 block discarded – undo
574 574
                 $count = count($tokens[2]);
575 575
                 if ($tokens[2][$count - 2] == 'UID') {
576 576
                     $uidKey = $count - 1;
577
-                } else if ($tokens[2][0] == 'UID') {
577
+                }else if ($tokens[2][0] == 'UID') {
578 578
                     $uidKey = 1;
579
-                } else {
579
+                }else {
580 580
                     $uidKey = array_search('UID', $tokens[2]) + 1;
581 581
                 }
582 582
             }
@@ -592,7 +592,7 @@  discard block
 block discarded – undo
592 592
                     $data = $tokens[2][1];
593 593
                 } elseif ($uid && $tokens[2][2] == $items[0]) {
594 594
                     $data = $tokens[2][3];
595
-                } else {
595
+                }else {
596 596
                     // maybe the server send an other field we didn't wanted
597 597
                     $count = count($tokens[2]);
598 598
                     // we start with 2, because 0 was already checked
@@ -604,7 +604,7 @@  discard block
 block discarded – undo
604 604
                         break;
605 605
                     }
606 606
                 }
607
-            } else {
607
+            }else {
608 608
                 $data = [];
609 609
                 while (key($tokens[2]) !== null) {
610 610
                     $data[current($tokens[2])] = next($tokens[2]);
@@ -621,7 +621,7 @@  discard block
 block discarded – undo
621 621
             }
622 622
             if ($uid) {
623 623
                 $result[$tokens[2][$uidKey]] = $data;
624
-            }else{
624
+            }else {
625 625
                 $result[$tokens[0]] = $data;
626 626
             }
627 627
         }
@@ -657,7 +657,7 @@  discard block
 block discarded – undo
657 657
      * @return array
658 658
      * @throws RuntimeException
659 659
      */
660
-    public function headers($uids, $rfc = "RFC822", $uid = IMAP::ST_UID){
660
+    public function headers($uids, $rfc = "RFC822", $uid = IMAP::ST_UID) {
661 661
         return $this->fetch(["$rfc.HEADER"], $uids, null, $uid);
662 662
     }
663 663
 
@@ -670,7 +670,7 @@  discard block
 block discarded – undo
670 670
      * @return array
671 671
      * @throws RuntimeException
672 672
      */
673
-    public function flags($uids, $uid = IMAP::ST_UID){
673
+    public function flags($uids, $uid = IMAP::ST_UID) {
674 674
         return $this->fetch(["FLAGS"], $uids, null, $uid);
675 675
     }
676 676
 
@@ -685,7 +685,7 @@  discard block
 block discarded – undo
685 685
 
686 686
         if ($this->enable_uid_cache && $this->uid_cache) {
687 687
             $uids = $this->uid_cache;
688
-        } else {
688
+        }else {
689 689
             try {
690 690
                 $uids = $this->fetch('UID', 1, INF);
691 691
                 $this->setUidCache($uids); // set cache for this folder
@@ -779,7 +779,7 @@  discard block
 block discarded – undo
779 779
         $response = $this->requestAndResponse($command, [$set, $item, $flags], $silent);
780 780
 
781 781
         if ($silent) {
782
-            return (bool)$response;
782
+            return (bool) $response;
783 783
         }
784 784
 
785 785
         $result = [];
@@ -1080,7 +1080,7 @@  discard block
 block discarded – undo
1080 1080
         $ids = [];
1081 1081
         foreach ($uids as $msgn => $v) {
1082 1082
             $id = $uid ? $v : $msgn;
1083
-            if ( ($to >= $id && $from <= $id) || ($to === "*" && $from <= $id) ){
1083
+            if (($to >= $id && $from <= $id) || ($to === "*" && $from <= $id)) {
1084 1084
                 $ids[] = $id;
1085 1085
             }
1086 1086
         }
@@ -1094,14 +1094,14 @@  discard block
 block discarded – undo
1094 1094
     /**
1095 1095
      * Enable the debug mode
1096 1096
      */
1097
-    public function enableDebug(){
1097
+    public function enableDebug() {
1098 1098
         $this->debug = true;
1099 1099
     }
1100 1100
 
1101 1101
     /**
1102 1102
      * Disable the debug mode
1103 1103
      */
1104
-    public function disableDebug(){
1104
+    public function disableDebug() {
1105 1105
         $this->debug = false;
1106 1106
     }
1107 1107
 
@@ -1113,9 +1113,9 @@  discard block
 block discarded – undo
1113 1113
      * @return int|string
1114 1114
      */
1115 1115
     public function buildSet($from, $to = null) {
1116
-        $set = (int)$from;
1116
+        $set = (int) $from;
1117 1117
         if ($to !== null) {
1118
-            $set .= ':' . ($to == INF ? '*' : (int)$to);
1118
+            $set .= ':'.($to == INF ? '*' : (int) $to);
1119 1119
         }
1120 1120
         return $set;
1121 1121
     }
Please login to merge, or discard this patch.
src/Structure.php 2 patches
Spacing   +12 added lines, -12 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
     }
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
      * @return Part[]
104 104
      * @throws InvalidMessageDateException
105 105
      */
106
-    private function parsePart($context, $part_number = 0){
106
+    private function parsePart($context, $part_number = 0) {
107 107
         $body = $context;
108 108
         while (($pos = strpos($body, "\r\n")) > 0) {
109 109
             $body = substr($body, $pos + 2);
@@ -126,10 +126,10 @@  discard block
 block discarded – undo
126 126
      * @return array
127 127
      * @throws InvalidMessageDateException
128 128
      */
129
-    private function detectParts($boundary, $context, $part_number = 0){
130
-        $base_parts = explode( $boundary, $context);
129
+    private function detectParts($boundary, $context, $part_number = 0) {
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);
@@ -150,9 +150,9 @@  discard block
 block discarded – undo
150 150
      * @throws MessageContentFetchingException
151 151
      * @throws InvalidMessageDateException
152 152
      */
153
-    public function find_parts(){
154
-        if($this->type === IMAP::MESSAGE_TYPE_MULTIPART) {
155
-            if (($boundary = $this->header->getBoundary()) === null)  {
153
+    public function find_parts() {
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.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@
 block discarded – undo
90 90
         $content_type = (is_array($content_type)) ? implode(' ', $content_type) : $content_type;
91 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
     }
Please login to merge, or discard this patch.
src/Attribute.php 2 patches
Braces   +5 added lines, -3 removed lines patch added patch discarded remove patch
@@ -86,7 +86,9 @@  discard block
 block discarded – undo
86 86
      */
87 87
     public function toDate(){
88 88
         $date = $this->first();
89
-        if ($date instanceof Carbon) return $date;
89
+        if ($date instanceof Carbon) {
90
+            return $date;
91
+        }
90 92
 
91 93
         return Carbon::parse($date);
92 94
     }
@@ -146,7 +148,7 @@  discard block
 block discarded – undo
146 148
     public function add($value, $strict = false) {
147 149
         if (is_array($value)) {
148 150
             return $this->merge($value, $strict);
149
-        }elseif ($value !== null) {
151
+        } elseif ($value !== null) {
150 152
             $this->attach($value, $strict);
151 153
         }
152 154
 
@@ -195,7 +197,7 @@  discard block
 block discarded – undo
195 197
             if ($this->contains($value) === false) {
196 198
                 $this->values[] = $value;
197 199
             }
198
-        }else{
200
+        } else{
199 201
             $this->values[] = $value;
200 202
         }
201 203
     }
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
      *
58 58
      * @return string
59 59
      */
60
-    public function toString(){
60
+    public function toString() {
61 61
         return $this->__toString();
62 62
     }
63 63
 
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
      *
67 67
      * @return array
68 68
      */
69
-    public function toArray(){
69
+    public function toArray() {
70 70
         return $this->values;
71 71
     }
72 72
 
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
      *
76 76
      * @return Carbon|null
77 77
      */
78
-    public function toDate(){
78
+    public function toDate() {
79 79
         $date = $this->first();
80 80
         if ($date instanceof Carbon) return $date;
81 81
 
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
     public function offsetSet($key, $value) {
113 113
         if (is_null($key)) {
114 114
             $this->values[] = $value;
115
-        } else {
115
+        }else {
116 116
             $this->values[$key] = $value;
117 117
         }
118 118
     }
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
             if ($this->contains($value) === false) {
187 187
                 $this->values[] = $value;
188 188
             }
189
-        }else{
189
+        }else {
190 190
             $this->values[] = $value;
191 191
         }
192 192
     }
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
      *
198 198
      * @return Attribute
199 199
      */
200
-    public function setName($name){
200
+    public function setName($name) {
201 201
         $this->name = $name;
202 202
 
203 203
         return $this;
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
      *
209 209
      * @return string
210 210
      */
211
-    public function getName(){
211
+    public function getName() {
212 212
         return $this->name;
213 213
     }
214 214
 
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
      *
218 218
      * @return array
219 219
      */
220
-    public function get(){
220
+    public function get() {
221 221
         return $this->values;
222 222
     }
223 223
 
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
      *
227 227
      * @return array
228 228
      */
229
-    public function all(){
229
+    public function all() {
230 230
         return $this->get();
231 231
     }
232 232
 
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
      *
236 236
      * @return mixed|null
237 237
      */
238
-    public function first(){
238
+    public function first() {
239 239
         if ($this->offsetExists(0)) {
240 240
             return $this->values[0];
241 241
         }
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
      *
248 248
      * @return mixed|null
249 249
      */
250
-    public function last(){
250
+    public function last() {
251 251
         if (($cnt = $this->count()) > 0) {
252 252
             return $this->values[$cnt - 1];
253 253
         }
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
      *
260 260
      * @return int
261 261
      */
262
-    public function count(){
262
+    public function count() {
263 263
         return count($this->values);
264 264
     }
265 265
 }
266 266
\ No newline at end of file
Please login to merge, or discard this patch.
src/Client.php 2 patches
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -203,11 +203,11 @@  discard block
 block discarded – undo
203 203
      * @param array $config
204 204
      * @param array $default_config
205 205
      */
206
-    private function setAccountConfig($key, $config, $default_config){
206
+    private function setAccountConfig($key, $config, $default_config) {
207 207
         $value = $this->default_account_config[$key];
208
-        if(isset($config[$key])) {
208
+        if (isset($config[$key])) {
209 209
             $value = $config[$key];
210
-        }elseif(isset($default_config[$key])) {
210
+        }elseif (isset($default_config[$key])) {
211 211
             $value = $default_config[$key];
212 212
         }
213 213
         $this->$key = $value;
@@ -219,8 +219,8 @@  discard block
 block discarded – undo
219 219
      */
220 220
     protected function setEventsFromConfig($config) {
221 221
         $this->events = ClientManager::get("events");
222
-        if(isset($config['events'])){
223
-            foreach($config['events'] as $section => $events) {
222
+        if (isset($config['events'])) {
223
+            foreach ($config['events'] as $section => $events) {
224 224
                 $this->events[$section] = array_merge($this->events[$section], $events);
225 225
             }
226 226
         }
@@ -233,45 +233,45 @@  discard block
 block discarded – undo
233 233
      * @throws MaskNotFoundException
234 234
      */
235 235
     protected function setMaskFromConfig($config) {
236
-        $default_config  = ClientManager::get("masks");
236
+        $default_config = ClientManager::get("masks");
237 237
 
238
-        if(isset($config['masks'])){
239
-            if(isset($config['masks']['message'])) {
240
-                if(class_exists($config['masks']['message'])) {
238
+        if (isset($config['masks'])) {
239
+            if (isset($config['masks']['message'])) {
240
+                if (class_exists($config['masks']['message'])) {
241 241
                     $this->default_message_mask = $config['masks']['message'];
242
-                }else{
242
+                }else {
243 243
                     throw new MaskNotFoundException("Unknown mask provided: ".$config['masks']['message']);
244 244
                 }
245
-            }else{
246
-                if(class_exists($default_config['message'])) {
245
+            }else {
246
+                if (class_exists($default_config['message'])) {
247 247
                     $this->default_message_mask = $default_config['message'];
248
-                }else{
248
+                }else {
249 249
                     throw new MaskNotFoundException("Unknown mask provided: ".$default_config['message']);
250 250
                 }
251 251
             }
252
-            if(isset($config['masks']['attachment'])) {
253
-                if(class_exists($config['masks']['attachment'])) {
252
+            if (isset($config['masks']['attachment'])) {
253
+                if (class_exists($config['masks']['attachment'])) {
254 254
                     $this->default_attachment_mask = $config['masks']['attachment'];
255
-                }else{
255
+                }else {
256 256
                     throw new MaskNotFoundException("Unknown mask provided: ".$config['masks']['attachment']);
257 257
                 }
258
-            }else{
259
-                if(class_exists($default_config['attachment'])) {
258
+            }else {
259
+                if (class_exists($default_config['attachment'])) {
260 260
                     $this->default_attachment_mask = $default_config['attachment'];
261
-                }else{
261
+                }else {
262 262
                     throw new MaskNotFoundException("Unknown mask provided: ".$default_config['attachment']);
263 263
                 }
264 264
             }
265
-        }else{
266
-            if(class_exists($default_config['message'])) {
265
+        }else {
266
+            if (class_exists($default_config['message'])) {
267 267
                 $this->default_message_mask = $default_config['message'];
268
-            }else{
268
+            }else {
269 269
                 throw new MaskNotFoundException("Unknown mask provided: ".$default_config['message']);
270 270
             }
271 271
 
272
-            if(class_exists($default_config['attachment'])) {
272
+            if (class_exists($default_config['attachment'])) {
273 273
                 $this->default_attachment_mask = $default_config['attachment'];
274
-            }else{
274
+            }else {
275 275
                 throw new MaskNotFoundException("Unknown mask provided: ".$default_config['attachment']);
276 276
             }
277 277
         }
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
             $this->connection = new ImapProtocol($this->validate_cert, $this->encryption);
336 336
             $this->connection->setConnectionTimeout($this->timeout);
337 337
             $this->connection->setProxy($this->proxy);
338
-        }else{
338
+        }else {
339 339
             if (extension_loaded('imap') === false) {
340 340
                 throw new ConnectionFailedException("connection setup failed", 0, new ProtocolNotSupportedException($protocol." is an unsupported protocol"));
341 341
             }
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
 
409 409
         // Set delimiter to false to force selection via getFolderByName (maybe useful for uncommon folder names)
410 410
         $delimiter = is_null($delimiter) ? ClientManager::get('options.delimiter', "/") : $delimiter;
411
-        if (strpos($folder_name, (string)$delimiter) !== false) {
411
+        if (strpos($folder_name, (string) $delimiter) !== false) {
412 412
             return $this->getFolderByPath($folder_name);
413 413
         }
414 414
 
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
         $pattern = $parent_folder.($hierarchical ? '%' : '*');
461 461
         $items = $this->connection->folders('', $pattern);
462 462
 
463
-        if(is_array($items)){
463
+        if (is_array($items)) {
464 464
             foreach ($items as $folder_name => $item) {
465 465
                 $folder = new Folder($this, $folder_name, $item["delimiter"], $item["flags"]);
466 466
 
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
             }
476 476
 
477 477
             return $folders;
478
-        }else{
478
+        }else {
479 479
             throw new FolderFetchingException("failed to fetch any folders");
480 480
         }
481 481
     }
@@ -513,10 +513,10 @@  discard block
 block discarded – undo
513 513
         $this->checkConnection();
514 514
         $status = $this->connection->createFolder($folder);
515 515
 
516
-        if($expunge) $this->expunge();
516
+        if ($expunge) $this->expunge();
517 517
 
518 518
         $folder = $this->getFolder($folder);
519
-        if($status && $folder) {
519
+        if ($status && $folder) {
520 520
             $event = $this->getEvent("folder", "new");
521 521
             $event::dispatch($folder);
522 522
         }
@@ -542,7 +542,7 @@  discard block
 block discarded – undo
542 542
      *
543 543
      * @return string
544 544
      */
545
-    public function getFolderPath(){
545
+    public function getFolderPath() {
546 546
         return $this->active_folder;
547 547
     }
548 548
 
@@ -600,7 +600,7 @@  discard block
 block discarded – undo
600 600
      * @return int
601 601
      * @throws ConnectionFailedException
602 602
      */
603
-    public function getTimeout(){
603
+    public function getTimeout() {
604 604
         $this->checkConnection();
605 605
         return $this->connection->getConnectionTimeout();
606 606
     }
@@ -610,7 +610,7 @@  discard block
 block discarded – undo
610 610
      *
611 611
      * @return string
612 612
      */
613
-    public function getDefaultMessageMask(){
613
+    public function getDefaultMessageMask() {
614 614
         return $this->default_message_mask;
615 615
     }
616 616
 
@@ -620,7 +620,7 @@  discard block
 block discarded – undo
620 620
      *
621 621
      * @return array
622 622
      */
623
-    public function getDefaultEvents($section){
623
+    public function getDefaultEvents($section) {
624 624
         return $this->events[$section];
625 625
     }
626 626
 
@@ -632,7 +632,7 @@  discard block
 block discarded – undo
632 632
      * @throws MaskNotFoundException
633 633
      */
634 634
     public function setDefaultMessageMask($mask) {
635
-        if(class_exists($mask)) {
635
+        if (class_exists($mask)) {
636 636
             $this->default_message_mask = $mask;
637 637
 
638 638
             return $this;
@@ -646,7 +646,7 @@  discard block
 block discarded – undo
646 646
      *
647 647
      * @return string
648 648
      */
649
-    public function getDefaultAttachmentMask(){
649
+    public function getDefaultAttachmentMask() {
650 650
         return $this->default_attachment_mask;
651 651
     }
652 652
 
@@ -658,7 +658,7 @@  discard block
 block discarded – undo
658 658
      * @throws MaskNotFoundException
659 659
      */
660 660
     public function setDefaultAttachmentMask($mask) {
661
-        if(class_exists($mask)) {
661
+        if (class_exists($mask)) {
662 662
             $this->default_attachment_mask = $mask;
663 663
 
664 664
             return $this;
Please login to merge, or discard this patch.
Braces   +15 added lines, -13 removed lines patch added patch discarded remove patch
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
         $value = $this->default_account_config[$key];
208 208
         if(isset($config[$key])) {
209 209
             $value = $config[$key];
210
-        }elseif(isset($default_config[$key])) {
210
+        } elseif(isset($default_config[$key])) {
211 211
             $value = $default_config[$key];
212 212
         }
213 213
         $this->$key = $value;
@@ -239,39 +239,39 @@  discard block
 block discarded – undo
239 239
             if(isset($config['masks']['message'])) {
240 240
                 if(class_exists($config['masks']['message'])) {
241 241
                     $this->default_message_mask = $config['masks']['message'];
242
-                }else{
242
+                } else{
243 243
                     throw new MaskNotFoundException("Unknown mask provided: ".$config['masks']['message']);
244 244
                 }
245
-            }else{
245
+            } else{
246 246
                 if(class_exists($default_config['message'])) {
247 247
                     $this->default_message_mask = $default_config['message'];
248
-                }else{
248
+                } else{
249 249
                     throw new MaskNotFoundException("Unknown mask provided: ".$default_config['message']);
250 250
                 }
251 251
             }
252 252
             if(isset($config['masks']['attachment'])) {
253 253
                 if(class_exists($config['masks']['attachment'])) {
254 254
                     $this->default_attachment_mask = $config['masks']['attachment'];
255
-                }else{
255
+                } else{
256 256
                     throw new MaskNotFoundException("Unknown mask provided: ".$config['masks']['attachment']);
257 257
                 }
258
-            }else{
258
+            } else{
259 259
                 if(class_exists($default_config['attachment'])) {
260 260
                     $this->default_attachment_mask = $default_config['attachment'];
261
-                }else{
261
+                } else{
262 262
                     throw new MaskNotFoundException("Unknown mask provided: ".$default_config['attachment']);
263 263
                 }
264 264
             }
265
-        }else{
265
+        } else{
266 266
             if(class_exists($default_config['message'])) {
267 267
                 $this->default_message_mask = $default_config['message'];
268
-            }else{
268
+            } else{
269 269
                 throw new MaskNotFoundException("Unknown mask provided: ".$default_config['message']);
270 270
             }
271 271
 
272 272
             if(class_exists($default_config['attachment'])) {
273 273
                 $this->default_attachment_mask = $default_config['attachment'];
274
-            }else{
274
+            } else{
275 275
                 throw new MaskNotFoundException("Unknown mask provided: ".$default_config['attachment']);
276 276
             }
277 277
         }
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
             $this->connection = new ImapProtocol($this->validate_cert, $this->encryption);
336 336
             $this->connection->setConnectionTimeout($this->timeout);
337 337
             $this->connection->setProxy($this->proxy);
338
-        }else{
338
+        } else{
339 339
             if (extension_loaded('imap') === false) {
340 340
                 throw new ConnectionFailedException("connection setup failed", 0, new ProtocolNotSupportedException($protocol." is an unsupported protocol"));
341 341
             }
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
             }
476 476
 
477 477
             return $folders;
478
-        }else{
478
+        } else{
479 479
             throw new FolderFetchingException("failed to fetch any folders");
480 480
         }
481 481
     }
@@ -513,7 +513,9 @@  discard block
 block discarded – undo
513 513
         $this->checkConnection();
514 514
         $status = $this->connection->createFolder($folder);
515 515
 
516
-        if($expunge) $this->expunge();
516
+        if($expunge) {
517
+            $this->expunge();
518
+        }
517 519
 
518 520
         $folder = $this->getFolder($folder);
519 521
         if($status && $folder) {
Please login to merge, or discard this patch.
src/Connection/Protocols/LegacyProtocol.php 2 patches
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
                 $name = $this->decodeFolderName($item->name);
324 324
                 $result[$name] = ['delimiter' => $item->delimiter, 'flags' => []];
325 325
             }
326
-        }else{
326
+        } else{
327 327
             throw new RuntimeException(\imap_last_error());
328 328
         }
329 329
 
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
 
348 348
         if ($mode == "+"){
349 349
             $status = \imap_setflag_full($this->stream, $from, $flag, $uid ? IMAP::ST_UID : IMAP::NIL);
350
-        }else{
350
+        } else{
351 351
             $status = \imap_clearflag_full($this->stream, $from, $flag, $uid ? IMAP::ST_UID : IMAP::NIL);
352 352
         }
353 353
 
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 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';
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
      *
161 161
      * @return bool
162 162
      */
163
-    public function connected(){
163
+    public function connected() {
164 164
         return boolval($this->stream);
165 165
     }
166 166
 
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
      *
234 234
      * @return array
235 235
      */
236
-    public function headers($uids, $rfc = "RFC822", $uid = IMAP::ST_UID){
236
+    public function headers($uids, $rfc = "RFC822", $uid = IMAP::ST_UID) {
237 237
         $result = [];
238 238
         $uids = is_array($uids) ? $uids : [$uids];
239 239
         foreach ($uids as $id) {
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
      *
250 250
      * @return array
251 251
      */
252
-    public function flags($uids, $uid = IMAP::ST_UID){
252
+    public function flags($uids, $uid = IMAP::ST_UID) {
253 253
         $result = [];
254 254
         $uids = is_array($uids) ? $uids : [$uids];
255 255
         foreach ($uids as $id) {
@@ -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($sequence, $uid = IMAP::ST_UID) {
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
 
@@ -354,9 +354,9 @@  discard block
 block discarded – undo
354 354
     public function store(array $flags, $from, $to = null, $mode = null, $silent = true, $uid = IMAP::ST_UID) {
355 355
         $flag = trim(is_array($flags) ? implode(" ", $flags) : $flags);
356 356
 
357
-        if ($mode == "+"){
357
+        if ($mode == "+") {
358 358
             $status = \imap_setflag_full($this->stream, $from, $flag, $uid ? IMAP::ST_UID : IMAP::NIL);
359
-        }else{
359
+        }else {
360 360
             $status = \imap_clearflag_full($this->stream, $from, $flag, $uid ? IMAP::ST_UID : IMAP::NIL);
361 361
         }
362 362
 
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
      */
379 379
     public function appendMessage($folder, $message, $flags = null, $date = null) {
380 380
         if ($date != null) {
381
-            if ($date instanceof \Carbon\Carbon){
381
+            if ($date instanceof \Carbon\Carbon) {
382 382
                 $date = $date->format('d-M-Y H:i:s O');
383 383
             }
384 384
             return \imap_append($this->stream, $folder, $message, $flags, $date);
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
      * @return array|bool Tokens if operation successful, false if an error occurred
411 411
      */
412 412
     public function copyManyMessages($messages, $folder, $uid = IMAP::ST_UID) {
413
-        foreach($messages as $msg) {
413
+        foreach ($messages as $msg) {
414 414
             if ($this->copyMessage($folder, $msg, null, $uid) == false) {
415 415
                 return false;
416 416
             }
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
      * @return array|bool Tokens if operation successful, false if an error occurred
443 443
      */
444 444
     public function moveManyMessages($messages, $folder, $uid = IMAP::ST_UID) {
445
-        foreach($messages as $msg) {
445
+        foreach ($messages as $msg) {
446 446
             if ($this->moveMessage($folder, $msg, null, $uid) == false) {
447 447
                 return false;
448 448
             }
@@ -565,14 +565,14 @@  discard block
 block discarded – undo
565 565
     /**
566 566
      * Enable the debug mode
567 567
      */
568
-    public function enableDebug(){
568
+    public function enableDebug() {
569 569
         $this->debug = true;
570 570
     }
571 571
 
572 572
     /**
573 573
      * Disable the debug mode
574 574
      */
575
-    public function disableDebug(){
575
+    public function disableDebug() {
576 576
         $this->debug = false;
577 577
     }
578 578
 
Please login to merge, or discard this patch.
src/Query/Query.php 2 patches
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -91,7 +91,9 @@  discard block
 block discarded – undo
91 91
         $this->setClient($client);
92 92
 
93 93
         $this->sequence = ClientManager::get('options.sequence', IMAP::ST_MSGN);
94
-        if (ClientManager::get('options.fetch') === IMAP::FT_PEEK) $this->leaveUnread();
94
+        if (ClientManager::get('options.fetch') === IMAP::FT_PEEK) {
95
+            $this->leaveUnread();
96
+        }
95 97
 
96 98
         if (ClientManager::get('options.fetch_order') === 'desc') {
97 99
             $this->fetch_order = 'desc';
@@ -137,7 +139,9 @@  discard block
 block discarded – undo
137 139
      * @throws MessageSearchValidationException
138 140
      */
139 141
     protected function parse_date($date) {
140
-        if ($date instanceof Carbon) return $date;
142
+        if ($date instanceof Carbon) {
143
+            return $date;
144
+        }
141 145
 
142 146
         try {
143 147
             $date = Carbon::parse($date);
@@ -533,7 +537,9 @@  discard block
 block discarded – undo
533 537
      * @return $this
534 538
      */
535 539
     public function limit($limit, $page = 1) {
536
-        if ($page >= 1) $this->page = $page;
540
+        if ($page >= 1) {
541
+            $this->page = $page;
542
+        }
537 543
         $this->limit = $limit;
538 544
 
539 545
         return $this;
Please login to merge, or discard this 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 = isset($raw_messages["extensions"][$uid]) ? $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.