@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | * @return array<string>|string|string |
| 112 | 112 | * @throws RuntimeException |
| 113 | 113 | */ |
| 114 | - protected function getResponse(): array|string|null |
|
| 114 | + protected function getResponse(): array | string | null |
|
| 115 | 115 | { |
| 116 | 116 | $line = fgets($this->getSocket()); |
| 117 | 117 | if ($line === false) { |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | } |
| 138 | 138 | } elseif ($type === '*') { // multi-bulk reply |
| 139 | 139 | $count = (int) $result; |
| 140 | - for ($i = 0 , $result = []; $i < $count; $i++) { |
|
| 140 | + for ($i = 0, $result = []; $i < $count; $i++) { |
|
| 141 | 141 | $result[] = $this->getResponse(); |
| 142 | 142 | } |
| 143 | 143 | } |
@@ -65,8 +65,7 @@ discard block |
||
| 65 | 65 | * @method string decrby(string $key, int $decrement) |
| 66 | 66 | * @method string set(string $key, string $value) |
| 67 | 67 | */ |
| 68 | -class RedisClient |
|
| 69 | -{ |
|
| 68 | +class RedisClient { |
|
| 70 | 69 | /** |
| 71 | 70 | * The connection socket |
| 72 | 71 | * line length not limited |
@@ -123,7 +122,8 @@ discard block |
||
| 123 | 122 | throw new RuntimeException(sprintf('Redis socket return error: %s', $result)); |
| 124 | 123 | } |
| 125 | 124 | |
| 126 | - if ($type === '$') { // bulk reply |
|
| 125 | + if ($type === '$') { |
|
| 126 | +// bulk reply |
|
| 127 | 127 | if ($result === '-1') { |
| 128 | 128 | $result = null; |
| 129 | 129 | } else { |
@@ -135,7 +135,8 @@ discard block |
||
| 135 | 135 | } |
| 136 | 136 | $result = substr($line, 0, strlen($line) - 2); |
| 137 | 137 | } |
| 138 | - } elseif ($type === '*') { // multi-bulk reply |
|
| 138 | + } elseif ($type === '*') { |
|
| 139 | +// multi-bulk reply |
|
| 139 | 140 | $count = (int) $result; |
| 140 | 141 | for ($i = 0 , $result = []; $i < $count; $i++) { |
| 141 | 142 | $result[] = $this->getResponse(); |
@@ -150,8 +151,7 @@ discard block |
||
| 150 | 151 | * @return resource |
| 151 | 152 | * @throws RuntimeException |
| 152 | 153 | */ |
| 153 | - protected function getSocket() |
|
| 154 | - { |
|
| 154 | + protected function getSocket() { |
|
| 155 | 155 | if (is_resource($this->socket)) { |
| 156 | 156 | return $this->socket; |
| 157 | 157 | } |