Passed
Pull Request — master (#41)
by
unknown
02:49
created
src/Query/Query.php 2 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -76,11 +76,11 @@  discard block
 block discarded – undo
76 76
     public function __construct(Client $client, $charset = 'UTF-8') {
77 77
         $this->setClient($client);
78 78
 
79
-        if(ClientManager::get('options.fetch') === IMAP::FT_PEEK) $this->leaveUnread();
79
+        if (ClientManager::get('options.fetch') === IMAP::FT_PEEK) $this->leaveUnread();
80 80
 
81 81
         if (ClientManager::get('options.fetch_order') === 'desc') {
82 82
             $this->fetch_order = 'desc';
83
-        } else {
83
+        }else {
84 84
             $this->fetch_order = 'asc';
85 85
         }
86 86
 
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
     /**
95 95
      * Instance boot method for additional functionality
96 96
      */
97
-    protected function boot(){}
97
+    protected function boot() {}
98 98
 
99 99
     /**
100 100
      * Parse a given value
@@ -102,8 +102,8 @@  discard block
 block discarded – undo
102 102
      *
103 103
      * @return string
104 104
      */
105
-    protected function parse_value($value){
106
-        switch(true){
105
+    protected function parse_value($value) {
106
+        switch (true) {
107 107
             case $value instanceof \Carbon\Carbon:
108 108
                 $value = $value->format($this->date_format);
109 109
                 break;
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
      * @throws MessageSearchValidationException
121 121
      */
122 122
     protected function parse_date($date) {
123
-        if($date instanceof \Carbon\Carbon) return $date;
123
+        if ($date instanceof \Carbon\Carbon) return $date;
124 124
 
125 125
         try {
126 126
             $date = Carbon::parse($date);
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
      * @return Collection
160 160
      * @throws GetMessagesFailedException
161 161
      */
162
-    protected function search(){
162
+    protected function search() {
163 163
         $this->generate_query();
164 164
 
165 165
         try {
@@ -206,11 +206,11 @@  discard block
 block discarded – undo
206 206
                     $available_messages = $available_messages->reverse();
207 207
                 }
208 208
 
209
-                $query =& $this;
209
+                $query = & $this;
210 210
 
211 211
                 $available_messages->forPage($this->page, $this->limit)->each(function($msgno, $msglist) use(&$messages, $options, $query) {
212 212
                     $message = $query->getMessage($msgno, $msglist);
213
-                    switch ($options['message_key']){
213
+                    switch ($options['message_key']) {
214 214
                         case 'number':
215 215
                             $message_key = $message->getMessageNo();
216 216
                             break;
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 
229 229
             return $messages;
230 230
         } catch (\Exception $e) {
231
-            throw new GetMessagesFailedException($e->getMessage(),0, $e);
231
+            throw new GetMessagesFailedException($e->getMessage(), 0, $e);
232 232
         }
233 233
     }
234 234
 
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
      * @throws MessageHeaderFetchingException
246 246
      * @throws \Webklex\PHPIMAP\Exceptions\EventNotFoundException
247 247
      */
248
-    public function getMessage($msgno, $msglist = null){
248
+    public function getMessage($msgno, $msglist = null) {
249 249
         return new Message($msgno, $msglist, $this->getClient(), $this->getFetchOptions(), $this->getFetchBody(), $this->getFetchFlags());
250 250
     }
251 251
 
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
      * @return LengthAwarePaginator
259 259
      * @throws GetMessagesFailedException
260 260
      */
261
-    public function paginate($per_page = 5, $page = null, $page_name = 'imap_page'){
261
+    public function paginate($per_page = 5, $page = null, $page_name = 'imap_page') {
262 262
         if (
263 263
                $page === null
264 264
             && isset($_GET[$page_name])
@@ -284,10 +284,10 @@  discard block
 block discarded – undo
284 284
         $this->query->each(function($statement) use(&$query) {
285 285
             if (count($statement) == 1) {
286 286
                 $query .= $statement[0];
287
-            } else {
288
-                if($statement[1] === null){
287
+            }else {
288
+                if ($statement[1] === null) {
289 289
                     $query .= $statement[0];
290
-                }else{
290
+                }else {
291 291
                     $query .= $statement[0].' "'.$statement[1].'"';
292 292
                 }
293 293
             }
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
      * @return $this
318 318
      */
319 319
     public function limit($limit, $page = 1) {
320
-        if($page >= 1) $this->page = $page;
320
+        if ($page >= 1) $this->page = $page;
321 321
         $this->limit = $limit;
322 322
 
323 323
         return $this;
Please login to merge, or discard this patch.
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -76,7 +76,9 @@  discard block
 block discarded – undo
76 76
     public function __construct(Client $client, $charset = 'UTF-8') {
77 77
         $this->setClient($client);
78 78
 
79
-        if(ClientManager::get('options.fetch') === IMAP::FT_PEEK) $this->leaveUnread();
79
+        if(ClientManager::get('options.fetch') === IMAP::FT_PEEK) {
80
+            $this->leaveUnread();
81
+        }
80 82
 
81 83
         if (ClientManager::get('options.fetch_order') === 'desc') {
82 84
             $this->fetch_order = 'desc';
@@ -120,7 +122,9 @@  discard block
 block discarded – undo
120 122
      * @throws MessageSearchValidationException
121 123
      */
122 124
     protected function parse_date($date) {
123
-        if($date instanceof \Carbon\Carbon) return $date;
125
+        if($date instanceof \Carbon\Carbon) {
126
+            return $date;
127
+        }
124 128
 
125 129
         try {
126 130
             $date = Carbon::parse($date);
@@ -287,7 +291,7 @@  discard block
 block discarded – undo
287 291
             } else {
288 292
                 if($statement[1] === null){
289 293
                     $query .= $statement[0];
290
-                }else{
294
+                } else{
291 295
                     $query .= $statement[0].' "'.$statement[1].'"';
292 296
                 }
293 297
             }
@@ -317,7 +321,9 @@  discard block
 block discarded – undo
317 321
      * @return $this
318 322
      */
319 323
     public function limit($limit, $page = 1) {
320
-        if($page >= 1) $this->page = $page;
324
+        if($page >= 1) {
325
+            $this->page = $page;
326
+        }
321 327
         $this->limit = $limit;
322 328
 
323 329
         return $this;
Please login to merge, or discard this patch.