Completed
Push — master ( 356432...a057f2 )
by Malte
03:01
created
src/Query/Query.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -80,11 +80,11 @@  discard block
 block discarded – undo
80 80
         $this->setClient($client);
81 81
 
82 82
         $this->sequence = ClientManager::get('options.sequence', IMAP::ST_MSGN);
83
-        if(ClientManager::get('options.fetch') === IMAP::FT_PEEK) $this->leaveUnread();
83
+        if (ClientManager::get('options.fetch') === IMAP::FT_PEEK) $this->leaveUnread();
84 84
 
85 85
         if (ClientManager::get('options.fetch_order') === 'desc') {
86 86
             $this->fetch_order = 'desc';
87
-        } else {
87
+        }else {
88 88
             $this->fetch_order = 'asc';
89 89
         }
90 90
 
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
     /**
99 99
      * Instance boot method for additional functionality
100 100
      */
101
-    protected function boot(){}
101
+    protected function boot() {}
102 102
 
103 103
     /**
104 104
      * Parse a given value
@@ -106,8 +106,8 @@  discard block
 block discarded – undo
106 106
      *
107 107
      * @return string
108 108
      */
109
-    protected function parse_value($value){
110
-        switch(true){
109
+    protected function parse_value($value) {
110
+        switch (true) {
111 111
             case $value instanceof \Carbon\Carbon:
112 112
                 $value = $value->format($this->date_format);
113 113
                 break;
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
      * @throws MessageSearchValidationException
125 125
      */
126 126
     protected function parse_date($date) {
127
-        if($date instanceof \Carbon\Carbon) return $date;
127
+        if ($date instanceof \Carbon\Carbon) return $date;
128 128
 
129 129
         try {
130 130
             $date = Carbon::parse($date);
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
      * @return Collection
176 176
      * @throws GetMessagesFailedException
177 177
      */
178
-    protected function search(){
178
+    protected function search() {
179 179
         $this->generate_query();
180 180
 
181 181
         try {
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
                     $raw_flag = isset($raw_flags[$uid]) ? $raw_flags[$uid] : [];
241 241
 
242 242
                     $message = Message::make($uid, $msglist, $this->getClient(), $raw_header, $raw_content, $raw_flag, $this->getFetchOptions(), $this->sequence);
243
-                    switch ($message_key){
243
+                    switch ($message_key) {
244 244
                         case 'number':
245 245
                             $key = $message->getMessageNo();
246 246
                             break;
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 
263 263
             return $messages;
264 264
         } catch (\Exception $e) {
265
-            throw new GetMessagesFailedException($e->getMessage(),0, $e);
265
+            throw new GetMessagesFailedException($e->getMessage(), 0, $e);
266 266
         }
267 267
     }
268 268
 
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
      * @throws \Webklex\PHPIMAP\Exceptions\EventNotFoundException
282 282
      * @throws \Webklex\PHPIMAP\Exceptions\MessageFlagException
283 283
      */
284
-    public function getMessage($uid, $msglist = null, $sequence = null){
284
+    public function getMessage($uid, $msglist = null, $sequence = null) {
285 285
         return new Message($uid, $msglist, $this->getClient(), $this->getFetchOptions(), $this->getFetchBody(), $this->getFetchFlags(), $sequence ? $sequence : $this->sequence);
286 286
     }
287 287
 
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
      * @throws \Webklex\PHPIMAP\Exceptions\EventNotFoundException
300 300
      * @throws \Webklex\PHPIMAP\Exceptions\MessageFlagException
301 301
      */
302
-    public function getMessageByMsgn($msgn, $msglist = null){
302
+    public function getMessageByMsgn($msgn, $msglist = null) {
303 303
         return $this->getMessage($msgn, $msglist, IMAP::ST_MSGN);
304 304
     }
305 305
 
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
      * @throws \Webklex\PHPIMAP\Exceptions\EventNotFoundException
317 317
      * @throws \Webklex\PHPIMAP\Exceptions\MessageFlagException
318 318
      */
319
-    public function getMessageByUid($uid){
319
+    public function getMessageByUid($uid) {
320 320
         return $this->getMessage($uid, null, IMAP::ST_UID);
321 321
     }
322 322
 
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
      * @return LengthAwarePaginator
330 330
      * @throws GetMessagesFailedException
331 331
      */
332
-    public function paginate($per_page = 5, $page = null, $page_name = 'imap_page'){
332
+    public function paginate($per_page = 5, $page = null, $page_name = 'imap_page') {
333 333
         if (
334 334
                $page === null
335 335
             && isset($_GET[$page_name])
@@ -355,10 +355,10 @@  discard block
 block discarded – undo
355 355
         $this->query->each(function($statement) use(&$query) {
356 356
             if (count($statement) == 1) {
357 357
                 $query .= $statement[0];
358
-            } else {
359
-                if($statement[1] === null){
358
+            }else {
359
+                if ($statement[1] === null) {
360 360
                     $query .= $statement[0];
361
-                }else{
361
+                }else {
362 362
                     $query .= $statement[0].' "'.$statement[1].'"';
363 363
                 }
364 364
             }
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
      * @return $this
389 389
      */
390 390
     public function limit($limit, $page = 1) {
391
-        if($page >= 1) $this->page = $page;
391
+        if ($page >= 1) $this->page = $page;
392 392
         $this->limit = $limit;
393 393
 
394 394
         return $this;
Please login to merge, or discard this patch.