@@ -237,7 +237,9 @@ discard block |
||
| 237 | 237 | } else { |
| 238 | 238 | $tokens = $line; |
| 239 | 239 | } |
| 240 | - if ($this->debug) echo "<< ".$line."\n"; |
|
| 240 | + if ($this->debug) { |
|
| 241 | + echo "<< ".$line."\n"; |
|
| 242 | + } |
|
| 241 | 243 | |
| 242 | 244 | // if tag is wanted tag we might be at the end of a multiline response |
| 243 | 245 | return $tag == $wantedTag; |
@@ -303,7 +305,9 @@ discard block |
||
| 303 | 305 | $line .= ' ' . $token; |
| 304 | 306 | } |
| 305 | 307 | } |
| 306 | - if ($this->debug) echo ">> ".$line."\n"; |
|
| 308 | + if ($this->debug) { |
|
| 309 | + echo ">> ".$line."\n"; |
|
| 310 | + } |
|
| 307 | 311 | |
| 308 | 312 | if (fwrite($this->stream, $line . "\r\n") === false) { |
| 309 | 313 | throw new RuntimeException('failed to write - connection closed?'); |
@@ -453,7 +457,9 @@ discard block |
||
| 453 | 457 | public function getCapabilities() { |
| 454 | 458 | $response = $this->requestAndResponse('CAPABILITY'); |
| 455 | 459 | |
| 456 | - if (!$response) return []; |
|
| 460 | + if (!$response) { |
|
| 461 | + return []; |
|
| 462 | + } |
|
| 457 | 463 | |
| 458 | 464 | $capabilities = []; |
| 459 | 465 | foreach ($response as $line) { |
@@ -610,13 +616,14 @@ discard block |
||
| 610 | 616 | // if we want only one message we can ignore everything else and just return |
| 611 | 617 | if ($to === null && !is_array($from) && ($uid ? $tokens[2][$uidKey] == $from : $tokens[0] == $from)) { |
| 612 | 618 | // we still need to read all lines |
| 613 | - while (!$this->readLine($tokens, $tag)) |
|
| 614 | - |
|
| 619 | + while (!$this->readLine($tokens, $tag)) { |
|
| 620 | + |
|
| 615 | 621 | return $data; |
| 622 | + } |
|
| 616 | 623 | } |
| 617 | 624 | if ($uid) { |
| 618 | 625 | $result[$tokens[2][$uidKey]] = $data; |
| 619 | - }else{ |
|
| 626 | + } else{ |
|
| 620 | 627 | $result[$tokens[0]] = $data; |
| 621 | 628 | } |
| 622 | 629 | } |
@@ -86,7 +86,9 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | public function toDate(){ |
| 88 | 88 | $date = $this->first(); |
| 89 | - if ($date instanceof Carbon) return $date; |
|
| 89 | + if ($date instanceof Carbon) { |
|
| 90 | + return $date; |
|
| 91 | + } |
|
| 90 | 92 | |
| 91 | 93 | return Carbon::parse($date); |
| 92 | 94 | } |
@@ -146,7 +148,7 @@ discard block |
||
| 146 | 148 | public function add($value, $strict = false) { |
| 147 | 149 | if (is_array($value)) { |
| 148 | 150 | return $this->merge($value, $strict); |
| 149 | - }elseif ($value !== null) { |
|
| 151 | + } elseif ($value !== null) { |
|
| 150 | 152 | $this->attach($value, $strict); |
| 151 | 153 | } |
| 152 | 154 | |
@@ -195,7 +197,7 @@ discard block |
||
| 195 | 197 | if ($this->contains($value) === false) { |
| 196 | 198 | $this->values[] = $value; |
| 197 | 199 | } |
| 198 | - }else{ |
|
| 200 | + } else{ |
|
| 199 | 201 | $this->values[] = $value; |
| 200 | 202 | } |
| 201 | 203 | } |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | return null; |
| 131 | - }elseif (strtolower(substr($method, 0, 3)) === 'set') { |
|
| 131 | + } elseif (strtolower(substr($method, 0, 3)) === 'set') { |
|
| 132 | 132 | $name = Str::snake(substr($method, 3)); |
| 133 | 133 | |
| 134 | 134 | $this->attributes[$name] = array_pop($arguments); |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | $this->setName($filename); |
| 223 | 223 | } elseif (($name = $this->part->name) !== null) { |
| 224 | 224 | $this->setName($name); |
| 225 | - }else { |
|
| 225 | + } else { |
|
| 226 | 226 | $this->setName("undefined"); |
| 227 | 227 | } |
| 228 | 228 | |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | if ($name !== null) { |
| 258 | 258 | if($decoder === 'utf-8' && extension_loaded('imap')) { |
| 259 | 259 | $this->name = \imap_utf8($name); |
| 260 | - }else{ |
|
| 260 | + } else{ |
|
| 261 | 261 | $this->name = mb_decode_mimeheader($name); |
| 262 | 262 | } |
| 263 | 263 | } |
@@ -71,7 +71,7 @@ |
||
| 71 | 71 | return $this->attributes[$name]; |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - }elseif (strtolower(substr($method, 0, 3)) === 'set') { |
|
| 74 | + } elseif (strtolower(substr($method, 0, 3)) === 'set') { |
|
| 75 | 75 | $name = Str::snake(substr($method, 3)); |
| 76 | 76 | |
| 77 | 77 | if(isset($this->attributes[$name])) { |
@@ -50,7 +50,9 @@ discard block |
||
| 50 | 50 | */ |
| 51 | 51 | public function getCustomHTMLBody($callback = false) { |
| 52 | 52 | $body = $this->getHtmlBody(); |
| 53 | - if($body === null) return null; |
|
| 53 | + if($body === null) { |
|
| 54 | + return null; |
|
| 55 | + } |
|
| 54 | 56 | |
| 55 | 57 | if ($callback !== false) { |
| 56 | 58 | $aAttachment = $this->parent->getAttachments(); |
@@ -58,7 +60,7 @@ discard block |
||
| 58 | 60 | /** @var Attachment $oAttachment */ |
| 59 | 61 | if(is_callable($callback)) { |
| 60 | 62 | $body = $callback($body, $oAttachment); |
| 61 | - }elseif(is_string($callback)) { |
|
| 63 | + } elseif(is_string($callback)) { |
|
| 62 | 64 | call_user_func($callback, [$body, $oAttachment]); |
| 63 | 65 | } |
| 64 | 66 | }); |
@@ -91,7 +91,9 @@ discard block |
||
| 91 | 91 | $this->setClient($client); |
| 92 | 92 | |
| 93 | 93 | $this->sequence = ClientManager::get('options.sequence', IMAP::ST_MSGN); |
| 94 | - if (ClientManager::get('options.fetch') === IMAP::FT_PEEK) $this->leaveUnread(); |
|
| 94 | + if (ClientManager::get('options.fetch') === IMAP::FT_PEEK) { |
|
| 95 | + $this->leaveUnread(); |
|
| 96 | + } |
|
| 95 | 97 | |
| 96 | 98 | if (ClientManager::get('options.fetch_order') === 'desc') { |
| 97 | 99 | $this->fetch_order = 'desc'; |
@@ -137,7 +139,9 @@ discard block |
||
| 137 | 139 | * @throws MessageSearchValidationException |
| 138 | 140 | */ |
| 139 | 141 | protected function parse_date($date) { |
| 140 | - if ($date instanceof Carbon) return $date; |
|
| 142 | + if ($date instanceof Carbon) { |
|
| 143 | + return $date; |
|
| 144 | + } |
|
| 141 | 145 | |
| 142 | 146 | try { |
| 143 | 147 | $date = Carbon::parse($date); |
@@ -250,15 +254,15 @@ discard block |
||
| 250 | 254 | protected function make($uid, $msglist, $header, $content, $flags){ |
| 251 | 255 | try { |
| 252 | 256 | return Message::make($uid, $msglist, $this->getClient(), $header, $content, $flags, $this->getFetchOptions(), $this->sequence); |
| 253 | - }catch (MessageNotFoundException $e) { |
|
| 257 | + } catch (MessageNotFoundException $e) { |
|
| 254 | 258 | $this->setError($uid, $e); |
| 255 | - }catch (RuntimeException $e) { |
|
| 259 | + } catch (RuntimeException $e) { |
|
| 256 | 260 | $this->setError($uid, $e); |
| 257 | - }catch (MessageFlagException $e) { |
|
| 261 | + } catch (MessageFlagException $e) { |
|
| 258 | 262 | $this->setError($uid, $e); |
| 259 | - }catch (InvalidMessageDateException $e) { |
|
| 263 | + } catch (InvalidMessageDateException $e) { |
|
| 260 | 264 | $this->setError($uid, $e); |
| 261 | - }catch (MessageContentFetchingException $e) { |
|
| 265 | + } catch (MessageContentFetchingException $e) { |
|
| 262 | 266 | $this->setError($uid, $e); |
| 263 | 267 | } |
| 264 | 268 | |
@@ -511,7 +515,9 @@ discard block |
||
| 511 | 515 | * @return $this |
| 512 | 516 | */ |
| 513 | 517 | public function limit($limit, $page = 1) { |
| 514 | - if ($page >= 1) $this->page = $page; |
|
| 518 | + if ($page >= 1) { |
|
| 519 | + $this->page = $page; |
|
| 520 | + } |
|
| 515 | 521 | $this->limit = $limit; |
| 516 | 522 | |
| 517 | 523 | return $this; |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | foreach ($criteria as $key => $value) { |
| 139 | 139 | if (is_numeric($key)) { |
| 140 | 140 | $this->where($value); |
| 141 | - }else{ |
|
| 141 | + } else{ |
|
| 142 | 142 | $this->where($key, $value); |
| 143 | 143 | } |
| 144 | 144 | } |
@@ -174,7 +174,9 @@ discard block |
||
| 174 | 174 | */ |
| 175 | 175 | public function orWhere(Closure $closure = null) { |
| 176 | 176 | $this->query->push(['OR']); |
| 177 | - if ($closure !== null) $closure($this); |
|
| 177 | + if ($closure !== null) { |
|
| 178 | + $closure($this); |
|
| 179 | + } |
|
| 178 | 180 | |
| 179 | 181 | return $this; |
| 180 | 182 | } |
@@ -186,7 +188,9 @@ discard block |
||
| 186 | 188 | */ |
| 187 | 189 | public function andWhere(Closure $closure = null) { |
| 188 | 190 | $this->query->push(['AND']); |
| 189 | - if ($closure !== null) $closure($this); |
|
| 191 | + if ($closure !== null) { |
|
| 192 | + $closure($this); |
|
| 193 | + } |
|
| 190 | 194 | |
| 191 | 195 | return $this; |
| 192 | 196 | } |
@@ -90,7 +90,7 @@ |
||
| 90 | 90 | $content_type = (is_array($content_type)) ? implode(' ', $content_type) : $content_type; |
| 91 | 91 | if(stripos($content_type, 'multipart') === 0) { |
| 92 | 92 | $this->type = IMAP::MESSAGE_TYPE_MULTIPART; |
| 93 | - }else{ |
|
| 93 | + } else{ |
|
| 94 | 94 | $this->type = IMAP::MESSAGE_TYPE_TEXT; |
| 95 | 95 | } |
| 96 | 96 | } |
@@ -162,7 +162,7 @@ |
||
| 162 | 162 | protected function parse(){ |
| 163 | 163 | if ($this->header === null) { |
| 164 | 164 | $body = $this->findHeaders(); |
| 165 | - }else{ |
|
| 165 | + } else{ |
|
| 166 | 166 | $body = $this->raw; |
| 167 | 167 | } |
| 168 | 168 | |