@@ -76,7 +76,9 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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; |
@@ -76,11 +76,11 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 { |
@@ -207,11 +207,11 @@ discard block |
||
207 | 207 | } |
208 | 208 | |
209 | 209 | $message_key = ClientManager::get('options.message_key'); |
210 | - $query =& $this; |
|
210 | + $query = & $this; |
|
211 | 211 | |
212 | 212 | $available_messages->forPage($this->page, $this->limit)->each(function($msgno, $msglist) use(&$messages, $message_key, $query) { |
213 | 213 | $message = $query->getMessage($msgno, $msglist); |
214 | - switch ($message_key){ |
|
214 | + switch ($message_key) { |
|
215 | 215 | case 'number': |
216 | 216 | $message_key = $message->getMessageNo(); |
217 | 217 | break; |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | |
230 | 230 | return $messages; |
231 | 231 | } catch (\Exception $e) { |
232 | - throw new GetMessagesFailedException($e->getMessage(),0, $e); |
|
232 | + throw new GetMessagesFailedException($e->getMessage(), 0, $e); |
|
233 | 233 | } |
234 | 234 | } |
235 | 235 | |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | * @throws MessageHeaderFetchingException |
247 | 247 | * @throws \Webklex\PHPIMAP\Exceptions\EventNotFoundException |
248 | 248 | */ |
249 | - public function getMessage($msgno, $msglist = null){ |
|
249 | + public function getMessage($msgno, $msglist = null) { |
|
250 | 250 | return new Message($msgno, $msglist, $this->getClient(), $this->getFetchOptions(), $this->getFetchBody(), $this->getFetchFlags()); |
251 | 251 | } |
252 | 252 | |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | * @return LengthAwarePaginator |
260 | 260 | * @throws GetMessagesFailedException |
261 | 261 | */ |
262 | - public function paginate($per_page = 5, $page = null, $page_name = 'imap_page'){ |
|
262 | + public function paginate($per_page = 5, $page = null, $page_name = 'imap_page') { |
|
263 | 263 | if ( |
264 | 264 | $page === null |
265 | 265 | && isset($_GET[$page_name]) |
@@ -285,10 +285,10 @@ discard block |
||
285 | 285 | $this->query->each(function($statement) use(&$query) { |
286 | 286 | if (count($statement) == 1) { |
287 | 287 | $query .= $statement[0]; |
288 | - } else { |
|
289 | - if($statement[1] === null){ |
|
288 | + }else { |
|
289 | + if ($statement[1] === null) { |
|
290 | 290 | $query .= $statement[0]; |
291 | - }else{ |
|
291 | + }else { |
|
292 | 292 | $query .= $statement[0].' "'.$statement[1].'"'; |
293 | 293 | } |
294 | 294 | } |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | * @return $this |
319 | 319 | */ |
320 | 320 | public function limit($limit, $page = 1) { |
321 | - if($page >= 1) $this->page = $page; |
|
321 | + if ($page >= 1) $this->page = $page; |
|
322 | 322 | $this->limit = $limit; |
323 | 323 | |
324 | 324 | return $this; |