Completed
Pull Request — master (#14)
by
unknown
01:41
created
src/Query/Query.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -252,7 +252,7 @@
 block discarded – undo
252 252
      */
253 253
     public function paginate($per_page = 5, $page = null, $page_name = 'imap_page'){
254 254
         if (
255
-               $page === null
255
+                $page === null
256 256
             && isset($_GET[$page_name])
257 257
             && $_GET[$page_name] > 0
258 258
         ) {
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
     public function __construct(Client $client, $charset = 'UTF-8') {
74 74
         $this->setClient($client);
75 75
 
76
-        if(ClientManager::get('options.fetch') === IMAP::FT_PEEK) $this->leaveUnread();
76
+        if (ClientManager::get('options.fetch') === IMAP::FT_PEEK) $this->leaveUnread();
77 77
 
78 78
         $this->date_format = ClientManager::get('date_format', 'd M y');
79 79
 
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
     /**
86 86
      * Instance boot method for additional functionality
87 87
      */
88
-    protected function boot(){}
88
+    protected function boot() {}
89 89
 
90 90
     /**
91 91
      * Parse a given value
@@ -93,8 +93,8 @@  discard block
 block discarded – undo
93 93
      *
94 94
      * @return string
95 95
      */
96
-    protected function parse_value($value){
97
-        switch(true){
96
+    protected function parse_value($value) {
97
+        switch (true) {
98 98
             case $value instanceof \Carbon\Carbon:
99 99
                 $value = $value->format($this->date_format);
100 100
                 break;
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
      * @throws MessageSearchValidationException
112 112
      */
113 113
     protected function parse_date($date) {
114
-        if($date instanceof \Carbon\Carbon) return $date;
114
+        if ($date instanceof \Carbon\Carbon) return $date;
115 115
 
116 116
         try {
117 117
             $date = Carbon::parse($date);
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
      * @return Collection
151 151
      * @throws GetMessagesFailedException
152 152
      */
153
-    protected function search(){
153
+    protected function search() {
154 154
         $this->generate_query();
155 155
 
156 156
         try {
@@ -195,15 +195,15 @@  discard block
 block discarded – undo
195 195
 
196 196
                 $options = ClientManager::get('options');
197 197
 
198
-                if(strtolower($options['fetch_order']) === 'desc'){
198
+                if (strtolower($options['fetch_order']) === 'desc') {
199 199
                     $available_messages = $available_messages->reverse();
200 200
                 }
201 201
 
202
-                $query =& $this;
202
+                $query = & $this;
203 203
 
204 204
                 $available_messages->forPage($this->page, $this->limit)->each(function($msgno, $msglist) use(&$messages, $options, $query) {
205 205
                     $message = $query->getMessage($msgno, $msglist);
206
-                    switch ($options['message_key']){
206
+                    switch ($options['message_key']) {
207 207
                         case 'number':
208 208
                             $message_key = $message->getMessageNo();
209 209
                             break;
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 
222 222
             return $messages;
223 223
         } catch (\Exception $e) {
224
-            throw new GetMessagesFailedException($e->getMessage(),0, $e);
224
+            throw new GetMessagesFailedException($e->getMessage(), 0, $e);
225 225
         }
226 226
     }
227 227
 
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
      * @throws MessageContentFetchingException
238 238
      * @throws MessageHeaderFetchingException
239 239
      */
240
-    public function getMessage($msgno, $msglist = null){
240
+    public function getMessage($msgno, $msglist = null) {
241 241
         return new Message($msgno, $msglist, $this->getClient(), $this->getFetchOptions(), $this->getFetchBody(), $this->getFetchFlags());
242 242
     }
243 243
 
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
      * @return LengthAwarePaginator
251 251
      * @throws GetMessagesFailedException
252 252
      */
253
-    public function paginate($per_page = 5, $page = null, $page_name = 'imap_page'){
253
+    public function paginate($per_page = 5, $page = null, $page_name = 'imap_page') {
254 254
         if (
255 255
                $page === null
256 256
             && isset($_GET[$page_name])
@@ -283,10 +283,10 @@  discard block
 block discarded – undo
283 283
         $this->query->each(function($statement) use(&$query) {
284 284
             if (count($statement) == 1) {
285 285
                 $query .= $statement[0];
286
-            } else {
287
-                if($statement[1] === null){
286
+            }else {
287
+                if ($statement[1] === null) {
288 288
                     $query .= $statement[0];
289
-                }else{
289
+                }else {
290 290
                     $query .= $statement[0].' "'.$statement[1].'"';
291 291
                 }
292 292
             }
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
      * @return $this
317 317
      */
318 318
     public function limit($limit, $page = 1) {
319
-        if($page >= 1) $this->page = $page;
319
+        if ($page >= 1) $this->page = $page;
320 320
         $this->limit = $limit;
321 321
 
322 322
         return $this;
Please login to merge, or discard this patch.
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -73,7 +73,9 @@  discard block
 block discarded – undo
73 73
     public function __construct(Client $client, $charset = 'UTF-8') {
74 74
         $this->setClient($client);
75 75
 
76
-        if(ClientManager::get('options.fetch') === IMAP::FT_PEEK) $this->leaveUnread();
76
+        if(ClientManager::get('options.fetch') === IMAP::FT_PEEK) {
77
+            $this->leaveUnread();
78
+        }
77 79
 
78 80
         $this->date_format = ClientManager::get('date_format', 'd M y');
79 81
 
@@ -111,7 +113,9 @@  discard block
 block discarded – undo
111 113
      * @throws MessageSearchValidationException
112 114
      */
113 115
     protected function parse_date($date) {
114
-        if($date instanceof \Carbon\Carbon) return $date;
116
+        if($date instanceof \Carbon\Carbon) {
117
+            return $date;
118
+        }
115 119
 
116 120
         try {
117 121
             $date = Carbon::parse($date);
@@ -286,7 +290,7 @@  discard block
 block discarded – undo
286 290
             } else {
287 291
                 if($statement[1] === null){
288 292
                     $query .= $statement[0];
289
-                }else{
293
+                } else{
290 294
                     $query .= $statement[0].' "'.$statement[1].'"';
291 295
                 }
292 296
             }
@@ -316,7 +320,9 @@  discard block
 block discarded – undo
316 320
      * @return $this
317 321
      */
318 322
     public function limit($limit, $page = 1) {
319
-        if($page >= 1) $this->page = $page;
323
+        if($page >= 1) {
324
+            $this->page = $page;
325
+        }
320 326
         $this->limit = $limit;
321 327
 
322 328
         return $this;
Please login to merge, or discard this patch.