Passed
Push — master ( 5efdd2...b1c492 )
by Malte
02:07
created
src/Structure.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
      * @throws MessageContentFetchingException
78 78
      * @throws InvalidMessageDateException
79 79
      */
80
-    protected function parse(){
80
+    protected function parse() {
81 81
         $this->findContentType();
82 82
         $this->parts = $this->find_parts();
83 83
     }
@@ -85,12 +85,12 @@  discard block
 block discarded – undo
85 85
     /**
86 86
      * Determine the message content type
87 87
      */
88
-    public function findContentType(){
88
+    public function findContentType() {
89 89
         $content_type = $this->header->get("content_type");
90 90
         $content_type = (is_array($content_type)) ? implode(' ', $content_type) : $content_type;
91
-        if(stripos($content_type, 'multipart') === 0) {
91
+        if (stripos($content_type, 'multipart') === 0) {
92 92
             $this->type = IMAP::MESSAGE_TYPE_MULTIPART;
93
-        }else{
93
+        }else {
94 94
             $this->type = IMAP::MESSAGE_TYPE_TEXT;
95 95
         }
96 96
     }
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
      * @return Part[]
104 104
      * @throws InvalidMessageDateException
105 105
      */
106
-    private function parsePart($context, $part_number = 0){
106
+    private function parsePart($context, $part_number = 0) {
107 107
         $body = $context;
108 108
         while (($pos = strpos($body, "\r\n")) > 0) {
109 109
             $body = substr($body, $pos + 2);
@@ -126,10 +126,10 @@  discard block
 block discarded – undo
126 126
      * @return array
127 127
      * @throws InvalidMessageDateException
128 128
      */
129
-    private function detectParts($boundary, $context, $part_number = 0){
130
-        $base_parts = explode( $boundary, $context);
129
+    private function detectParts($boundary, $context, $part_number = 0) {
130
+        $base_parts = explode($boundary, $context);
131 131
         $final_parts = [];
132
-        foreach($base_parts as $ctx) {
132
+        foreach ($base_parts as $ctx) {
133 133
             $ctx = substr($ctx, 2);
134 134
             if ($ctx !== "--" && $ctx != "") {
135 135
                 $parts = $this->parsePart($ctx, $part_number);
@@ -150,9 +150,9 @@  discard block
 block discarded – undo
150 150
      * @throws MessageContentFetchingException
151 151
      * @throws InvalidMessageDateException
152 152
      */
153
-    public function find_parts(){
154
-        if($this->type === IMAP::MESSAGE_TYPE_MULTIPART) {
155
-            if (($boundary = $this->header->getBoundary()) === null)  {
153
+    public function find_parts() {
154
+        if ($this->type === IMAP::MESSAGE_TYPE_MULTIPART) {
155
+            if (($boundary = $this->header->getBoundary()) === null) {
156 156
                 throw new MessageContentFetchingException("no content found", 0);
157 157
             }
158 158
 
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
      * @return string|null
169 169
      * @Depricated since version 2.4.4
170 170
      */
171
-    public function getBoundary(){
171
+    public function getBoundary() {
172 172
         return $this->header->getBoundary();
173 173
     }
174 174
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@
 block discarded – undo
90 90
         $content_type = (is_array($content_type)) ? implode(' ', $content_type) : $content_type;
91 91
         if(stripos($content_type, 'multipart') === 0) {
92 92
             $this->type = IMAP::MESSAGE_TYPE_MULTIPART;
93
-        }else{
93
+        } else{
94 94
             $this->type = IMAP::MESSAGE_TYPE_TEXT;
95 95
         }
96 96
     }
Please login to merge, or discard this patch.
src/Query/WhereQuery.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -85,8 +85,8 @@  discard block
 block discarded – undo
85 85
         }
86 86
 
87 87
         if (strpos(strtolower($name), "where") === false) {
88
-            $method = 'where' . ucfirst($name);
89
-        } else {
88
+            $method = 'where'.ucfirst($name);
89
+        }else {
90 90
             $method = lcfirst($name);
91 91
         }
92 92
 
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
             return call_user_func_array([$that, $method], $arguments);
95 95
         }
96 96
 
97
-        throw new MethodNotFoundException("Method " . self::class . '::' . $method . '() is not supported');
97
+        throw new MethodNotFoundException("Method ".self::class.'::'.$method.'() is not supported');
98 98
     }
99 99
 
100 100
     /**
@@ -131,13 +131,13 @@  discard block
 block discarded – undo
131 131
                 }
132 132
                 return $this->where($key, $value);
133 133
             }
134
-        } else {
134
+        }else {
135 135
             $criteria = $this->validate_criteria($criteria);
136 136
             $value = $this->parse_value($value);
137 137
 
138 138
             if ($value === null || $value === '') {
139 139
                 $this->query->push([$criteria]);
140
-            } else {
140
+            }else {
141 141
                 $this->query->push([$criteria, $value]);
142 142
             }
143 143
         }
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -152,7 +152,9 @@  discard block
 block discarded – undo
152 152
      */
153 153
     public function orWhere(Closure $closure = null) {
154 154
         $this->query->push(['OR']);
155
-        if ($closure !== null) $closure($this);
155
+        if ($closure !== null) {
156
+            $closure($this);
157
+        }
156 158
 
157 159
         return $this;
158 160
     }
@@ -164,7 +166,9 @@  discard block
 block discarded – undo
164 166
      */
165 167
     public function andWhere(Closure $closure = null) {
166 168
         $this->query->push(['AND']);
167
-        if ($closure !== null) $closure($this);
169
+        if ($closure !== null) {
170
+            $closure($this);
171
+        }
168 172
 
169 173
         return $this;
170 174
     }
Please login to merge, or discard this patch.
src/Query/Query.php 2 patches
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 
96 96
         if (ClientManager::get('options.fetch_order') === 'desc') {
97 97
             $this->fetch_order = 'desc';
98
-        } else {
98
+        }else {
99 99
             $this->fetch_order = 'asc';
100 100
         }
101 101
 
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
                 break;
127 127
         }
128 128
 
129
-        return (string)$value;
129
+        return (string) $value;
130 130
     }
131 131
 
132 132
     /**
@@ -158,11 +158,11 @@  discard block
 block discarded – undo
158 158
         $this->query->each(function($statement) use (&$query) {
159 159
             if (count($statement) == 1) {
160 160
                 $query .= $statement[0];
161
-            } else {
161
+            }else {
162 162
                 if ($statement[1] === null) {
163 163
                     $query .= $statement[0];
164
-                } else {
165
-                    $query .= $statement[0] . ' "' . $statement[1] . '"';
164
+                }else {
165
+                    $query .= $statement[0].' "'.$statement[1].'"';
166 166
                 }
167 167
             }
168 168
             $query .= ' ';
@@ -247,18 +247,18 @@  discard block
 block discarded – undo
247 247
      * @throws GetMessagesFailedException
248 248
      * @throws ReflectionException
249 249
      */
250
-    protected function make($uid, $msglist, $header, $content, $flags){
250
+    protected function make($uid, $msglist, $header, $content, $flags) {
251 251
         try {
252 252
             return Message::make($uid, $msglist, $this->getClient(), $header, $content, $flags, $this->getFetchOptions(), $this->sequence);
253
-        }catch (MessageNotFoundException $e) {
253
+        } catch (MessageNotFoundException $e) {
254 254
             $this->setError($uid, $e);
255
-        }catch (RuntimeException $e) {
255
+        } catch (RuntimeException $e) {
256 256
             $this->setError($uid, $e);
257
-        }catch (MessageFlagException $e) {
257
+        } catch (MessageFlagException $e) {
258 258
             $this->setError($uid, $e);
259
-        }catch (InvalidMessageDateException $e) {
259
+        } catch (InvalidMessageDateException $e) {
260 260
             $this->setError($uid, $e);
261
-        }catch (MessageContentFetchingException $e) {
261
+        } catch (MessageContentFetchingException $e) {
262 262
             $this->setError($uid, $e);
263 263
         }
264 264
 
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
      *
276 276
      * @return string
277 277
      */
278
-    protected function getMessageKey($message_key, $msglist, $message){
278
+    protected function getMessageKey($message_key, $msglist, $message) {
279 279
         switch ($message_key) {
280 280
             case 'number':
281 281
                 $key = $message->getMessageNo();
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
                 $key = $message->getMessageId();
291 291
                 break;
292 292
         }
293
-        return (string)$key;
293
+        return (string) $key;
294 294
     }
295 295
 
296 296
     /**
@@ -782,7 +782,7 @@  discard block
 block discarded – undo
782 782
      *
783 783
      * @return boolean
784 784
      */
785
-    public function hasErrors($uid = null){
785
+    public function hasErrors($uid = null) {
786 786
         if ($uid !== null) {
787 787
             return $this->hasError($uid);
788 788
         }
@@ -795,7 +795,7 @@  discard block
 block discarded – undo
795 795
      *
796 796
      * @return boolean
797 797
      */
798
-    public function hasError($uid){
798
+    public function hasError($uid) {
799 799
         return isset($this->errors[$uid]);
800 800
     }
801 801
 
@@ -804,7 +804,7 @@  discard block
 block discarded – undo
804 804
      *
805 805
      * @return array
806 806
      */
807
-    public function errors(){
807
+    public function errors() {
808 808
         return $this->getErrors();
809 809
     }
810 810
 
@@ -813,7 +813,7 @@  discard block
 block discarded – undo
813 813
      *
814 814
      * @return array
815 815
      */
816
-    public function getErrors(){
816
+    public function getErrors() {
817 817
         return $this->errors;
818 818
     }
819 819
 
@@ -823,7 +823,7 @@  discard block
 block discarded – undo
823 823
      *
824 824
      * @return Exception|null
825 825
      */
826
-    public function error($uid){
826
+    public function error($uid) {
827 827
         return $this->getError($uid);
828 828
     }
829 829
 
@@ -833,7 +833,7 @@  discard block
 block discarded – undo
833 833
      *
834 834
      * @return Exception|null
835 835
      */
836
-    public function getError($uid){
836
+    public function getError($uid) {
837 837
         if ($this->hasError($uid)) {
838 838
             return $this->errors[$uid];
839 839
         }
Please login to merge, or discard this patch.
Braces   +14 added lines, -8 removed lines patch added patch discarded remove patch
@@ -91,7 +91,9 @@  discard block
 block discarded – undo
91 91
         $this->setClient($client);
92 92
 
93 93
         $this->sequence = ClientManager::get('options.sequence', IMAP::ST_MSGN);
94
-        if (ClientManager::get('options.fetch') === IMAP::FT_PEEK) $this->leaveUnread();
94
+        if (ClientManager::get('options.fetch') === IMAP::FT_PEEK) {
95
+            $this->leaveUnread();
96
+        }
95 97
 
96 98
         if (ClientManager::get('options.fetch_order') === 'desc') {
97 99
             $this->fetch_order = 'desc';
@@ -137,7 +139,9 @@  discard block
 block discarded – undo
137 139
      * @throws MessageSearchValidationException
138 140
      */
139 141
     protected function parse_date($date) {
140
-        if ($date instanceof Carbon) return $date;
142
+        if ($date instanceof Carbon) {
143
+            return $date;
144
+        }
141 145
 
142 146
         try {
143 147
             $date = Carbon::parse($date);
@@ -250,15 +254,15 @@  discard block
 block discarded – undo
250 254
     protected function make($uid, $msglist, $header, $content, $flags){
251 255
         try {
252 256
             return Message::make($uid, $msglist, $this->getClient(), $header, $content, $flags, $this->getFetchOptions(), $this->sequence);
253
-        }catch (MessageNotFoundException $e) {
257
+        } catch (MessageNotFoundException $e) {
254 258
             $this->setError($uid, $e);
255
-        }catch (RuntimeException $e) {
259
+        } catch (RuntimeException $e) {
256 260
             $this->setError($uid, $e);
257
-        }catch (MessageFlagException $e) {
261
+        } catch (MessageFlagException $e) {
258 262
             $this->setError($uid, $e);
259
-        }catch (InvalidMessageDateException $e) {
263
+        } catch (InvalidMessageDateException $e) {
260 264
             $this->setError($uid, $e);
261
-        }catch (MessageContentFetchingException $e) {
265
+        } catch (MessageContentFetchingException $e) {
262 266
             $this->setError($uid, $e);
263 267
         }
264 268
 
@@ -511,7 +515,9 @@  discard block
 block discarded – undo
511 515
      * @return $this
512 516
      */
513 517
     public function limit($limit, $page = 1) {
514
-        if ($page >= 1) $this->page = $page;
518
+        if ($page >= 1) {
519
+            $this->page = $page;
520
+        }
515 521
         $this->limit = $limit;
516 522
 
517 523
         return $this;
Please login to merge, or discard this patch.