@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | * |
131 | 131 | * @return WhereQuery |
132 | 132 | */ |
133 | - public function query($charset = 'UTF-8'){ |
|
133 | + public function query($charset = 'UTF-8') { |
|
134 | 134 | $this->getClient()->checkConnection(); |
135 | 135 | $this->getClient()->openFolder($this); |
136 | 136 | |
@@ -140,14 +140,14 @@ discard block |
||
140 | 140 | /** |
141 | 141 | * @inheritdoc self::query($charset = 'UTF-8') |
142 | 142 | */ |
143 | - public function search($charset = 'UTF-8'){ |
|
143 | + public function search($charset = 'UTF-8') { |
|
144 | 144 | return $this->query($charset); |
145 | 145 | } |
146 | 146 | |
147 | 147 | /** |
148 | 148 | * @inheritdoc self::query($charset = 'UTF-8') |
149 | 149 | */ |
150 | - public function messages($charset = 'UTF-8'){ |
|
150 | + public function messages($charset = 'UTF-8') { |
|
151 | 151 | return $this->query($charset); |
152 | 152 | } |
153 | 153 | |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | * @deprecated 1.2.1:2.0.0 No longer needed. Use Folder::query() instead |
309 | 309 | * @see Folder::query() |
310 | 310 | */ |
311 | - public function searchMessages(array $where, $fetch_options = null, $fetch_body = true, $fetch_attachment = true, $fetch_flags = true, $limit = null, $page = 1, $charset = "UTF-8") { |
|
311 | + public function searchMessages(array $where, $fetch_options = null, $fetch_body = true, $fetch_attachment = true, $fetch_flags = true, $limit = null, $page = 1, $charset = "UTF-8") { |
|
312 | 312 | $this->getClient()->checkConnection(); |
313 | 313 | |
314 | 314 | return $this->query($charset)->where($where)->setFetchOptions($fetch_options)->setFetchBody($fetch_body) |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | public function __construct(Client $client, $charset = 'UTF-8') { |
65 | 65 | $this->setClient($client); |
66 | 66 | |
67 | - if(config('imap.options.fetch') === FT_PEEK) $this->leaveUnread(); |
|
67 | + if (config('imap.options.fetch') === FT_PEEK) $this->leaveUnread(); |
|
68 | 68 | |
69 | 69 | $this->charset = $charset; |
70 | 70 | $this->query = collect(); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | /** |
75 | 75 | * Instance boot method for additional functionality |
76 | 76 | */ |
77 | - protected function boot(){} |
|
77 | + protected function boot() {} |
|
78 | 78 | |
79 | 79 | /** |
80 | 80 | * Parse a given value |
@@ -82,8 +82,8 @@ discard block |
||
82 | 82 | * |
83 | 83 | * @return string |
84 | 84 | */ |
85 | - protected function parse_value($value){ |
|
86 | - switch(true){ |
|
85 | + protected function parse_value($value) { |
|
86 | + switch (true) { |
|
87 | 87 | case $value instanceof \Carbon\Carbon: |
88 | 88 | $value = $value->format('d M y'); |
89 | 89 | break; |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | * @throws MessageSearchValidationException |
101 | 101 | */ |
102 | 102 | protected function parse_date($date) { |
103 | - if($date instanceof \Carbon\Carbon) return $date; |
|
103 | + if ($date instanceof \Carbon\Carbon) return $date; |
|
104 | 104 | |
105 | 105 | try { |
106 | 106 | $date = Carbon::parse($date); |
@@ -149,9 +149,9 @@ discard block |
||
149 | 149 | * Don't set the charset if it isn't used - prevent strange outlook mail server errors |
150 | 150 | * @see https://github.com/Webklex/laravel-imap/issues/100 |
151 | 151 | */ |
152 | - if($this->getCharset() === null){ |
|
152 | + if ($this->getCharset() === null) { |
|
153 | 153 | $available_messages = imap_search($this->getClient()->getConnection(), $this->getRawQuery(), SE_UID); |
154 | - }else{ |
|
154 | + } else { |
|
155 | 155 | $available_messages = imap_search($this->getClient()->getConnection(), $this->getRawQuery(), SE_UID, $this->getCharset()); |
156 | 156 | } |
157 | 157 | |
@@ -160,13 +160,13 @@ discard block |
||
160 | 160 | $available_messages = collect($available_messages); |
161 | 161 | $options = config('imap.options'); |
162 | 162 | |
163 | - if(strtolower($options['fetch_order']) === 'desc'){ |
|
163 | + if (strtolower($options['fetch_order']) === 'desc') { |
|
164 | 164 | $available_messages = $available_messages->reverse(); |
165 | 165 | } |
166 | 166 | |
167 | 167 | $available_messages->forPage($this->page, $this->limit)->each(function($msgno, $msglist) use(&$messages, $options) { |
168 | 168 | $oMessage = new Message($msgno, $msglist, $this->getClient(), $this->getFetchOptions(), $this->getFetchBody(), $this->getFetchAttachment(), $this->getFetchFlags()); |
169 | - switch ($options['message_key']){ |
|
169 | + switch ($options['message_key']) { |
|
170 | 170 | case 'number': |
171 | 171 | $message_key = $oMessage->getMessageNo(); |
172 | 172 | break; |
@@ -201,9 +201,9 @@ discard block |
||
201 | 201 | if (count($statement) == 1) { |
202 | 202 | $query .= $statement[0]; |
203 | 203 | } else { |
204 | - if($statement[1] === null){ |
|
204 | + if ($statement[1] === null) { |
|
205 | 205 | $query .= $statement[0]; |
206 | - }else{ |
|
206 | + } else { |
|
207 | 207 | $query .= $statement[0].' "'.$statement[1].'"'; |
208 | 208 | } |
209 | 209 | } |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | * @return $this |
233 | 233 | */ |
234 | 234 | public function limit($limit, $page = 1) { |
235 | - if($page >= 1) $this->page = $page; |
|
235 | + if ($page >= 1) $this->page = $page; |
|
236 | 236 | $this->limit = $limit; |
237 | 237 | |
238 | 238 | return $this; |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | $this->msglist = $msglist; |
185 | 185 | $this->client = $client; |
186 | 186 | |
187 | - $this->uid = ($this->fetch_options == FT_UID) ? $uid : $uid; |
|
187 | + $this->uid = ($this->fetch_options == FT_UID) ? $uid : $uid; |
|
188 | 188 | $this->msgn = ($this->fetch_options == FT_UID) ? imap_msgno($this->client->getConnection(), $uid) : $uid; |
189 | 189 | |
190 | 190 | $this->parseHeader(); |
@@ -288,9 +288,9 @@ discard block |
||
288 | 288 | $header = imap_rfc822_parse_headers($this->header); |
289 | 289 | } |
290 | 290 | |
291 | - if(preg_match('/x\-priority\:.*([0-9]{1,2})/i', $this->header, $priority)){ |
|
291 | + if (preg_match('/x\-priority\:.*([0-9]{1,2})/i', $this->header, $priority)) { |
|
292 | 292 | $priority = isset($priority[1]) ? (int) $priority[1] : 0; |
293 | - switch($priority){ |
|
293 | + switch ($priority) { |
|
294 | 294 | case self::PRIORITY_HIGHEST; |
295 | 295 | $this->priority = self::PRIORITY_HIGHEST; |
296 | 296 | break; |
@@ -475,12 +475,12 @@ discard block |
||
475 | 475 | public function parseBody() { |
476 | 476 | $structure = imap_fetchstructure($this->client->getConnection(), $this->uid, FT_UID); |
477 | 477 | |
478 | - if(property_exists($structure, 'parts')){ |
|
478 | + if (property_exists($structure, 'parts')) { |
|
479 | 479 | $parts = $structure->parts; |
480 | 480 | |
481 | - foreach ($parts as $part) { |
|
482 | - foreach ($part->parameters as $parameter) { |
|
483 | - if($parameter->attribute == "charset") { |
|
481 | + foreach ($parts as $part) { |
|
482 | + foreach ($part->parameters as $parameter) { |
|
483 | + if ($parameter->attribute == "charset") { |
|
484 | 484 | $encoding = $parameter->value; |
485 | 485 | $parameter->value = preg_replace('/Content-Transfer-Encoding/', '', $encoding); |
486 | 486 | } |