Passed
Push — master ( 185543...6b0532 )
by Malte
02:33
created
src/IMAP/Client.php 2 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -338,13 +338,13 @@
 block discarded – undo
338 338
         return imap_renamemailbox($this->connection, $this->getAddress() . imap_utf7_encode($old_name), $this->getAddress() . imap_utf7_encode($new_name));
339 339
     }
340 340
     
341
-     /**
342
-     * Delete Folder
343
-     * @param string $name
344
-     *
345
-     * @return bool
346
-     * @throws ConnectionFailedException
347
-     */
341
+        /**
342
+         * Delete Folder
343
+         * @param string $name
344
+         *
345
+         * @return bool
346
+         * @throws ConnectionFailedException
347
+         */
348 348
     public function deleteFolder($name) {
349 349
         $this->checkConnection();
350 350
         return imap_deletemailbox($this->connection, $this->getAddress() . imap_utf7_encode($name));
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
      */
323 323
     public function createFolder($name) {
324 324
         $this->checkConnection();
325
-        return imap_createmailbox($this->connection, $this->getAddress() . imap_utf7_encode($name));
325
+        return imap_createmailbox($this->connection, $this->getAddress().imap_utf7_encode($name));
326 326
     }
327 327
     
328 328
     /**
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
      */
336 336
     public function renameFolder($old_name, $new_name) {
337 337
         $this->checkConnection();
338
-        return imap_renamemailbox($this->connection, $this->getAddress() . imap_utf7_encode($old_name), $this->getAddress() . imap_utf7_encode($new_name));
338
+        return imap_renamemailbox($this->connection, $this->getAddress().imap_utf7_encode($old_name), $this->getAddress().imap_utf7_encode($new_name));
339 339
     }
340 340
     
341 341
      /**
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
      */
348 348
     public function deleteFolder($name) {
349 349
         $this->checkConnection();
350
-        return imap_deletemailbox($this->connection, $this->getAddress() . imap_utf7_encode($name));
350
+        return imap_deletemailbox($this->connection, $this->getAddress().imap_utf7_encode($name));
351 351
     }
352 352
 
353 353
     /**
Please login to merge, or discard this patch.
src/IMAP/Attachment.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -238,14 +238,14 @@
 block discarded – undo
238 238
     /**
239 239
      * @return string|null
240 240
      */
241
-    public function getMimeType(){
241
+    public function getMimeType() {
242 242
         return (new \finfo())->buffer($this->getContent(), FILEINFO_MIME_TYPE);
243 243
     }
244 244
 
245 245
     /**
246 246
      * @return string|null
247 247
      */
248
-    public function getExtension(){
248
+    public function getExtension() {
249 249
         return ExtensionGuesser::getInstance()->guess($this->getMimeType());
250 250
     }
251 251
 }
252 252
\ No newline at end of file
Please login to merge, or discard this patch.
src/IMAP/Query/WhereQuery.php 2 patches
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -37,10 +37,10 @@  discard block
 block discarded – undo
37 37
      * @return string
38 38
      * @throws InvalidWhereQueryCriteriaException
39 39
      */
40
-    protected function validate_criteria($criteria){
40
+    protected function validate_criteria($criteria) {
41 41
         $criteria = strtoupper($criteria);
42 42
 
43
-        if(in_array($criteria, $this->available_criteria) === false) {
43
+        if (in_array($criteria, $this->available_criteria) === false) {
44 44
             throw new InvalidWhereQueryCriteriaException();
45 45
         }
46 46
 
@@ -54,22 +54,22 @@  discard block
 block discarded – undo
54 54
      * @return $this
55 55
      * @throws InvalidWhereQueryCriteriaException
56 56
      */
57
-    public function where($criteria, $value = null){
58
-        if(is_array($criteria)){
59
-            foreach($criteria as $arguments){
60
-                if(count($arguments) == 1){
57
+    public function where($criteria, $value = null) {
58
+        if (is_array($criteria)) {
59
+            foreach ($criteria as $arguments) {
60
+                if (count($arguments) == 1) {
61 61
                     $this->where($arguments[0]);
62
-                }elseif(count($arguments) == 2){
62
+                }elseif (count($arguments) == 2) {
63 63
                     $this->where($arguments[0], $arguments[1]);
64 64
                 }
65 65
             }
66
-        }else{
66
+        } else {
67 67
             $criteria = $this->validate_criteria($criteria);
68 68
             $value = $this->parse_value($value);
69 69
 
70
-            if($value === null || $value === ''){
70
+            if ($value === null || $value === '') {
71 71
                 $this->query->push([$criteria]);
72
-            }else{
72
+            } else {
73 73
                 $this->query->push([$criteria, $value]);
74 74
             }
75 75
         }
@@ -82,9 +82,9 @@  discard block
 block discarded – undo
82 82
      *
83 83
      * @return $this
84 84
      */
85
-    public function orWhere(\Closure $closure = null){
85
+    public function orWhere(\Closure $closure = null) {
86 86
         $this->query->push(['OR']);
87
-        if($closure !== null) $closure($this);
87
+        if ($closure !== null) $closure($this);
88 88
 
89 89
         return $this;
90 90
     }
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
      */
97 97
     public function andWhere(\Closure $closure = null) {
98 98
         $this->query->push(['AND']);
99
-        if($closure !== null) $closure($this);
99
+        if ($closure !== null) $closure($this);
100 100
 
101 101
         return $this;
102 102
     }
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
      * @return WhereQuery
106 106
      * @throws InvalidWhereQueryCriteriaException
107 107
      */
108
-    public function whereAll(){
108
+    public function whereAll() {
109 109
         return $this->where('ALL');
110 110
     }
111 111
 
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
      * @return WhereQuery
114 114
      * @throws InvalidWhereQueryCriteriaException
115 115
      */
116
-    public function whereAnswered(){
116
+    public function whereAnswered() {
117 117
         return $this->where('ANSWERED');
118 118
     }
119 119
 
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
      * @return WhereQuery
124 124
      * @throws InvalidWhereQueryCriteriaException
125 125
      */
126
-    public function whereBcc($value){
126
+    public function whereBcc($value) {
127 127
         return $this->where('BCC', $value);
128 128
     }
129 129
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
      * @return WhereQuery
134 134
      * @throws \Webklex\IMAP\Exceptions\MessageSearchValidationException
135 135
      */
136
-    public function whereBefore($value){
136
+    public function whereBefore($value) {
137 137
         $date = $this->parse_date($value);
138 138
         return $this->where('BEFORE', $date);
139 139
     }
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
      * @return WhereQuery
145 145
      * @throws InvalidWhereQueryCriteriaException
146 146
      */
147
-    public function whereBody($value){
147
+    public function whereBody($value) {
148 148
         return $this->where('BODY', $value);
149 149
     }
150 150
 
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
      * @return WhereQuery
155 155
      * @throws InvalidWhereQueryCriteriaException
156 156
      */
157
-    public function whereCc($value){
157
+    public function whereCc($value) {
158 158
         return $this->where('CC', $value);
159 159
     }
160 160
 
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
      * @return WhereQuery
163 163
      * @throws InvalidWhereQueryCriteriaException
164 164
      */
165
-    public function whereDeleted(){
165
+    public function whereDeleted() {
166 166
         return $this->where('DELETED');
167 167
     }
168 168
 
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
      * @return WhereQuery
173 173
      * @throws InvalidWhereQueryCriteriaException
174 174
      */
175
-    public function whereFlagged($value){
175
+    public function whereFlagged($value) {
176 176
         return $this->where('FLAGGED', $value);
177 177
     }
178 178
 
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
      * @return WhereQuery
183 183
      * @throws InvalidWhereQueryCriteriaException
184 184
      */
185
-    public function whereFrom($value){
185
+    public function whereFrom($value) {
186 186
         return $this->where('FROM', $value);
187 187
     }
188 188
 
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
      * @return WhereQuery
193 193
      * @throws InvalidWhereQueryCriteriaException
194 194
      */
195
-    public function whereKeyword($value){
195
+    public function whereKeyword($value) {
196 196
         return $this->where('KEYWORD', $value);
197 197
     }
198 198
 
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
      * @return WhereQuery
201 201
      * @throws InvalidWhereQueryCriteriaException
202 202
      */
203
-    public function whereNew(){
203
+    public function whereNew() {
204 204
         return $this->where('NEW');
205 205
     }
206 206
 
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
      * @return WhereQuery
209 209
      * @throws InvalidWhereQueryCriteriaException
210 210
      */
211
-    public function whereOld(){
211
+    public function whereOld() {
212 212
         return $this->where('OLD');
213 213
     }
214 214
 
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
      * @return WhereQuery
219 219
      * @throws \Webklex\IMAP\Exceptions\MessageSearchValidationException
220 220
      */
221
-    public function whereOn($value){
221
+    public function whereOn($value) {
222 222
         $date = $this->parse_date($value);
223 223
         return $this->where('ON', $date);
224 224
     }
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
      * @return WhereQuery
228 228
      * @throws InvalidWhereQueryCriteriaException
229 229
      */
230
-    public function whereRecent(){
230
+    public function whereRecent() {
231 231
         return $this->where('RECENT');
232 232
     }
233 233
 
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
      * @return WhereQuery
236 236
      * @throws InvalidWhereQueryCriteriaException
237 237
      */
238
-    public function whereSeen(){
238
+    public function whereSeen() {
239 239
         return $this->where('SEEN');
240 240
     }
241 241
 
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
      * @return WhereQuery
246 246
      * @throws \Webklex\IMAP\Exceptions\MessageSearchValidationException
247 247
      */
248
-    public function whereSince($value){
248
+    public function whereSince($value) {
249 249
         $date = $this->parse_date($value);
250 250
         return $this->where('SINCE', $date);
251 251
     }
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
      * @return WhereQuery
257 257
      * @throws InvalidWhereQueryCriteriaException
258 258
      */
259
-    public function whereSubject($value){
259
+    public function whereSubject($value) {
260 260
         return $this->where('SUBJECT', $value);
261 261
     }
262 262
 
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
      * @return WhereQuery
267 267
      * @throws InvalidWhereQueryCriteriaException
268 268
      */
269
-    public function whereText($value){
269
+    public function whereText($value) {
270 270
         return $this->where('TEXT', $value);
271 271
     }
272 272
 
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
      * @return WhereQuery
277 277
      * @throws InvalidWhereQueryCriteriaException
278 278
      */
279
-    public function whereTo($value){
279
+    public function whereTo($value) {
280 280
         return $this->where('TO', $value);
281 281
     }
282 282
 
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
      * @return WhereQuery
287 287
      * @throws InvalidWhereQueryCriteriaException
288 288
      */
289
-    public function whereUnkeyword($value){
289
+    public function whereUnkeyword($value) {
290 290
         return $this->where('UNKEYWORD', $value);
291 291
     }
292 292
 
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
      * @return WhereQuery
295 295
      * @throws InvalidWhereQueryCriteriaException
296 296
      */
297
-    public function whereUnanswered(){
297
+    public function whereUnanswered() {
298 298
         return $this->where('UNANSWERED');
299 299
     }
300 300
 
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
      * @return WhereQuery
303 303
      * @throws InvalidWhereQueryCriteriaException
304 304
      */
305
-    public function whereUndeleted(){
305
+    public function whereUndeleted() {
306 306
         return $this->where('UNDELETED');
307 307
     }
308 308
 
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
      * @return WhereQuery
311 311
      * @throws InvalidWhereQueryCriteriaException
312 312
      */
313
-    public function whereUnflagged(){
313
+    public function whereUnflagged() {
314 314
         return $this->where('UNFLAGGED');
315 315
     }
316 316
 
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
      * @return WhereQuery
319 319
      * @throws InvalidWhereQueryCriteriaException
320 320
      */
321
-    public function whereUnseen(){
321
+    public function whereUnseen() {
322 322
         return $this->where('UNSEEN');
323 323
     }
324 324
 }
325 325
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +9 added lines, -5 removed lines patch added patch discarded remove patch
@@ -59,17 +59,17 @@  discard block
 block discarded – undo
59 59
             foreach($criteria as $arguments){
60 60
                 if(count($arguments) == 1){
61 61
                     $this->where($arguments[0]);
62
-                }elseif(count($arguments) == 2){
62
+                } elseif(count($arguments) == 2){
63 63
                     $this->where($arguments[0], $arguments[1]);
64 64
                 }
65 65
             }
66
-        }else{
66
+        } else{
67 67
             $criteria = $this->validate_criteria($criteria);
68 68
             $value = $this->parse_value($value);
69 69
 
70 70
             if($value === null || $value === ''){
71 71
                 $this->query->push([$criteria]);
72
-            }else{
72
+            } else{
73 73
                 $this->query->push([$criteria, $value]);
74 74
             }
75 75
         }
@@ -84,7 +84,9 @@  discard block
 block discarded – undo
84 84
      */
85 85
     public function orWhere(\Closure $closure = null){
86 86
         $this->query->push(['OR']);
87
-        if($closure !== null) $closure($this);
87
+        if($closure !== null) {
88
+            $closure($this);
89
+        }
88 90
 
89 91
         return $this;
90 92
     }
@@ -96,7 +98,9 @@  discard block
 block discarded – undo
96 98
      */
97 99
     public function andWhere(\Closure $closure = null) {
98 100
         $this->query->push(['AND']);
99
-        if($closure !== null) $closure($this);
101
+        if($closure !== null) {
102
+            $closure($this);
103
+        }
100 104
 
101 105
         return $this;
102 106
     }
Please login to merge, or discard this patch.
src/IMAP/Query/Query.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
     /**
72 72
      * Instance boot method for additional functionality
73 73
      */
74
-    protected function boot(){}
74
+    protected function boot() {}
75 75
 
76 76
     /**
77 77
      * Parse a given value
@@ -79,8 +79,8 @@  discard block
 block discarded – undo
79 79
      *
80 80
      * @return string
81 81
      */
82
-    protected function parse_value($value){
83
-        switch(true){
82
+    protected function parse_value($value) {
83
+        switch (true) {
84 84
             case $value instanceof \Carbon\Carbon:
85 85
                 $value = $value->format('d M y');
86 86
                 break;
@@ -96,8 +96,8 @@  discard block
 block discarded – undo
96 96
      * @return Carbon
97 97
      * @throws MessageSearchValidationException
98 98
      */
99
-    protected function parse_date($date){
100
-        if($date instanceof \Carbon\Carbon) return $date;
99
+    protected function parse_date($date) {
100
+        if ($date instanceof \Carbon\Carbon) return $date;
101 101
 
102 102
         try {
103 103
             $date = Carbon::parse($date);
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
      * @return MessageCollection
115 115
      * @throws GetMessagesFailedException
116 116
      */
117
-    public function get(){
117
+    public function get() {
118 118
         $messages = MessageCollection::make([]);
119 119
 
120 120
         try {
@@ -126,13 +126,13 @@  discard block
 block discarded – undo
126 126
                 $available_messages = collect($available_messages);
127 127
                 $options = config('imap.options');
128 128
 
129
-                if(strtolower($options['fetch_order']) === 'desc'){
129
+                if (strtolower($options['fetch_order']) === 'desc') {
130 130
                     $available_messages = $available_messages->reverse();
131 131
                 }
132 132
 
133 133
                 $available_messages->forPage($this->page, $this->limit)->each(function($msgno, $msglist) use(&$messages, $options) {
134 134
                     $oMessage = new Message($msgno, $msglist, $this->getClient(), $this->getFetchOptions(), $this->getFetchBody(), $this->getFetchAttachment());
135
-                    switch ($options['message_key']){
135
+                    switch ($options['message_key']) {
136 136
                         case 'number':
137 137
                             $message_key = $oMessage->getMessageNo();
138 138
                             break;
@@ -161,15 +161,15 @@  discard block
 block discarded – undo
161 161
      *
162 162
      * @return string
163 163
      */
164
-    public function generate_query(){
164
+    public function generate_query() {
165 165
         $query = '';
166 166
         $this->query->each(function($statement) use(&$query) {
167 167
             if (count($statement) == 1) {
168 168
                 $query .= $statement[0];
169 169
             } else {
170
-                if($statement[1] === null){
170
+                if ($statement[1] === null) {
171 171
                     $query .= $statement[0];
172
-                }else{
172
+                } else {
173 173
                     $query .= $statement[0].' "'.$statement[1].'"';
174 174
                 }
175 175
             }
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
     /**
186 186
      * @return Client
187 187
      */
188
-    public function getClient(){
188
+    public function getClient() {
189 189
         $this->oClient->checkConnection();
190 190
         return $this->oClient;
191 191
     }
@@ -197,8 +197,8 @@  discard block
 block discarded – undo
197 197
      *
198 198
      * @return $this
199 199
      */
200
-    public function limit($limit, $page = 1){
201
-        if($page >= 1) $this->page = $page;
200
+    public function limit($limit, $page = 1) {
201
+        if ($page >= 1) $this->page = $page;
202 202
         $this->limit = $limit;
203 203
 
204 204
         return $this;
Please login to merge, or discard this patch.
Braces   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -97,7 +97,9 @@  discard block
 block discarded – undo
97 97
      * @throws MessageSearchValidationException
98 98
      */
99 99
     protected function parse_date($date){
100
-        if($date instanceof \Carbon\Carbon) return $date;
100
+        if($date instanceof \Carbon\Carbon) {
101
+            return $date;
102
+        }
101 103
 
102 104
         try {
103 105
             $date = Carbon::parse($date);
@@ -169,7 +171,7 @@  discard block
 block discarded – undo
169 171
             } else {
170 172
                 if($statement[1] === null){
171 173
                     $query .= $statement[0];
172
-                }else{
174
+                } else{
173 175
                     $query .= $statement[0].' "'.$statement[1].'"';
174 176
                 }
175 177
             }
@@ -198,7 +200,9 @@  discard block
 block discarded – undo
198 200
      * @return $this
199 201
      */
200 202
     public function limit($limit, $page = 1){
201
-        if($page >= 1) $this->page = $page;
203
+        if($page >= 1) {
204
+            $this->page = $page;
205
+        }
202 206
         $this->limit = $limit;
203 207
 
204 208
         return $this;
Please login to merge, or discard this patch.
src/IMAP/Message.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -432,12 +432,12 @@
 block discarded – undo
432 432
     public function parseBody() {
433 433
         $structure = imap_fetchstructure($this->client->getConnection(), $this->uid, $this->fetch_options);
434 434
 
435
-        if(property_exists($structure, 'parts')){
435
+        if (property_exists($structure, 'parts')) {
436 436
             $parts = $structure->parts;
437 437
 
438
-            foreach ($parts as $part)  {
439
-                foreach ($part->parameters as $parameter)  {
440
-                    if($parameter->attribute == "charset")  {
438
+            foreach ($parts as $part) {
439
+                foreach ($part->parameters as $parameter) {
440
+                    if ($parameter->attribute == "charset") {
441 441
                         $encoding = $parameter->value;
442 442
                         $parameter->value = preg_replace('/Content-Transfer-Encoding/', '', $encoding);
443 443
                     }
Please login to merge, or discard this patch.
src/IMAP/Folder.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
      *
131 131
      * @return WhereQuery
132 132
      */
133
-    public function query($charset = 'UTF-8'){
133
+    public function query($charset = 'UTF-8') {
134 134
         $this->getClient()->checkConnection();
135 135
         $this->getClient()->openFolder($this);
136 136
 
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
      * @deprecated 1.2.1:2.0.0 No longer needed. Use Folder::query() instead
295 295
      * @see Folder::query()
296 296
      */
297
-    public function searchMessages(array $where, $fetch_options = null, $fetch_body = true,  $fetch_attachment = true, $fetch_flags = false, $limit = null, $page = 1, $charset = "UTF-8") {
297
+    public function searchMessages(array $where, $fetch_options = null, $fetch_body = true, $fetch_attachment = true, $fetch_flags = false, $limit = null, $page = 1, $charset = "UTF-8") {
298 298
         $this->getClient()->checkConnection();
299 299
 
300 300
         return $this->query($charset)->where($where)->setFetchOptions($fetch_options)->setFetchBody($fetch_body)
Please login to merge, or discard this patch.