Passed
Push — master ( 556262...0c61e0 )
by Malte
02:02
created
src/Query/Query.php 1 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
 
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
      * @throws MessageHeaderFetchingException
239 239
      * @throws \Webklex\PHPIMAP\Exceptions\EventNotFoundException
240 240
      */
241
-    public function getMessage($msgno, $msglist = null){
241
+    public function getMessage($msgno, $msglist = null) {
242 242
         return new Message($msgno, $msglist, $this->getClient(), $this->getFetchOptions(), $this->getFetchBody(), $this->getFetchFlags());
243 243
     }
244 244
 
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
      * @return LengthAwarePaginator
252 252
      * @throws GetMessagesFailedException
253 253
      */
254
-    public function paginate($per_page = 5, $page = null, $page_name = 'imap_page'){
254
+    public function paginate($per_page = 5, $page = null, $page_name = 'imap_page') {
255 255
         if (
256 256
                $page === null
257 257
             && isset($_GET[$page_name])
@@ -277,10 +277,10 @@  discard block
 block discarded – undo
277 277
         $this->query->each(function($statement) use(&$query) {
278 278
             if (count($statement) == 1) {
279 279
                 $query .= $statement[0];
280
-            } else {
281
-                if($statement[1] === null){
280
+            }else {
281
+                if ($statement[1] === null) {
282 282
                     $query .= $statement[0];
283
-                }else{
283
+                }else {
284 284
                     $query .= $statement[0].' "'.$statement[1].'"';
285 285
                 }
286 286
             }
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
      * @return $this
311 311
      */
312 312
     public function limit($limit, $page = 1) {
313
-        if($page >= 1) $this->page = $page;
313
+        if ($page >= 1) $this->page = $page;
314 314
         $this->limit = $limit;
315 315
 
316 316
         return $this;
Please login to merge, or discard this patch.