Passed
Push — master ( 01984b...00f43d )
by Malte
03:00
created
src/IMAP/Query/WhereQuery.php 2 patches
Braces   +9 added lines, -5 removed lines patch added patch discarded remove patch
@@ -77,17 +77,17 @@  discard block
 block discarded – undo
77 77
             foreach($criteria as $arguments){
78 78
                 if(count($arguments) == 1){
79 79
                     $this->where($arguments[0]);
80
-                }elseif(count($arguments) == 2){
80
+                } elseif(count($arguments) == 2){
81 81
                     $this->where($arguments[0], $arguments[1]);
82 82
                 }
83 83
             }
84
-        }else{
84
+        } else{
85 85
             $criteria = $this->validate_criteria($criteria);
86 86
             $value = $this->parse_value($value);
87 87
 
88 88
             if($value === null || $value === ''){
89 89
                 $this->query->push([$criteria]);
90
-            }else{
90
+            } else{
91 91
                 $this->query->push([$criteria, $value]);
92 92
             }
93 93
         }
@@ -102,7 +102,9 @@  discard block
 block discarded – undo
102 102
      */
103 103
     public function orWhere(\Closure $closure = null) {
104 104
         $this->query->push(['OR']);
105
-        if($closure !== null) $closure($this);
105
+        if($closure !== null) {
106
+            $closure($this);
107
+        }
106 108
 
107 109
         return $this;
108 110
     }
@@ -114,7 +116,9 @@  discard block
 block discarded – undo
114 116
      */
115 117
     public function andWhere(\Closure $closure = null) {
116 118
         $this->query->push(['AND']);
117
-        if($closure !== null) $closure($this);
119
+        if($closure !== null) {
120
+            $closure($this);
121
+        }
118 122
 
119 123
         return $this;
120 124
     }
Please login to merge, or discard this 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/Query/Query.php 2 patches
Braces   +11 added lines, -5 removed lines patch added patch discarded remove patch
@@ -64,7 +64,9 @@  discard block
 block discarded – undo
