@@ -111,7 +111,9 @@ discard block |
||
| 111 | 111 | if ($line === "" && $next_char !== "\n") { |
| 112 | 112 | throw new RuntimeException('empty response'); |
| 113 | 113 | } |
| 114 | - if ($this->debug) echo "<< ".$line."\n"; |
|
| 114 | + if ($this->debug) { |
|
| 115 | + echo "<< ".$line."\n"; |
|
| 116 | + } |
|
| 115 | 117 | return $line . "\n"; |
| 116 | 118 | } |
| 117 | 119 | |
@@ -325,7 +327,9 @@ discard block |
||
| 325 | 327 | * @throws RuntimeException |
| 326 | 328 | */ |
| 327 | 329 | public function write(string $data) { |
| 328 | - if ($this->debug) echo ">> ".$data ."\n"; |
|
| 330 | + if ($this->debug) { |
|
| 331 | + echo ">> ".$data ."\n"; |
|
| 332 | + } |
|
| 329 | 333 | |
| 330 | 334 | if (fwrite($this->stream, $data . "\r\n") === false) { |
| 331 | 335 | throw new RuntimeException('failed to write - connection closed?'); |
@@ -477,7 +481,9 @@ discard block |
||
| 477 | 481 | public function getCapabilities(): array { |
| 478 | 482 | $response = $this->requestAndResponse('CAPABILITY'); |
| 479 | 483 | |
| 480 | - if (!$response) return []; |
|
| 484 | + if (!$response) { |
|
| 485 | + return []; |
|
| 486 | + } |
|
| 481 | 487 | |
| 482 | 488 | $capabilities = []; |
| 483 | 489 | foreach ($response as $line) { |
@@ -644,13 +650,14 @@ discard block |
||
| 644 | 650 | // if we want only one message we can ignore everything else and just return |
| 645 | 651 | if ($to === null && !is_array($from) && ($uid ? $tokens[2][$uidKey] == $from : $tokens[0] == $from)) { |
| 646 | 652 | // we still need to read all lines |
| 647 | - while (!$this->readLine($tokens, $tag)) |
|
| 648 | - |
|
| 653 | + while (!$this->readLine($tokens, $tag)) { |
|
| 654 | + |
|
| 649 | 655 | return $data; |
| 656 | + } |
|
| 650 | 657 | } |
| 651 | 658 | if ($uid) { |
| 652 | 659 | $result[$tokens[2][$uidKey]] = $data; |
| 653 | - }else{ |
|
| 660 | + } else{ |
|
| 654 | 661 | $result[$tokens[0]] = $data; |
| 655 | 662 | } |
| 656 | 663 | } |
@@ -1080,7 +1087,9 @@ discard block |
||
| 1080 | 1087 | public function search(array $params, $uid = IMAP::ST_UID): array { |
| 1081 | 1088 | $command = $this->buildUIDCommand("SEARCH", $uid); |
| 1082 | 1089 | $response = $this->requestAndResponse($command, $params); |
| 1083 | - if (!$response) return []; |
|
| 1090 | + if (!$response) { |
|
| 1091 | + return []; |
|
| 1092 | + } |
|
| 1084 | 1093 | |
| 1085 | 1094 | foreach ($response as $ids) { |
| 1086 | 1095 | if ($ids[0] == 'SEARCH') { |