@@ -117,7 +117,9 @@ discard block |
||
117 | 117 | if ($line === "" && $next_char === false) { |
118 | 118 | throw new RuntimeException('empty response'); |
119 | 119 | } |
120 | - if ($this->debug) echo "<< ".$line."\n"; |
|
120 | + if ($this->debug) { |
|
121 | + echo "<< ".$line."\n"; |
|
122 | + } |
|
121 | 123 | return $line . "\n"; |
122 | 124 | } |
123 | 125 | |
@@ -336,7 +338,9 @@ discard block |
||
336 | 338 | * @throws RuntimeException |
337 | 339 | */ |
338 | 340 | public function write(string $data) { |
339 | - if ($this->debug) echo ">> ".$data ."\n"; |
|
341 | + if ($this->debug) { |
|
342 | + echo ">> ".$data ."\n"; |
|
343 | + } |
|
340 | 344 | |
341 | 345 | if (fwrite($this->stream, $data . "\r\n") === false) { |
342 | 346 | throw new RuntimeException('failed to write - connection closed?'); |
@@ -504,7 +508,9 @@ discard block |
||
504 | 508 | public function getCapabilities(): array { |
505 | 509 | $response = $this->requestAndResponse('CAPABILITY'); |
506 | 510 | |
507 | - if (!$response) return []; |
|
511 | + if (!$response) { |
|
512 | + return []; |
|
513 | + } |
|
508 | 514 | |
509 | 515 | $capabilities = []; |
510 | 516 | foreach ($response as $line) { |
@@ -678,13 +684,14 @@ discard block |
||
678 | 684 | // if we want only one message we can ignore everything else and just return |
679 | 685 | if ($to === null && !is_array($from) && ($uid ? $tokens[2][$uidKey] == $from : $tokens[0] == $from)) { |
680 | 686 | // we still need to read all lines |
681 | - while (!$this->readLine($tokens, $tag)) |
|
682 | - |
|
687 | + while (!$this->readLine($tokens, $tag)) { |
|
688 | + |
|
683 | 689 | return $data; |
690 | + } |
|
684 | 691 | } |
685 | 692 | if ($uid) { |
686 | 693 | $result[$tokens[2][$uidKey]] = $data; |
687 | - }else{ |
|
694 | + } else{ |
|
688 | 695 | $result[$tokens[0]] = $data; |
689 | 696 | } |
690 | 697 | } |