@@ -111,7 +111,9 @@ discard block |
||
| 111 | 111 | if ($line === "") { |
| 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) { |
@@ -637,13 +643,14 @@ discard block |
||
| 637 | 643 | // if we want only one message we can ignore everything else and just return |
| 638 | 644 | if ($to === null && !is_array($from) && ($uid ? $tokens[2][$uidKey] == $from : $tokens[0] == $from)) { |
| 639 | 645 | // we still need to read all lines |
| 640 | - while (!$this->readLine($tokens, $tag)) |
|
| 641 | - |
|
| 646 | + while (!$this->readLine($tokens, $tag)) { |
|
| 647 | + |
|
| 642 | 648 | return $data; |
| 649 | + } |
|
| 643 | 650 | } |
| 644 | 651 | if ($uid) { |
| 645 | 652 | $result[$tokens[2][$uidKey]] = $data; |
| 646 | - }else{ |
|
| 653 | + } else{ |
|
| 647 | 654 | $result[$tokens[0]] = $data; |
| 648 | 655 | } |
| 649 | 656 | } |
@@ -1073,7 +1080,9 @@ discard block |
||
| 1073 | 1080 | public function search(array $params, $uid = IMAP::ST_UID): array { |
| 1074 | 1081 | $command = $this->buildUIDCommand("SEARCH", $uid); |
| 1075 | 1082 | $response = $this->requestAndResponse($command, $params); |
| 1076 | - if (!$response) return []; |
|
| 1083 | + if (!$response) { |
|
| 1084 | + return []; |
|
| 1085 | + } |
|
| 1077 | 1086 | |
| 1078 | 1087 | foreach ($response as $ids) { |
| 1079 | 1088 | if ($ids[0] == 'SEARCH') { |