Passed
Push — master ( d418f0...22ef42 )
by Malte
02:51
created
src/IMAP/Query/WhereQuery.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
      */
71 71
     public function __call($name, $arguments) {
72 72
         $method = 'where'.ucfirst($name);
73
-        if(method_exists($this, $method) === true){
73
+        if (method_exists($this, $method) === true) {
74 74
             return call_user_func_array([$this, $method], $arguments);
75 75
         }
76 76
 
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
     protected function validate_criteria($criteria) {
88 88
         $criteria = strtoupper($criteria);
89 89
 
90
-        if(in_array($criteria, $this->available_criteria) === false) {
90
+        if (in_array($criteria, $this->available_criteria) === false) {
91 91
             throw new InvalidWhereQueryCriteriaException();
92 92
         }
93 93
 
@@ -102,21 +102,21 @@  discard block
 block discarded – undo
102 102
      * @throws InvalidWhereQueryCriteriaException
103 103
      */
104 104
     public function where($criteria, $value = null) {
105
-        if(is_array($criteria)){
106
-            foreach($criteria as $arguments){
107
-                if(count($arguments) == 1){
105
+        if (is_array($criteria)) {
106
+            foreach ($criteria as $arguments) {
107
+                if (count($arguments) == 1) {
108 108
                     $this->where($arguments[0]);
109
-                }elseif(count($arguments) == 2){
109
+                }elseif (count($arguments) == 2) {
110 110
                     $this->where($arguments[0], $arguments[1]);
111 111
                 }
112 112
             }
113
-        }else{
113
+        } else {
114 114
             $criteria = $this->validate_criteria($criteria);
115 115
             $value = $this->parse_value($value);
116 116
 
117
-            if($value === null || $value === ''){
117
+            if ($value === null || $value === '') {
118 118
                 $this->query->push([$criteria]);
119
-            }else{
119
+            } else {
120 120
                 $this->query->push([$criteria, $value]);
121 121
             }
122 122
         }
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
      */
132 132
     public function orWhere(\Closure $closure = null) {
133 133
         $this->query->push(['OR']);
134
-        if($closure !== null) $closure($this);
134
+        if ($closure !== null) $closure($this);
135 135
 
136 136
         return $this;
137 137
     }
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
      */
144 144
     public function andWhere(\Closure $closure = null) {
145 145
         $this->query->push(['AND']);
146
-        if($closure !== null) $closure($this);
146
+        if ($closure !== null) $closure($this);
147 147
 
148 148
         return $this;
149 149
     }
Please login to merge, or discard this patch.
src/IMAP/Client.php 3 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -355,14 +355,14 @@
 block discarded – undo
355 355
         return $status;
356 356
     }
357 357
     
358
-     /**
359
-     * Delete Folder
360
-     * @param string $name
361
-      * @param boolean $expunge
362
-     *
363
-     * @return bool
364
-     * @throws ConnectionFailedException
365
-     */
358
+        /**
359
+         * Delete Folder
360
+         * @param string $name
361
+         * @param boolean $expunge
362
+         *
363
+         * @return bool
364
+         * @throws ConnectionFailedException
365
+         */
366 366
     public function deleteFolder($name, $expunge = true) {
367 367
         $this->checkConnection();
368 368
         $status = imap_deletemailbox($this->getConnection(), $this->getAddress() . imap_utf7_encode($name));
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
      *
114 114
      * @var array $validConfigKeys
115 115
      */
116
-    protected $validConfigKeys = ['host', 'port', 'encryption', 'validate_cert', 'username', 'password','protocol'];
116
+    protected $validConfigKeys = ['host', 'port', 'encryption', 'validate_cert', 'username', 'password', 'protocol'];
117 117
 
118 118
     /**
119 119
      * Client constructor.
@@ -332,8 +332,8 @@  discard block
 block discarded – undo
332 332
      */
333 333
     public function createFolder($name, $expunge = true) {
334 334
         $this->checkConnection();
335
-        $status = imap_createmailbox($this->getConnection(), $this->getAddress() . imap_utf7_encode($name));
336
-        if($expunge) $this->expunge();
335
+        $status = imap_createmailbox($this->getConnection(), $this->getAddress().imap_utf7_encode($name));
336
+        if ($expunge) $this->expunge();
337 337
 
338 338
         return $status;
339 339
     }
@@ -349,8 +349,8 @@  discard block
 block discarded – undo
349 349
      */
350 350
     public function renameFolder($old_name, $new_name, $expunge = true) {
351 351
         $this->checkConnection();
352
-        $status = imap_renamemailbox($this->getConnection(), $this->getAddress() . imap_utf7_encode($old_name), $this->getAddress() . imap_utf7_encode($new_name));
353
-        if($expunge) $this->expunge();
352
+        $status = imap_renamemailbox($this->getConnection(), $this->getAddress().imap_utf7_encode($old_name), $this->getAddress().imap_utf7_encode($new_name));
353
+        if ($expunge) $this->expunge();
354 354
 
355 355
         return $status;
356 356
     }
@@ -365,8 +365,8 @@  discard block
 block discarded – undo
365 365
      */
366 366
     public function deleteFolder($name, $expunge = true) {
367 367
         $this->checkConnection();
368
-        $status = imap_deletemailbox($this->getConnection(), $this->getAddress() . imap_utf7_encode($name));
369
-        if($expunge) $this->expunge();
368
+        $status = imap_deletemailbox($this->getConnection(), $this->getAddress().imap_utf7_encode($name));
369
+        if ($expunge) $this->expunge();
370 370
 
371 371
         return $status;
372 372
     }
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
         if (!$this->validate_cert) {
457 457
             $address .= '/novalidate-cert';
458 458
         }
459
-        if (in_array($this->encryption,['tls','ssl'])) {
459
+        if (in_array($this->encryption, ['tls', 'ssl'])) {
460 460
             $address .= '/'.$this->encryption;
461 461
         }
462 462
         $address .= '}';
Please login to merge, or discard this patch.
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -333,7 +333,9 @@  discard block
 block discarded – undo
333 333
     public function createFolder($name, $expunge = true) {
334 334
         $this->checkConnection();
335 335
         $status = imap_createmailbox($this->getConnection(), $this->getAddress() . imap_utf7_encode($name));
336
-        if($expunge) $this->expunge();
336
+        if($expunge) {
337
+            $this->expunge();
338
+        }
337 339
 
338 340
         return $status;
339 341
     }
@@ -350,7 +352,9 @@  discard block
 block discarded – undo
350 352
     public function renameFolder($old_name, $new_name, $expunge = true) {
351 353
         $this->checkConnection();
352 354
         $status = imap_renamemailbox($this->getConnection(), $this->getAddress() . imap_utf7_encode($old_name), $this->getAddress() . imap_utf7_encode($new_name));
353
-        if($expunge) $this->expunge();
355
+        if($expunge) {
356
+            $this->expunge();
357
+        }
354 358
 
355 359
         return $status;
356 360
     }
@@ -366,7 +370,9 @@  discard block
 block discarded – undo
366 370
     public function deleteFolder($name, $expunge = true) {
367 371
         $this->checkConnection();
368 372
         $status = imap_deletemailbox($this->getConnection(), $this->getAddress() . imap_utf7_encode($name));
369
-        if($expunge) $this->expunge();
373
+        if($expunge) {
374
+            $this->expunge();
375
+        }
370 376
 
371 377
         return $status;
372 378
     }
Please login to merge, or discard this patch.
src/IMAP/Folder.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
      * @return WhereQuery
132 132
      * @throws Exceptions\ConnectionFailedException
133 133
      */
134
-    public function query($charset = 'UTF-8'){
134
+    public function query($charset = 'UTF-8') {
135 135
         $this->getClient()->checkConnection();
136 136
         $this->getClient()->openFolder($this);
137 137
 
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
      * @inheritdoc self::query($charset = 'UTF-8')
143 143
      * @throws Exceptions\ConnectionFailedException
144 144
      */
145
-    public function search($charset = 'UTF-8'){
145
+    public function search($charset = 'UTF-8') {
146 146
         return $this->query($charset);
147 147
     }
148 148
 
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
      * @inheritdoc self::query($charset = 'UTF-8')
151 151
      * @throws Exceptions\ConnectionFailedException
152 152
      */
153
-    public function messages($charset = 'UTF-8'){
153
+    public function messages($charset = 'UTF-8') {
154 154
         return $this->query($charset);
155 155
     }
156 156
 
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
      * @deprecated 1.2.1:2.0.0 No longer needed. Use Folder::query() instead
312 312
      * @see Folder::query()
313 313
      */
314
-    public function searchMessages(array $where, $fetch_options = null, $fetch_body = true,  $fetch_attachment = true, $fetch_flags = true, $limit = null, $page = 1, $charset = "UTF-8") {
314
+    public function searchMessages(array $where, $fetch_options = null, $fetch_body = true, $fetch_attachment = true, $fetch_flags = true, $limit = null, $page = 1, $charset = "UTF-8") {
315 315
         $this->getClient()->checkConnection();
316 316
 
317 317
         return $this->query($charset)->where($where)->setFetchOptions($fetch_options)->setFetchBody($fetch_body)
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
      */
371 371
     public function delete($expunge = true) {
372 372
         $status = imap_deletemailbox($this->client->getConnection(), $this->path);
373
-        if($expunge) $this->client->expunge();
373
+        if ($expunge) $this->client->expunge();
374 374
 
375 375
         return $status;
376 376
     }
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
      */
388 388
     public function move($target_mailbox, $expunge = true) {
389 389
         $status = imap_renamemailbox($this->client->getConnection(), $this->path, $target_mailbox);
390
-        if($expunge) $this->client->expunge();
390
+        if ($expunge) $this->client->expunge();
391 391
 
392 392
         return $status;
393 393
     }
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -370,7 +370,9 @@  discard block
 block discarded – undo
370 370
      */
371 371
     public function delete($expunge = true) {
372 372
         $status = imap_deletemailbox($this->client->getConnection(), $this->path);
373
-        if($expunge) $this->client->expunge();
373
+        if($expunge) {
374
+            $this->client->expunge();
375
+        }
374 376
 
375 377
         return $status;
376 378
     }
@@ -387,7 +389,9 @@  discard block
 block discarded – undo
387 389
      */
388 390
     public function move($target_mailbox, $expunge = true) {
389 391
         $status = imap_renamemailbox($this->client->getConnection(), $this->path, $target_mailbox);
390
-        if($expunge) $this->client->expunge();
392
+        if($expunge) {
393
+            $this->client->expunge();
394
+        }
391 395
 
392 396
         return $status;
393 397
     }
Please login to merge, or discard this patch.
src/IMAP/Message.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
         $this->msglist = $msglist;
185 185
         $this->client = $client;
186 186
 
187
-        $this->uid =  ($this->fetch_options == FT_UID) ? $uid : $uid;
187
+        $this->uid = ($this->fetch_options == FT_UID) ? $uid : $uid;
188 188
         $this->msgn = ($this->fetch_options == FT_UID) ? imap_msgno($this->client->getConnection(), $uid) : $uid;
189 189
 
190 190
         $this->parseHeader();
@@ -288,9 +288,9 @@  discard block
 block discarded – undo
288 288
             $header = imap_rfc822_parse_headers($this->header);
289 289
         }
290 290
 
291
-        if(preg_match('/x\-priority\:.*([0-9]{1,2})/i', $this->header, $priority)){
291
+        if (preg_match('/x\-priority\:.*([0-9]{1,2})/i', $this->header, $priority)) {
292 292
             $priority = isset($priority[1]) ? (int) $priority[1] : 0;
293
-            switch($priority){
293
+            switch ($priority) {
294 294
                 case self::PRIORITY_HIGHEST;
295 295
                     $this->priority = self::PRIORITY_HIGHEST;
296 296
                     break;
@@ -473,12 +473,12 @@  discard block
 block discarded – undo
473 473
     public function parseBody() {
474 474
         $structure = imap_fetchstructure($this->client->getConnection(), $this->uid, FT_UID);
475 475
 
476
-        if(property_exists($structure, 'parts')){
476
+        if (property_exists($structure, 'parts')) {
477 477
             $parts = $structure->parts;
478 478
 
479
-            foreach ($parts as $part)  {
480
-                foreach ($part->parameters as $parameter)  {
481
-                    if($parameter->attribute == "charset")  {
479
+            foreach ($parts as $part) {
480
+                foreach ($part->parameters as $parameter) {
481
+                    if ($parameter->attribute == "charset") {
482 482
                         $encoding = $parameter->value;
483 483
                         $parameter->value = preg_replace('/Content-Transfer-Encoding/', '', $encoding);
484 484
                     }
@@ -710,7 +710,7 @@  discard block
 block discarded – undo
710 710
                     return strtoupper($parameter->value);
711 711
                 }
712 712
             }
713
-        }elseif (is_string($structure) === true){
713
+        }elseif (is_string($structure) === true) {
714 714
             return mb_detect_encoding($structure);
715 715
         }
716 716
 
@@ -780,7 +780,7 @@  discard block
 block discarded – undo
780 780
      */
781 781
     public function delete($expunge = true) {
782 782
         $status = imap_delete($this->client->getConnection(), $this->uid, FT_UID);
783
-        if($expunge) $this->client->expunge();
783
+        if ($expunge) $this->client->expunge();
784 784
 
785 785
         return $status;
786 786
     }
@@ -794,7 +794,7 @@  discard block
 block discarded – undo
794 794
      */
795 795
     public function restore($expunge = true) {
796 796
         $status = imap_undelete($this->client->getConnection(), $this->uid, FT_UID);
797
-        if($expunge) $this->client->expunge();
797
+        if ($expunge) $this->client->expunge();
798 798
 
799 799
         return $status;
800 800
     }
Please login to merge, or discard this patch.
Braces   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -710,7 +710,7 @@  discard block
 block discarded – undo
710 710
                     return strtoupper($parameter->value);
711 711
                 }
712 712
             }
713
-        }elseif (is_string($structure) === true){
713
+        } elseif (is_string($structure) === true){
714 714
             return mb_detect_encoding($structure);
715 715
         }
716 716
 
@@ -780,7 +780,9 @@  discard block
 block discarded – undo
780 780
      */
781 781
     public function delete($expunge = true) {
782 782
         $status = imap_delete($this->client->getConnection(), $this->uid, FT_UID);
783
-        if($expunge) $this->client->expunge();
783
+        if($expunge) {
784
+            $this->client->expunge();
785
+        }
784 786
 
785 787
         return $status;
786 788
     }
@@ -794,7 +796,9 @@  discard block
 block discarded – undo
794 796
      */
795 797
     public function restore($expunge = true) {
796 798
         $status = imap_undelete($this->client->getConnection(), $this->uid, FT_UID);
797
-        if($expunge) $this->client->expunge();
799
+        if($expunge) {
800
+            $this->client->expunge();
801
+        }
798 802
 
799 803
         return $status;
800 804
     }
Please login to merge, or discard this patch.