@@ -240,7 +240,9 @@ discard block |
||
| 240 | 240 | public function move(string $new_name, bool $expunge = true): bool { |
| 241 | 241 | $this->client->checkConnection(); |
| 242 | 242 | $status = $this->client->getConnection()->renameFolder($this->full_name, $new_name); |
| 243 | - if($expunge) $this->client->expunge(); |
|
| 243 | + if($expunge) { |
|
| 244 | + $this->client->expunge(); |
|
| 245 | + } |
|
| 244 | 246 | |
| 245 | 247 | $folder = $this->client->getFolder($new_name); |
| 246 | 248 | $event = $this->getEvent("folder", "moved"); |
@@ -316,7 +318,9 @@ discard block |
||
| 316 | 318 | */ |
| 317 | 319 | public function delete(bool $expunge = true): bool { |
| 318 | 320 | $status = $this->client->getConnection()->deleteFolder($this->path); |
| 319 | - if($expunge) $this->client->expunge(); |
|
| 321 | + if($expunge) { |
|
| 322 | + $this->client->expunge(); |
|
| 323 | + } |
|
| 320 | 324 | |
| 321 | 325 | $event = $this->getEvent("folder", "deleted"); |
| 322 | 326 | $event::dispatch($this); |
@@ -395,7 +399,7 @@ discard block |
||
| 395 | 399 | $connection->done(); |
| 396 | 400 | $connection->idle(); |
| 397 | 401 | } |
| 398 | - }catch (Exceptions\RuntimeException $e) { |
|
| 402 | + } catch (Exceptions\RuntimeException $e) { |
|
| 399 | 403 | if(strpos($e->getMessage(), "empty response") >= 0 && $connection->connected()) { |
| 400 | 404 | $connection->done(); |
| 401 | 405 | $connection->idle(); |
@@ -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 | |
@@ -326,7 +328,9 @@ discard block |
||
| 326 | 328 | * @throws RuntimeException |
| 327 | 329 | */ |
| 328 | 330 | public function write(string $data) { |
| 329 | - if ($this->debug) echo ">> ".$data ."\n"; |
|
| 331 | + if ($this->debug) { |
|
| 332 | + echo ">> ".$data ."\n"; |
|
| 333 | + } |
|
| 330 | 334 | |
| 331 | 335 | if (fwrite($this->stream, $data . "\r\n") === false) { |
| 332 | 336 | throw new RuntimeException('failed to write - connection closed?'); |
@@ -478,7 +482,9 @@ discard block |
||
| 478 | 482 | public function getCapabilities(): array { |
| 479 | 483 | $response = $this->requestAndResponse('CAPABILITY'); |
| 480 | 484 | |
| 481 | - if (!$response) return []; |
|
| 485 | + if (!$response) { |
|
| 486 | + return []; |
|
| 487 | + } |
|
| 482 | 488 | |
| 483 | 489 | $capabilities = []; |
| 484 | 490 | foreach ($response as $line) { |
@@ -638,13 +644,14 @@ discard block |
||
| 638 | 644 | // if we want only one message we can ignore everything else and just return |
| 639 | 645 | if ($to === null && !is_array($from) && ($uid ? $tokens[2][$uidKey] == $from : $tokens[0] == $from)) { |
| 640 | 646 | // we still need to read all lines |
| 641 | - while (!$this->readLine($tokens, $tag)) |
|
| 642 | - |
|
| 647 | + while (!$this->readLine($tokens, $tag)) { |
|
| 648 | + |
|
| 643 | 649 | return $data; |
| 650 | + } |
|
| 644 | 651 | } |
| 645 | 652 | if ($uid) { |
| 646 | 653 | $result[$tokens[2][$uidKey]] = $data; |
| 647 | - }else{ |
|
| 654 | + } else{ |
|
| 648 | 655 | $result[$tokens[0]] = $data; |
| 649 | 656 | } |
| 650 | 657 | } |