64 64
     public function __construct(Client $client, $charset = 'UTF-8') {
65 65
         $this->setClient($client);
66 66
 
67
-        if(config('imap.options.fetch') === FT_PEEK) $this->leaveUnread();
67
+        if(config('imap.options.fetch') === FT_PEEK) {
68
+            $this->leaveUnread();
69
+        }
68 70
 
69 71
         $this->charset = $charset;
70 72
         $this->query = collect();
@@ -100,7 +102,9 @@  discard block
 block discarded – undo
100 102
      * @throws MessageSearchValidationException
101 103
      */
102 104
     protected function parse_date($date) {
103
-        if($date instanceof \Carbon\Carbon) return $date;
105
+        if($date instanceof \Carbon\Carbon) {
106
+            return $date;
107
+        }
104 108
 
105 109
         try {
106 110
             $date = Carbon::parse($date);
@@ -151,7 +155,7 @@  discard block
 block discarded – undo
151 155
              */
152 156
             if($this->getCharset() === null){
153 157
                 $available_messages = imap_search($this->getClient()->getConnection(), $this->getRawQuery(), SE_UID);
154
-            }else{
158
+            } else{
155 159
                 $available_messages = imap_search($this->getClient()->getConnection(), $this->getRawQuery(), SE_UID, $this->getCharset());
156 160
             }
157 161
 
@@ -203,7 +207,7 @@  discard block
 block discarded – undo
203 207
             } else {
204 208
                 if($statement[1] === null){
205 209
                     $query .= $statement[0];
206
-                }else{
210
+                } else{
207 211
                     $query .= $statement[0].' "'.$statement[1].'"';
208 212
                 }
209 213
             }
@@ -232,7 +236,9 @@  discard block
 block discarded – undo
232 236
      * @return $this
233 237
      */
234 238
     public function limit($limit, $page = 1) {
235
-        if($page >= 1) $this->page = $page;
239
+        if($page >= 1) {
240
+            $this->page = $page;
241
+        }
236 242
         $this->limit = $limit;
237 243
 
238 244
         return $this;
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
     public function __construct(Client $client, $charset = 'UTF-8') {
65 65
         $this->setClient($client);
66 66
 
67
-        if(config('imap.options.fetch') === FT_PEEK) $this->leaveUnread();
67
+        if (config('imap.options.fetch') === FT_PEEK) $this->leaveUnread();
68 68
 
69 69
         $this->charset = $charset;
70 70
         $this->query = collect();
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
     /**
75 75
      * Instance boot method for additional functionality
76 76
      */
77
-    protected function boot(){}
77
+    protected function boot() {}
78 78
 
79 79
     /**
80 80
      * Parse a given value
@@ -82,8 +82,8 @@  discard block
 block discarded – undo
82 82
      *
83 83
      * @return string
84 84
      */
85
-    protected function parse_value($value){
86
-        switch(true){
85
+    protected function parse_value($value) {
86
+        switch (true) {
87 87
             case $value instanceof \Carbon\Carbon:
88 88
                 $value = $value->format('d M y');
89 89
                 break;
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
      * @throws MessageSearchValidationException
101 101
      */
102 102
     protected function parse_date($date) {
103
-        if($date instanceof \Carbon\Carbon) return $date;
103
+        if ($date instanceof \Carbon\Carbon) return $date;
104 104
 
105 105
         try {
106 106
             $date = Carbon::parse($date);
@@ -149,9 +149,9 @@  discard block
 block discarded – undo
149 149
              * Don't set the charset if it isn't used - prevent strange outlook mail server errors
150 150
              * @see https://github.com/Webklex/laravel-imap/issues/100
151 151
              */
152
-            if($this->getCharset() === null){
152
+            if ($this->getCharset() === null) {
153 153
                 $available_messages = imap_search($this->getClient()->getConnection(), $this->getRawQuery(), SE_UID);
154
-            }else{
154
+            } else {
155 155
                 $available_messages = imap_search($this->getClient()->getConnection(), $this->getRawQuery(), SE_UID, $this->getCharset());
156 156
             }
157 157
 
@@ -160,13 +160,13 @@  discard block
 block discarded – undo
160 160
                 $available_messages = collect($available_messages);
161 161
                 $options = config('imap.options');
162 162
 
163
-                if(strtolower($options['fetch_order']) === 'desc'){
163
+                if (strtolower($options['fetch_order']) === 'desc') {
164 164
                     $available_messages = $available_messages->reverse();
165 165
                 }
166 166
 
167 167
                 $available_messages->forPage($this->page, $this->limit)->each(function($msgno, $msglist) use(&$messages, $options) {
168 168
                     $oMessage = new Message($msgno, $msglist, $this->getClient(), $this->getFetchOptions(), $this->getFetchBody(), $this->getFetchAttachment(), $this->getFetchFlags());
169
-                    switch ($options['message_key']){
169
+                    switch ($options['message_key']) {
170 170
                         case 'number':
171 171
                             $message_key = $oMessage->getMessageNo();
172 172
                             break;
@@ -201,9 +201,9 @@  discard block
 block discarded – undo
201 201
             if (count($statement) == 1) {
202 202
                 $query .= $statement[0];
203 203
             } else {
204
-                if($statement[1] === null){
204
+                if ($statement[1] === null) {
205 205
                     $query .= $statement[0];
206
-                }else{
206
+                } else {
207 207
                     $query .= $statement[0].' "'.$statement[1].'"';
208 208
                 }
209 209
             }
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
      * @return $this
233 233
      */
234 234
     public function limit($limit, $page = 1) {
235
-        if($page >= 1) $this->page = $page;
235
+        if ($page >= 1) $this->page = $page;
236 236
         $this->limit = $limit;
237 237
 
238 238
         return $this;
Please login to merge, or discard this patch.
src/IMAP/Providers/LaravelServiceProvider.php 2 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
      * If however the default account is missing a parameter the package default account parameter will be used.
59 59
      * This can be disabled by setting imap.default in your config file to 'false'
60 60
      */
61
-    private function setVendorConfig(){
61
+    private function setVendorConfig() {
62 62
 
63 63
         $config_key = 'imap';
64 64
         $path = __DIR__.'/../../config/'.$config_key.'.php';
@@ -70,17 +70,17 @@  discard block
 block discarded – undo
70 70
 
71 71
         $config = $this->app['config']->get($config_key);
72 72
 
73
-        if(is_array($config)){
74
-            if(isset($config['default'])){
75
-                if(isset($config['accounts']) && $config['default'] != false){
73
+        if (is_array($config)) {
74
+            if (isset($config['default'])) {
75
+                if (isset($config['accounts']) && $config['default'] != false) {
76 76
 
77 77
                     $default_config = $vendor_config['accounts']['default'];
78
-                    if(isset($config['accounts'][$config['default']])){
78
+                    if (isset($config['accounts'][$config['default']])) {
79 79
                         $default_config = array_merge($default_config, $config['accounts'][$config['default']]);
80 80
                     }
81 81
 
82
-                    if(is_array($config['accounts'])){
83
-                        foreach($config['accounts'] as $account_key => $account){
82
+                    if (is_array($config['accounts'])) {
83
+                        foreach ($config['accounts'] as $account_key => $account) {
84 84
                             $config['accounts'][$account_key] = array_merge($default_config, $account);
85 85
                         }
86 86
                     }
@@ -114,23 +114,23 @@  discard block
 block discarded – undo
114 114
         $arrays = func_get_args();
115 115
         $base = array_shift($arrays);
116 116
 
117
-        if(!is_array($base)) $base = empty($base) ? array() : array($base);
117
+        if (!is_array($base)) $base = empty($base) ? array() : array($base);
118 118
 
119
-        foreach($arrays as $append) {
119
+        foreach ($arrays as $append) {
120 120
 
121
-            if(!is_array($append)) $append = array($append);
121
+            if (!is_array($append)) $append = array($append);
122 122
 
123
-            foreach($append as $key => $value) {
123
+            foreach ($append as $key => $value) {
124 124
 
125
-                if(!array_key_exists($key, $base) and !is_numeric($key)) {
125
+                if (!array_key_exists($key, $base) and !is_numeric($key)) {
126 126
                     $base[$key] = $append[$key];
127 127
                     continue;
128 128
                 }
129 129
 
130
-                if(is_array($value) or is_array($base[$key])) {
130
+                if (is_array($value) or is_array($base[$key])) {
131 131
                     $base[$key] = $this->array_merge_recursive_distinct($base[$key], $append[$key]);
132
-                } else if(is_numeric($key)) {
133
-                    if(!in_array($value, $base)) $base[] = $value;
132
+                } else if (is_numeric($key)) {
133
+                    if (!in_array($value, $base)) $base[] = $value;
134 134
                 } else {
135 135
                     $base[$key] = $value;
136 136
                 }
Please login to merge, or discard this patch.
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -114,11 +114,15 @@  discard block
 block discarded – undo
114 114
         $arrays = func_get_args();
115 115
         $base = array_shift($arrays);
116 116
 
117
-        if(!is_array($base)) $base = empty($base) ? array() : array($base);
117
+        if(!is_array($base)) {
118
+            $base = empty($base) ? array() : array($base);
119
+        }
118 120
 
119 121
         foreach($arrays as $append) {
120 122
 
121
-            if(!is_array($append)) $append = array($append);
123
+            if(!is_array($append)) {
124
+                $append = array($append);
125
+            }
122 126
 
123 127
             foreach($append as $key => $value) {
124 128
 
@@ -130,7 +134,9 @@  discard block
 block discarded – undo
130 134
                 if(is_array($value) or is_array($base[$key])) {
131 135
                     $base[$key] = $this->array_merge_recursive_distinct($base[$key], $append[$key]);
132 136
                 } else if(is_numeric($key)) {
133
-                    if(!in_array($value, $base)) $base[] = $value;
137
+                    if(!in_array($value, $base)) {
138
+                        $base[] = $value;
139
+                    }
134 140
                 } else {
135 141
                     $base[$key] = $value;
136 142
                 }
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   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
      *
115 115
      * @var array $validConfigKeys
116 116
      */
117
-    protected $validConfigKeys = ['host', 'port', 'encryption', 'validate_cert', 'username', 'password','protocol'];
117
+    protected $validConfigKeys = ['host', 'port', 'encryption', 'validate_cert', 'username', 'password', 'protocol'];
118 118
 
119 119
     /**
120 120
      * All available timeout types
@@ -345,8 +345,8 @@  discard block
 block discarded – undo
345 345
      */
346 346
     public function createFolder($name, $expunge = true) {
347 347
         $this->checkConnection();
348
-        $status = imap_createmailbox($this->getConnection(), $this->getAddress() . imap_utf7_encode($name));
349
-        if($expunge) $this->expunge();
348
+        $status = imap_createmailbox($this->getConnection(), $this->getAddress().imap_utf7_encode($name));
349
+        if ($expunge) $this->expunge();
350 350
 
351 351
         return $status;
352 352
     }
@@ -362,8 +362,8 @@  discard block
 block discarded – undo
362 362
      */
363 363
     public function renameFolder($old_name, $new_name, $expunge = true) {
364 364
         $this->checkConnection();
365
-        $status = imap_renamemailbox($this->getConnection(), $this->getAddress() . imap_utf7_encode($old_name), $this->getAddress() . imap_utf7_encode($new_name));
366
-        if($expunge) $this->expunge();
365
+        $status = imap_renamemailbox($this->getConnection(), $this->getAddress().imap_utf7_encode($old_name), $this->getAddress().imap_utf7_encode($new_name));
366
+        if ($expunge) $this->expunge();
367 367
 
368 368
         return $status;
369 369
     }
@@ -378,8 +378,8 @@  discard block
 block discarded – undo
378 378
      */
379 379
     public function deleteFolder($name, $expunge = true) {
380 380
         $this->checkConnection();
381
-        $status = imap_deletemailbox($this->getConnection(), $this->getAddress() . imap_utf7_encode($name));
382
-        if($expunge) $this->expunge();
381
+        $status = imap_deletemailbox($this->getConnection(), $this->getAddress().imap_utf7_encode($name));
382
+        if ($expunge) $this->expunge();
383 383
 
384 384
         return $status;
385 385
     }
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
         if (!$this->validate_cert) {
473 473
             $address .= '/novalidate-cert';
474 474
         }
475
-        if (in_array($this->encryption,['tls','ssl'])) {
475
+        if (in_array($this->encryption, ['tls', 'ssl'])) {
476 476
             $address .= '/'.$this->encryption;
477 477
         }
478 478
         $address .= '}';
@@ -592,11 +592,11 @@  discard block
 block discarded – undo
592 592
      * @throws InvalidImapTimeoutTypeException
593 593
      */
594 594
     public function setTimeout($type, $timeout) {
595
-        if(is_numeric($type)) {
595
+        if (is_numeric($type)) {
596 596
             $type = (int) $type;
597
-        }elseif (isset($this->timeout_type[$type])){
597
+        }elseif (isset($this->timeout_type[$type])) {
598 598
             $type = $this->timeout_type[$type];
599
-        }else{
599
+        } else {
600 600
             throw new InvalidImapTimeoutTypeException("Invalid imap timeout type provided.");
601 601
         }
602 602
 
@@ -610,12 +610,12 @@  discard block
 block discarded – undo
610 610
      * @return mixed
611 611
      * @throws InvalidImapTimeoutTypeException
612 612
      */
613
-    public function getTimeout($type){
614
-        if(is_numeric($type)) {
613
+    public function getTimeout($type) {
614
+        if (is_numeric($type)) {
615 615
             $type = (int) $type;
616
-        }elseif (isset($this->timeout_type[$type])){
616
+        }elseif (isset($this->timeout_type[$type])) {
617 617
             $type = $this->timeout_type[$type];
618
-        }else{
618
+        } else {
619 619
             throw new InvalidImapTimeoutTypeException("Invalid imap timeout type provided.");
620 620
         }
621 621
 
Please login to merge, or discard this patch.
Braces   +13 added lines, -7 removed lines patch added patch discarded remove patch
@@ -346,7 +346,9 @@  discard block
 block discarded – undo
346 346
     public function createFolder($name, $expunge = true) {
347 347
         $this->checkConnection();
348 348
         $status = imap_createmailbox($this->getConnection(), $this->getAddress() . imap_utf7_encode($name));
349
-        if($expunge) $this->expunge();
349
+        if($expunge) {
350
+            $this->expunge();
351
+        }
350 352
 
351 353
         return $status;
352 354
     }
@@ -363,7 +365,9 @@  discard block
 block discarded – undo
363 365
     public function renameFolder($old_name, $new_name, $expunge = true) {
364 366
         $this->checkConnection();
365 367
         $status = imap_renamemailbox($this->getConnection(), $this->getAddress() . imap_utf7_encode($old_name), $this->getAddress() . imap_utf7_encode($new_name));
366
-        if($expunge) $this->expunge();
368
+        if($expunge) {
369
+            $this->expunge();
370
+        }
367 371
 
368 372
         return $status;
369 373
     }
@@ -379,7 +383,9 @@  discard block
 block discarded – undo
379 383
     public function deleteFolder($name, $expunge = true) {
380 384
         $this->checkConnection();
381 385
         $status = imap_deletemailbox($this->getConnection(), $this->getAddress() . imap_utf7_encode($name));
382
-        if($expunge) $this->expunge();
386
+        if($expunge) {
387
+            $this->expunge();
388
+        }
383 389
 
384 390
         return $status;
385 391
     }
@@ -594,9 +600,9 @@  discard block
 block discarded – undo
594 600
     public function setTimeout($type, $timeout) {
595 601
         if(is_numeric($type)) {
596 602
             $type = (int) $type;
597
-        }elseif (isset($this->timeout_type[$type])){
603
+        } elseif (isset($this->timeout_type[$type])){
598 604
             $type = $this->timeout_type[$type];
599
-        }else{
605
+        } else{
600 606
             throw new InvalidImapTimeoutTypeException("Invalid imap timeout type provided.");
601 607
         }
602 608
 
@@ -613,9 +619,9 @@  discard block
 block discarded – undo
613 619
     public function getTimeout($type){
614 620
         if(is_numeric($type)) {
615 621
             $type = (int) $type;
616
-        }elseif (isset($this->timeout_type[$type])){
622
+        } elseif (isset($this->timeout_type[$type])){
617 623
             $type = $this->timeout_type[$type];
618
-        }else{
624
+        } else{
619 625
             throw new InvalidImapTimeoutTypeException("Invalid imap timeout type provided.");
620 626
         }
621 627
 
Please login to merge, or discard this patch.
src/IMAP/Folder.php 2 patches
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.
Spacing   +8 added lines, -8 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
 
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
      * @deprecated 1.2.1:2.0.0 No longer needed. Use Folder::query() instead
318 318
      * @see Folder::query()
319 319
      */
320
-    public function searchMessages(array $where, $fetch_options = null, $fetch_body = true,  $fetch_attachment = true, $fetch_flags = true, $limit = null, $page = 1, $charset = "UTF-8") {
320
+    public function searchMessages(array $where, $fetch_options = null, $fetch_body = true, $fetch_attachment = true, $fetch_flags = true, $limit = null, $page = 1, $charset = "UTF-8") {
321 321
         $this->getClient()->checkConnection();
322 322
 
323 323
         return $this->query($charset)->where($where)->setFetchOptions($fetch_options)->setFetchBody($fetch_body)
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
      */
377 377
     public function delete($expunge = true) {
378 378
         $status = imap_deletemailbox($this->client->getConnection(), $this->path);
379
-        if($expunge) $this->client->expunge();
379
+        if ($expunge) $this->client->expunge();
380 380
 
381 381
         return $status;
382 382
     }
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
      */
394 394
     public function move($target_mailbox, $expunge = true) {
395 395
         $status = imap_renamemailbox($this->client->getConnection(), $this->path, $target_mailbox);
396
-        if($expunge) $this->client->expunge();
396
+        if ($expunge) $this->client->expunge();
397 397
 
398 398
         return $status;
399 399
     }
@@ -442,8 +442,8 @@  discard block
 block discarded – undo
442 442
     /**
443 443
      * @param $delimiter
444 444
      */
445
-    public function setDelimiter($delimiter){
446
-        if(in_array($delimiter, [null, '', ' ', false]) === true) {
445
+    public function setDelimiter($delimiter) {
446
+        if (in_array($delimiter, [null, '', ' ', false]) === true) {
447 447
             $delimiter = config('imap.options.delimiter', '/');
448 448
         }
449 449
 
Please login to merge, or discard this patch.
src/IMAP/Attachment.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -227,9 +227,9 @@  discard block
 block discarded – undo
227 227
      * @param $name
228 228
      */
229 229
     public function setName($name) {
230
-        if($this->config['decoder']['message']['subject'] === 'utf-8') {
230
+        if ($this->config['decoder']['message']['subject'] === 'utf-8') {
231 231
             $this->name = imap_utf8($name);
232
-        }else{
232
+        } else {
233 233
             $this->name = mb_decode_mimeheader($name);
234 234
         }
235 235
     }
@@ -261,14 +261,14 @@  discard block
 block discarded – undo
261 261
     /**
262 262
      * @return string|null
263 263
      */
264
-    public function getMimeType(){
264
+    public function getMimeType() {
265 265
         return (new \finfo())->buffer($this->getContent(), FILEINFO_MIME_TYPE);
266 266
     }
267 267
 
268 268
     /**
269 269
      * @return string|null
270 270
      */
271
-    public function getExtension(){
271
+    public function getExtension() {
272 272
         return ExtensionGuesser::getInstance()->guess($this->getMimeType());
273 273
     }
274 274
 }
275 275
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -229,7 +229,7 @@
 block discarded – undo
229 229
     public function setName($name) {
230 230
         if($this->config['decoder']['message']['subject'] === 'utf-8') {
231 231
             $this->name = imap_utf8($name);
232
-        }else{
232
+        } else{
233 233
             $this->name = mb_decode_mimeheader($name);
234 234
         }
235 235
     }
Please login to merge, or discard this patch.
src/IMAP/Message.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
         $this->msglist = $msglist;
195 195
         $this->client = $client;
196 196
 
197
-        $this->uid =  ($this->fetch_options == FT_UID) ? $uid : $uid;
197
+        $this->uid = ($this->fetch_options == FT_UID) ? $uid : $uid;
198 198
         $this->msgn = ($this->fetch_options == FT_UID) ? imap_msgno($this->client->getConnection(), $uid) : $uid;
199 199
 
200 200
         $this->parseHeader();
@@ -303,9 +303,9 @@  discard block
 block discarded – undo
303 303
             $header = imap_rfc822_parse_headers($this->header);
304 304
         }
305 305
 
306
-        if(preg_match('/x\-priority\:.*([0-9]{1,2})/i', $this->header, $priority)){
306
+        if (preg_match('/x\-priority\:.*([0-9]{1,2})/i', $this->header, $priority)) {
307 307
             $priority = isset($priority[1]) ? (int) $priority[1] : 0;
308
-            switch($priority){
308
+            switch ($priority) {
309 309
                 case self::PRIORITY_HIGHEST;
310 310
                     $this->priority = self::PRIORITY_HIGHEST;
311 311
                     break;
@@ -328,9 +328,9 @@  discard block
 block discarded – undo
328 328
         }
329 329
 
330 330
         if (property_exists($header, 'subject')) {
331
-            if($this->config['decoder']['message']['subject'] === 'utf-8') {
331
+            if ($this->config['decoder']['message']['subject'] === 'utf-8') {
332 332
                 $this->subject = imap_utf8($header->subject);
333
-            }else{
333
+            } else {
334 334
                 $this->subject = mb_decode_mimeheader($header->subject);
335 335
             }
336 336
         }
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
              * Please report any new invalid timestamps to [#45](https://github.com/Webklex/laravel-imap/issues/45)
390 390
              */
391 391
 
392
-            if(preg_match('/\+0580/', $date)) {
392
+            if (preg_match('/\+0580/', $date)) {
393 393
                 $date = str_replace('+0580', '+0530', $date);
394 394
             }
395 395
 
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
                         $date .= 'C';
411 411
                         break;
412 412
                 }
413
-                try{
413
+                try {
414 414
                     $this->date = Carbon::parse($date);
415 415
                 } catch (\Exception $_e) {
416 416
                     throw new InvalidMessageDateException("Invalid message date. ID:".$this->getMessageId(), 1000, $e);
@@ -512,12 +512,12 @@  discard block
 block discarded – undo
512 512
     public function parseBody() {
513 513
         $structure = imap_fetchstructure($this->client->getConnection(), $this->uid, FT_UID);
514 514
 
515
-        if(property_exists($structure, 'parts')){
515
+        if (property_exists($structure, 'parts')) {
516 516
             $parts = $structure->parts;
517 517
 
518
-            foreach ($parts as $part)  {
519
-                foreach ($part->parameters as $parameter)  {
520
-                    if($parameter->attribute == "charset")  {
518
+            foreach ($parts as $part) {
519
+                foreach ($part->parameters as $parameter) {
520
+                    if ($parameter->attribute == "charset") {
521 521
                         $encoding = $parameter->value;
522 522
 
523 523
                         $encoding = preg_replace('/Content-Transfer-Encoding/', '', $encoding);
@@ -788,7 +788,7 @@  discard block
 block discarded – undo
788 788
                     return EncodingAliases::get($parameter->value);
789 789
                 }
790 790
             }
791
-        }elseif (is_string($structure) === true){
791
+        }elseif (is_string($structure) === true) {
792 792
             return mb_detect_encoding($structure);
793 793
         }
794 794
 
@@ -859,7 +859,7 @@  discard block
 block discarded – undo
859 859
      */
860 860
     public function delete($expunge = true) {
861 861
         $status = imap_delete($this->client->getConnection(), $this->uid, FT_UID);
862
-        if($expunge) $this->client->expunge();
862
+        if ($expunge) $this->client->expunge();
863 863
 
864 864
         return $status;
865 865
     }
@@ -873,7 +873,7 @@  discard block
 block discarded – undo
873 873
      */
874 874
     public function restore($expunge = true) {
875 875
         $status = imap_undelete($this->client->getConnection(), $this->uid, FT_UID);
876
-        if($expunge) $this->client->expunge();
876
+        if ($expunge) $this->client->expunge();
877 877
 
878 878
         return $status;
879 879
     }
Please login to merge, or discard this patch.
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
         if (property_exists($header, 'subject')) {
331 331
             if($this->config['decoder']['message']['subject'] === 'utf-8') {
332 332
                 $this->subject = imap_utf8($header->subject);
333
-            }else{
333
+            } else{
334 334
                 $this->subject = mb_decode_mimeheader($header->subject);
335 335
             }
336 336
         }
@@ -788,7 +788,7 @@  discard block
 block discarded – undo
788 788
                     return EncodingAliases::get($parameter->value);
789 789
                 }
790 790
             }
791
-        }elseif (is_string($structure) === true){
791
+        } elseif (is_string($structure) === true){
792 792
             return mb_detect_encoding($structure);
793 793
         }
794 794
 
@@ -859,7 +859,9 @@  discard block
 block discarded – undo
859 859
      */
860 860
     public function delete($expunge = true) {
861 861
         $status = imap_delete($this->client->getConnection(), $this->uid, FT_UID);
862
-        if($expunge) $this->client->expunge();
862
+        if($expunge) {
863
+            $this->client->expunge();
864
+        }
863 865
 
864 866
         return $status;
865 867
     }
@@ -873,7 +875,9 @@  discard block
 block discarded – undo
873 875
      */
874 876
     public function restore($expunge = true) {
875 877
         $status = imap_undelete($this->client->getConnection(), $this->uid, FT_UID);
876
-        if($expunge) $this->client->expunge();
878
+        if($expunge) {
879
+            $this->client->expunge();
880
+        }
877 881
 
878 882
         return $status;
879 883
     }
Please login to merge, or discard this patch.