Completed
Pull Request — master (#250)
by Koen
05:10
created
src/IMAP/Attachment.php 2 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
         $this->part_number = ($part_number) ? $part_number : $this->part_number;
95 95
 
96 96
         $default_mask = $this->oMessage->getClient()->getDefaultAttachmentMask();
97
-        if($default_mask != null) {
97
+        if ($default_mask != null) {
98 98
             $this->mask = $default_mask;
99 99
         }
100 100
 
@@ -111,10 +111,10 @@  discard block
 block discarded – undo
111 111
      * @throws MethodNotFoundException
112 112
      */
113 113
     public function __call($method, $arguments) {
114
-        if(strtolower(substr($method, 0, 3)) === 'get') {
114
+        if (strtolower(substr($method, 0, 3)) === 'get') {
115 115
             $name = Str::snake(substr($method, 3));
116 116
 
117
-            if(isset($this->attributes[$name])) {
117
+            if (isset($this->attributes[$name])) {
118 118
                 return $this->attributes[$name];
119 119
             }
120 120
 
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
      * @return mixed|null
149 149
      */
150 150
     public function __get($name) {
151
-        if(isset($this->attributes[$name])) {
151
+        if (isset($this->attributes[$name])) {
152 152
             return $this->attributes[$name];
153 153
         }
154 154
 
@@ -256,9 +256,9 @@  discard block
 block discarded – undo
256 256
      * @param $name
257 257
      */
258 258
     public function setName($name) {
259
-        if($this->config['decoder']['message']['subject'] === 'utf-8') {
259
+        if ($this->config['decoder']['message']['subject'] === 'utf-8') {
260 260
             $this->name = imap_utf8($name);
261
-        }else{
261
+        } else {
262 262
             $this->name = mb_decode_mimeheader($name);
263 263
         }
264 264
     }
@@ -278,28 +278,28 @@  discard block
 block discarded – undo
278 278
     /**
279 279
      * @return string|null
280 280
      */
281
-    public function getMimeType(){
281
+    public function getMimeType() {
282 282
         return (new \finfo())->buffer($this->getContent(), FILEINFO_MIME_TYPE);
283 283
     }
284 284
 
285 285
     /**
286 286
      * @return string|null
287 287
      */
288
-    public function getExtension(){
288
+    public function getExtension() {
289 289
         return ExtensionGuesser::getInstance()->guess($this->getMimeType());
290 290
     }
291 291
 
292 292
     /**
293 293
      * @return array
294 294
      */
295
-    public function getAttributes(){
295
+    public function getAttributes() {
296 296
         return $this->attributes;
297 297
     }
298 298
 
299 299
     /**
300 300
      * @return Message
301 301
      */
302
-    public function getMessage(){
302
+    public function getMessage() {
303 303
         return $this->oMessage;
304 304
     }
305 305
 
@@ -307,8 +307,8 @@  discard block
 block discarded – undo
307 307
      * @param $mask
308 308
      * @return $this
309 309
      */
310
-    public function setMask($mask){
311
-        if(class_exists($mask)){
310
+    public function setMask($mask) {
311
+        if (class_exists($mask)) {
312 312
             $this->mask = $mask;
313 313
         }
314 314
 
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
     /**
319 319
      * @return string
320 320
      */
321
-    public function getMask(){
321
+    public function getMask() {
322 322
         return $this->mask;
323 323
     }
324 324
 
@@ -329,9 +329,9 @@  discard block
 block discarded – undo
329 329
      * @return mixed
330 330
      * @throws MaskNotFoundException
331 331
      */
332
-    public function mask($mask = null){
332
+    public function mask($mask = null) {
333 333
         $mask = $mask !== null ? $mask : $this->mask;
334
-        if(class_exists($mask)){
334
+        if (class_exists($mask)) {
335 335
             return new $mask($this);
336 336
         }
337 337
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
             }
120 120
 
121 121
             return null;
122
-        }elseif (strtolower(substr($method, 0, 3)) === 'set') {
122
+        } elseif (strtolower(substr($method, 0, 3)) === 'set') {
123 123
             $name = Str::snake(substr($method, 3));
124 124
 
125 125
             $this->attributes[$name] = array_pop($arguments);
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
     public function setName($name) {
259 259
         if($this->config['decoder']['message']['subject'] === 'utf-8') {
260 260
             $this->name = imap_utf8($name);
261
-        }else{
261
+        } else{
262 262
             $this->name = mb_decode_mimeheader($name);
263 263
         }
264 264
     }
Please login to merge, or discard this patch.
src/IMAP/Support/Masks/Mask.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
     public function __construct($parent) {
40 40
         $this->parent = $parent;
41 41
 
42
-        if(method_exists($this->parent, 'getAttributes')){
42
+        if (method_exists($this->parent, 'getAttributes')) {
43 43
             $this->attributes = array_merge($this->attributes, $this->parent->getAttributes());
44 44
         }
45 45
 
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
     /**
50 50
      * Boot method made to be used by any custom mask
51 51
      */
52
-    protected function boot(){}
52
+    protected function boot() {}
53 53
 
54 54
     /**
55 55
      * Call dynamic attribute setter and getter methods and inherit the parent calls
@@ -60,17 +60,17 @@  discard block
 block discarded – undo
60 60
      * @throws MethodNotFoundException
61 61
      */
62 62
     public function __call($method, $arguments) {
63
-        if(strtolower(substr($method, 0, 3)) === 'get') {
63
+        if (strtolower(substr($method, 0, 3)) === 'get') {
64 64
             $name = Str::snake(substr($method, 3));
65 65
 
66
-            if(isset($this->attributes[$name])) {
66
+            if (isset($this->attributes[$name])) {
67 67
                 return $this->attributes[$name];
68 68
             }
69 69
 
70 70
         }elseif (strtolower(substr($method, 0, 3)) === 'set') {
71 71
             $name = Str::snake(substr($method, 3));
72 72
 
73
-            if(isset($this->attributes[$name])) {
73
+            if (isset($this->attributes[$name])) {
74 74
                 $this->attributes[$name] = array_pop($arguments);
75 75
 
76 76
                 return $this->attributes[$name];
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 
79 79
         }
80 80
 
81
-        if(method_exists($this->parent, $method) === true){
81
+        if (method_exists($this->parent, $method) === true) {
82 82
             return call_user_func_array([$this->parent, $method], $arguments);
83 83
         }
84 84
 
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
      * @return mixed|null
104 104
      */
105 105
     public function __get($name) {
106
-        if(isset($this->attributes[$name])) {
106
+        if (isset($this->attributes[$name])) {
107 107
             return $this->attributes[$name];
108 108
         }
109 109
 
@@ -113,14 +113,14 @@  discard block
 block discarded – undo
113 113
     /**
114 114
      * @return mixed
115 115
      */
116
-    public function getParent(){
116
+    public function getParent() {
117 117
         return $this->parent;
118 118
     }
119 119
 
120 120
     /**
121 121
      * @return array
122 122
      */
123
-    public function getAttributes(){
123
+    public function getAttributes() {
124 124
         return $this->attributes;
125 125
     }
126 126
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@
 block discarded – undo
67 67
                 return $this->attributes[$name];
68 68
             }
69 69
 
70
-        }elseif (strtolower(substr($method, 0, 3)) === 'set') {
70
+        } elseif (strtolower(substr($method, 0, 3)) === 'set') {
71 71
             $name = Str::snake(substr($method, 3));
72 72
 
73 73
             if(isset($this->attributes[$name])) {
Please login to merge, or discard this patch.
src/IMAP/Message.php 2 patches
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
     public function __construct($uid, $msglist, Client $client, $fetch_options = null, $fetch_body = false, $fetch_attachment = false, $fetch_flags = false) {
198 198
 
199 199
         $default_mask = $client->getDefaultMessageMask();
200
-        if($default_mask != null) {
200
+        if ($default_mask != null) {
201 201
             $this->mask = $default_mask;
202 202
         }
203 203
 
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
         $this->msglist = $msglist;
217 217
         $this->client = $client;
218 218
 
219
-        $this->uid =  ($this->fetch_options == IMAP::FT_UID) ? $uid : $uid;
219
+        $this->uid = ($this->fetch_options == IMAP::FT_UID) ? $uid : $uid;
220 220
         $this->msgn = ($this->fetch_options == IMAP::FT_UID) ? imap_msgno($this->client->getConnection(), $uid) : $uid;
221 221
 
222 222
         $this->parseHeader();
@@ -239,17 +239,17 @@  discard block
 block discarded – undo
239 239
      * @throws MethodNotFoundException
240 240
      */
241 241
     public function __call($method, $arguments) {
242
-        if(strtolower(substr($method, 0, 3)) === 'get') {
242
+        if (strtolower(substr($method, 0, 3)) === 'get') {
243 243
             $name = Str::snake(substr($method, 3));
244 244
 
245
-            if(in_array($name, array_keys($this->attributes))) {
245
+            if (in_array($name, array_keys($this->attributes))) {
246 246
                 return $this->attributes[$name];
247 247
             }
248 248
 
249 249
         }elseif (strtolower(substr($method, 0, 3)) === 'set') {
250 250
             $name = Str::snake(substr($method, 3));
251 251
 
252
-            if(in_array($name, array_keys($this->attributes))) {
252
+            if (in_array($name, array_keys($this->attributes))) {
253 253
                 $this->attributes[$name] = array_pop($arguments);
254 254
 
255 255
                 return $this->attributes[$name];
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
      * @return mixed|null
279 279
      */
280 280
     public function __get($name) {
281
-        if(isset($this->attributes[$name])) {
281
+        if (isset($this->attributes[$name])) {
282 282
             return $this->attributes[$name];
283 283
         }
284 284
 
@@ -364,11 +364,11 @@  discard block
 block discarded – undo
364 364
         if ($replaceImages !== false) {
365 365
             $this->attachments->each(function($oAttachment) use(&$body, $replaceImages) {
366 366
                 /** @var Attachment $oAttachment */
367
-                if(is_callable($replaceImages)) {
367
+                if (is_callable($replaceImages)) {
368 368
                     $body = $replaceImages($body, $oAttachment);
369
-                }elseif(is_string($replaceImages)) {
369
+                }elseif (is_string($replaceImages)) {
370 370
                     call_user_func($replaceImages, [$body, $oAttachment]);
371
-                }else{
371
+                } else {
372 372
                     if ($oAttachment->id && $oAttachment->getImgSrc() != null) {
373 373
                         $body = str_replace('cid:'.$oAttachment->id, $oAttachment->getImgSrc(), $body);
374 374
                     }
@@ -397,14 +397,14 @@  discard block
 block discarded – undo
397 397
         }
398 398
 
399 399
         if (property_exists($header, 'subject')) {
400
-            if($this->config['decoder']['message']['subject'] === 'utf-8') {
400
+            if ($this->config['decoder']['message']['subject'] === 'utf-8') {
401 401
                 $this->subject = imap_utf8($header->subject);
402
-            }else{
402
+            } else {
403 403
                 $this->subject = mb_decode_mimeheader($header->subject);
404 404
             }
405 405
         }
406 406
 
407
-        foreach(['from', 'to', 'cc', 'bcc', 'reply_to', 'sender'] as $part){
407
+        foreach (['from', 'to', 'cc', 'bcc', 'reply_to', 'sender'] as $part) {
408 408
             $this->extractHeaderAddressPart($header, $part);
409 409
         }
410 410
 
@@ -434,9 +434,9 @@  discard block
 block discarded – undo
434 434
      * @return int|null
435 435
      */
436 436
     private function extractPriority($header) {
437
-        if(preg_match('/x\-priority\:.*([0-9]{1,2})/i', $header, $priority)){
437
+        if (preg_match('/x\-priority\:.*([0-9]{1,2})/i', $header, $priority)) {
438 438
             $priority = isset($priority[1]) ? (int) $priority[1] : 0;
439
-            switch($priority){
439
+            switch ($priority) {
440 440
                 case IMAP::MESSAGE_PRIORITY_HIGHEST;
441 441
                     $priority = IMAP::MESSAGE_PRIORITY_HIGHEST;
442 442
                     break;
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
         if (property_exists($header, 'date')) {
488 488
             $date = $header->date;
489 489
 
490
-            if(preg_match('/\+0580/', $date)) {
490
+            if (preg_match('/\+0580/', $date)) {
491 491
                 $date = str_replace('+0580', '+0530', $date);
492 492
             }
493 493
 
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
                         $date = trim(array_pop($array));
510 510
                         break;
511 511
                 }
512
-                try{
512
+                try {
513 513
                     $parsed_date = Carbon::parse($date);
514 514
                 } catch (\Exception $_e) {
515 515
                     throw new InvalidMessageDateException("Invalid message date. ID:".$this->getMessageId(), 1000, $e);
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
         $this->client->openFolder($this->folder_path);
533 533
         $flags = imap_fetch_overview($this->client->getConnection(), $this->uid, IMAP::FT_UID);
534 534
         if (is_array($flags) && isset($flags[0])) {
535
-            foreach($this->available_flags as $flag) {
535
+            foreach ($this->available_flags as $flag) {
536 536
                 $this->parseFlag($flags, $flag);
537 537
             }
538 538
         }
@@ -629,12 +629,12 @@  discard block
 block discarded – undo
629 629
         $this->client->openFolder($this->folder_path);
630 630
         $this->structure = imap_fetchstructure($this->client->getConnection(), $this->uid, IMAP::FT_UID);
631 631
 
632
-        if(property_exists($this->structure, 'parts')){
632
+        if (property_exists($this->structure, 'parts')) {
633 633
             $parts = $this->structure->parts;
634 634
 
635
-            foreach ($parts as $part)  {
636
-                foreach ($part->parameters as $parameter)  {
637
-                    if($parameter->attribute == "charset")  {
635
+            foreach ($parts as $part) {
636
+                foreach ($part->parameters as $parameter) {
637
+                    if ($parameter->attribute == "charset") {
638 638
                         $encoding = $parameter->value;
639 639
 
640 640
                         $encoding = preg_replace('/Content-Transfer-Encoding/', '', $encoding);
@@ -915,7 +915,7 @@  discard block
 block discarded – undo
915 915
                     return EncodingAliases::get($parameter->value);
916 916
                 }
917 917
             }
918
-        }elseif (is_string($structure) === true){
918
+        }elseif (is_string($structure) === true) {
919 919
             return mb_detect_encoding($structure);
920 920
         }
921 921
 
@@ -965,7 +965,7 @@  discard block
 block discarded – undo
965 965
         return null;
966 966
     }
967 967
 
968
-    public function getFolder(){
968
+    public function getFolder() {
969 969
         return $this->client->getFolder($this->folder_path);
970 970
     }
971 971
 
@@ -981,7 +981,7 @@  discard block
 block discarded – undo
981 981
      */
982 982
     public function moveToFolder($mailbox = 'INBOX', $expunge = false, $create_folder = true) {
983 983
 
984
-        if($create_folder) $this->client->createFolder($mailbox, true);
984
+        if ($create_folder) $this->client->createFolder($mailbox, true);
985 985
 
986 986
         $target_folder = $this->client->getFolder($mailbox);
987 987
         $target_status = $target_folder->getStatus(IMAP::SA_ALL);
@@ -989,8 +989,8 @@  discard block
 block discarded – undo
989 989
         $this->client->openFolder($this->folder_path);
990 990
         $status = imap_mail_move($this->client->getConnection(), $this->uid, $mailbox, IMAP::CP_UID);
991 991
 
992
-        if($status === true){
993
-            if($expunge) $this->client->expunge();
992
+        if ($status === true) {
993
+            if ($expunge) $this->client->expunge();
994 994
             $this->client->openFolder($target_folder->path);
995 995
 
996 996
             return $target_folder->getMessage($target_status->uidnext, null, $this->fetch_options, $this->fetch_body, $this->fetch_attachment, $this->fetch_flags);
@@ -1010,7 +1010,7 @@  discard block
 block discarded – undo
1010 1010
         $this->client->openFolder($this->folder_path);
1011 1011
 
1012 1012
         $status = imap_delete($this->client->getConnection(), $this->uid, IMAP::FT_UID);
1013
-        if($expunge) $this->client->expunge();
1013
+        if ($expunge) $this->client->expunge();
1014 1014
 
1015 1015
         return $status;
1016 1016
     }
@@ -1026,7 +1026,7 @@  discard block
 block discarded – undo
1026 1026
         $this->client->openFolder($this->folder_path);
1027 1027
 
1028 1028
         $status = imap_undelete($this->client->getConnection(), $this->uid, IMAP::FT_UID);
1029
-        if($expunge) $this->client->expunge();
1029
+        if ($expunge) $this->client->expunge();
1030 1030
 
1031 1031
         return $status;
1032 1032
     }
@@ -1156,7 +1156,7 @@  discard block
 block discarded – undo
1156 1156
     /**
1157 1157
      * @return object|null
1158 1158
      */
1159
-    public function getStructure(){
1159
+    public function getStructure() {
1160 1160
         return $this->structure;
1161 1161
     }
1162 1162
 
@@ -1182,7 +1182,7 @@  discard block
 block discarded – undo
1182 1182
     /**
1183 1183
      * @return array
1184 1184
      */
1185
-    public function getAttributes(){
1185
+    public function getAttributes() {
1186 1186
         return $this->attributes;
1187 1187
     }
1188 1188
 
@@ -1190,8 +1190,8 @@  discard block
 block discarded – undo
1190 1190
      * @param $mask
1191 1191
      * @return $this
1192 1192
      */
1193
-    public function setMask($mask){
1194
-        if(class_exists($mask)){
1193
+    public function setMask($mask) {
1194
+        if (class_exists($mask)) {
1195 1195
             $this->mask = $mask;
1196 1196
         }
1197 1197
 
@@ -1201,7 +1201,7 @@  discard block
 block discarded – undo
1201 1201
     /**
1202 1202
      * @return string
1203 1203
      */
1204
-    public function getMask(){
1204
+    public function getMask() {
1205 1205
         return $this->mask;
1206 1206
     }
1207 1207
 
@@ -1212,9 +1212,9 @@  discard block
 block discarded – undo
1212 1212
      * @return mixed
1213 1213
      * @throws MaskNotFoundException
1214 1214
      */
1215
-    public function mask($mask = null){
1215
+    public function mask($mask = null) {
1216 1216
         $mask = $mask !== null ? $mask : $this->mask;
1217
-        if(class_exists($mask)){
1217
+        if (class_exists($mask)) {
1218 1218
             return new $mask($this);
1219 1219
         }
1220 1220
 
Please login to merge, or discard this patch.
Braces   +17 added lines, -9 removed lines patch added patch discarded remove patch
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
                 return $this->attributes[$name];
247 247
             }
248 248
 
249
-        }elseif (strtolower(substr($method, 0, 3)) === 'set') {
249
+        } elseif (strtolower(substr($method, 0, 3)) === 'set') {
250 250
             $name = Str::snake(substr($method, 3));
251 251
 
252 252
             if(in_array($name, array_keys($this->attributes))) {
@@ -366,9 +366,9 @@  discard block
 block discarded – undo
366 366
                 /** @var Attachment $oAttachment */
367 367
                 if(is_callable($replaceImages)) {
368 368
                     $body = $replaceImages($body, $oAttachment);
369
-                }elseif(is_string($replaceImages)) {
369
+                } elseif(is_string($replaceImages)) {
370 370
                     call_user_func($replaceImages, [$body, $oAttachment]);
371
-                }else{
371
+                } else{
372 372
                     if ($oAttachment->id && $oAttachment->getImgSrc() != null) {
373 373
                         $body = str_replace('cid:'.$oAttachment->id, $oAttachment->getImgSrc(), $body);
374 374
                     }
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
         if (property_exists($header, 'subject')) {
400 400
             if($this->config['decoder']['message']['subject'] === 'utf-8') {
401 401
                 $this->subject = imap_utf8($header->subject);
402
-            }else{
402
+            } else{
403 403
                 $this->subject = mb_decode_mimeheader($header->subject);
404 404
             }
405 405
         }
@@ -915,7 +915,7 @@  discard block
 block discarded – undo
915 915
                     return EncodingAliases::get($parameter->value);
916 916
                 }
917 917
             }
918
-        }elseif (is_string($structure) === true){
918
+        } elseif (is_string($structure) === true){
919 919
             return mb_detect_encoding($structure);
920 920
         }
921 921
 
@@ -981,7 +981,9 @@  discard block
 block discarded – undo
981 981
      */
982 982
     public function moveToFolder($mailbox = 'INBOX', $expunge = false, $create_folder = true) {
983 983
 
984
-        if($create_folder) $this->client->createFolder($mailbox, true);
984
+        if($create_folder) {
985
+            $this->client->createFolder($mailbox, true);
986
+        }
985 987
 
986 988
         $target_folder = $this->client->getFolder($mailbox);
987 989
         $target_status = $target_folder->getStatus(IMAP::SA_ALL);
@@ -990,7 +992,9 @@  discard block
 block discarded – undo
990 992
         $status = imap_mail_move($this->client->getConnection(), $this->uid, $mailbox, IMAP::CP_UID);
991 993
 
992 994
         if($status === true){
993
-            if($expunge) $this->client->expunge();
995
+            if($expunge) {
996
+                $this->client->expunge();
997
+            }
994 998
             $this->client->openFolder($target_folder->path);
995 999
 
996 1000
             return $target_folder->getMessage($target_status->uidnext, null, $this->fetch_options, $this->fetch_body, $this->fetch_attachment, $this->fetch_flags);
@@ -1010,7 +1014,9 @@  discard block
 block discarded – undo
1010 1014
         $this->client->openFolder($this->folder_path);
1011 1015
 
1012 1016
         $status = imap_delete($this->client->getConnection(), $this->uid, IMAP::FT_UID);
1013
-        if($expunge) $this->client->expunge();
1017
+        if($expunge) {
1018
+            $this->client->expunge();
1019
+        }
1014 1020
 
1015 1021
         return $status;
1016 1022
     }
@@ -1026,7 +1032,9 @@  discard block
 block discarded – undo
1026 1032
         $this->client->openFolder($this->folder_path);
1027 1033
 
1028 1034
         $status = imap_undelete($this->client->getConnection(), $this->uid, IMAP::FT_UID);
1029
-        if($expunge) $this->client->expunge();
1035
+        if($expunge) {
1036
+            $this->client->expunge();
1037
+        }
1030 1038
 
1031 1039
         return $status;
1032 1040
     }
Please login to merge, or discard this patch.
src/IMAP/Query/WhereQuery.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -76,13 +76,13 @@  discard block
 block discarded – undo
76 76
 
77 77
         $name = Str::camel($name);
78 78
 
79
-        if(strtolower(substr($name, 0, 3)) === 'not') {
79
+        if (strtolower(substr($name, 0, 3)) === 'not') {
80 80
             $that = $that->whereNot();
81 81
             $name = substr($name, 3);
82 82
         }
83 83
 
84 84
         $method = 'where'.ucfirst($name);
85
-        if(method_exists($this, $method) === true){
85
+        if (method_exists($this, $method) === true) {
86 86
             return call_user_func_array([$that, $method], $arguments);
87 87
         }
88 88
 
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
     protected function validate_criteria($criteria) {
100 100
         $criteria = strtoupper($criteria);
101 101
 
102
-        if(in_array($criteria, $this->available_criteria) === false) {
102
+        if (in_array($criteria, $this->available_criteria) === false) {
103 103
             throw new InvalidWhereQueryCriteriaException();
104 104
         }
105 105
 
@@ -114,21 +114,21 @@  discard block
 block discarded – undo
114 114
      * @throws InvalidWhereQueryCriteriaException
115 115
      */
116 116
     public function where($criteria, $value = null) {
117
-        if(is_array($criteria)){
118
-            foreach($criteria as $arguments){
119
-                if(count($arguments) == 1){
117
+        if (is_array($criteria)) {
118
+            foreach ($criteria as $arguments) {
119
+                if (count($arguments) == 1) {
120 120
                     $this->where($arguments[0]);
121
-                }elseif(count($arguments) == 2){
121
+                }elseif (count($arguments) == 2) {
122 122
                     $this->where($arguments[0], $arguments[1]);
123 123
                 }
124 124
             }
125
-        }else{
125
+        } else {
126 126
             $criteria = $this->validate_criteria($criteria);
127 127
             $value = $this->parse_value($value);
128 128
 
129
-            if($value === null || $value === ''){
129
+            if ($value === null || $value === '') {
130 130
                 $this->query->push([$criteria]);
131
-            }else{
131
+            } else {
132 132
                 $this->query->push([$criteria, $value]);
133 133
             }
134 134
         }
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
      */
144 144
     public function orWhere(\Closure $closure = null) {
145 145
         $this->query->push(['OR']);
146
-        if($closure !== null) $closure($this);
146
+        if ($closure !== null) $closure($this);
147 147
 
148 148
         return $this;
149 149
     }
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
      */
156 156
     public function andWhere(\Closure $closure = null) {
157 157
         $this->query->push(['AND']);
158
-        if($closure !== null) $closure($this);
158
+        if ($closure !== null) $closure($this);
159 159
 
160 160
         return $this;
161 161
     }
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
      * @return WhereQuery
406 406
      * @throws InvalidWhereQueryCriteriaException
407 407
      */
408
-    public function whereNoXSpam(){
408
+    public function whereNoXSpam() {
409 409
         return $this->where("X-Spam-Flag NO");
410 410
     }
411 411
 
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
      * @return WhereQuery
414 414
      * @throws InvalidWhereQueryCriteriaException
415 415
      */
416
-    public function whereIsXSpam(){
416
+    public function whereIsXSpam() {
417 417
         return $this->where("X-Spam-Flag YES");
418 418
     }
419 419
 
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
      * @return WhereQuery
424 424
      * @throws InvalidWhereQueryCriteriaException
425 425
      */
426
-    public function whereLanguage($country_code){
426
+    public function whereLanguage($country_code) {
427 427
         return $this->where("Content-Language $country_code");
428 428
     }
429 429
 }
Please login to merge, or discard this patch.