Passed
Push — master ( 133a7b...2b5dda )
by Malte
02:34
created
src/Connection/Protocols/LegacyProtocol.php 1 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';
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
      *
160 160
      * @return bool
161 161
      */
162
-    public function connected(){
162
+    public function connected() {
163 163
         return boolval($this->stream);
164 164
     }
165 165
 
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
      *
232 232
      * @return array
233 233
      */
234
-    public function headers($uids, $rfc = "RFC822", $uid = IMAP::ST_UID){
234
+    public function headers($uids, $rfc = "RFC822", $uid = IMAP::ST_UID) {
235 235
         $result = [];
236 236
         $uids = is_array($uids) ? $uids : [$uids];
237 237
         foreach ($uids as $id) {
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
      *
248 248
      * @return array
249 249
      */
250
-    public function flags($uids, $uid = IMAP::ST_UID){
250
+    public function flags($uids, $uid = IMAP::ST_UID) {
251 251
         $result = [];
252 252
         $uids = is_array($uids) ? $uids : [$uids];
253 253
         foreach ($uids as $id) {
@@ -255,8 +255,8 @@  discard block
 block discarded – undo
255 255
             $flags = [];
256 256
             if (is_array($raw_flags) && isset($raw_flags[0])) {
257 257
                 $raw_flags = (array) $raw_flags[0];
258
-                foreach($raw_flags as $flag => $value) {
259
-                    if ($value === 1 && in_array($flag, ["size", "uid", "msgno", "update"]) === false){
258
+                foreach ($raw_flags as $flag => $value) {
259
+                    if ($value === 1 && in_array($flag, ["size", "uid", "msgno", "update"]) === false) {
260 260
                         $flags[] = "\\".ucfirst($flag);
261 261
                     }
262 262
                 }
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
         if ($id === null) {
278 278
             $overview = $this->overview("1:*");
279 279
             $uids = [];
280
-            foreach($overview as $set){
280
+            foreach ($overview as $set) {
281 281
                 $uids[$set->msgno] = $set->uid;
282 282
             }
283 283
             return $uids;
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
      * @return array
304 304
      */
305 305
     public function overview($sequence, $uid = IMAP::ST_UID) {
306
-        return \imap_fetch_overview($this->stream, $sequence,$uid ? IMAP::ST_UID : IMAP::NIL);
306
+        return \imap_fetch_overview($this->stream, $sequence, $uid ? IMAP::ST_UID : IMAP::NIL);
307 307
     }
308 308
 
309 309
     /**
@@ -318,12 +318,12 @@  discard block
 block discarded – undo
318 318
         $result = [];
319 319
 
320 320
         $items = \imap_getmailboxes($this->stream, $this->getAddress(), $reference.$folder);
321
-        if(is_array($items)){
321
+        if (is_array($items)) {
322 322
             foreach ($items as $item) {
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
 
@@ -345,9 +345,9 @@  discard block
 block discarded – undo
345 345
     public function store(array $flags, $from, $to = null, $mode = null, $silent = true, $uid = IMAP::ST_UID) {
346 346
         $flag = trim(is_array($flags) ? implode(" ", $flags) : $flags);
347 347
 
348
-        if ($mode == "+"){
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
 
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
      */
370 370
     public function appendMessage($folder, $message, $flags = null, $date = null) {
371 371
         if ($date != null) {
372
-            if ($date instanceof \Carbon\Carbon){
372
+            if ($date instanceof \Carbon\Carbon) {
373 373
                 $date = $date->format('d-M-Y H:i:s O');
374 374
             }
375 375
             return \imap_append($this->stream, $folder, $message, $flags, $date);
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
      * @return array|bool Tokens if operation successful, false if an error occurred
402 402
      */
403 403
     public function copyManyMessages($messages, $folder, $uid = IMAP::ST_UID) {
404
-        foreach($messages as $msg) {
404
+        foreach ($messages as $msg) {
405 405
             if ($this->copyMessage($folder, $msg, null, $uid) == false) {
406 406
                 return false;
407 407
             }
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
      * @return array|bool Tokens if operation successful, false if an error occurred
434 434
      */
435 435
     public function moveManyMessages($messages, $folder, $uid = IMAP::ST_UID) {
436
-        foreach($messages as $msg) {
436
+        foreach ($messages as $msg) {
437 437
             if ($this->moveMessage($folder, $msg, null, $uid) == false) {
438 438
                 return false;
439 439
             }
@@ -556,14 +556,14 @@  discard block
 block discarded – undo
556 556
     /**
557 557
      * Enable the debug mode
558 558
      */
559
-    public function enableDebug(){
559
+    public function enableDebug() {
560 560
         $this->debug = true;
561 561
     }
562 562
 
563 563
     /**
564 564
      * Disable the debug mode
565 565
      */
566
-    public function disableDebug(){
566
+    public function disableDebug() {
567 567
         $this->debug = false;
568 568
     }
569 569
 
Please login to merge, or discard this patch.
src/Query/Query.php 1 patch
Spacing   +9 added lines, -9 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
     /**
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
             $extensions = isset($raw_messages["extensions"][$uid]) ? $raw_messages["extensions"][$uid] : [];
330 330
 
331 331
             $message = $this->make($uid, $msglist, $header, $content, $flag);
332
-            foreach($extensions as $key => $extension) {
332
+            foreach ($extensions as $key => $extension) {
333 333
                 $message->getHeader()->set($key, $extension);
334 334
             }
335 335
             if ($message !== null) {
Please login to merge, or discard this patch.
src/Folder.php 1 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.