@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * @param int $end |
22 | 22 | * @return mixed |
23 | 23 | */ |
24 | - public function bitCount($key, $start=0, $end=-1); |
|
24 | + public function bitCount($key, $start = 0, $end = -1); |
|
25 | 25 | |
26 | 26 | /** |
27 | 27 | * @doc https://redis.io/commands/bitfield |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * @param int $end |
53 | 53 | * @return mixed |
54 | 54 | */ |
55 | - public function bitPos($key, $bit, $start=0, $end=-1); |
|
55 | + public function bitPos($key, $bit, $start = 0, $end = -1); |
|
56 | 56 | |
57 | 57 | /** |
58 | 58 | * @doc https://redis.io/commands/decr |
@@ -97,11 +97,11 @@ discard block |
||
97 | 97 | $args = [$key, $star, $stop]; |
98 | 98 | if ($withScores) { |
99 | 99 | $args[] = 'WITHSCORES'; |
100 | - return $this->dispatch(Builder::build($command, $args))->then(function ($value) { |
|
100 | + return $this->dispatch(Builder::build($command, $args))->then(function($value) { |
|
101 | 101 | $len = count($value); |
102 | 102 | $ret = []; |
103 | - for ($i=0; $i<$len; $i+=2) { |
|
104 | - $ret[$value[$i]] = $value[$i+1]; |
|
103 | + for ($i = 0; $i < $len; $i += 2) { |
|
104 | + $ret[$value[$i]] = $value[$i + 1]; |
|
105 | 105 | } |
106 | 106 | return $ret; |
107 | 107 | }); |
@@ -130,8 +130,8 @@ discard block |
||
130 | 130 | public function zRevRangeByLex($key, $max, $min, array $options = []) |
131 | 131 | { |
132 | 132 | $command = Enum::ZREVRANGEBYLEX; |
133 | - $args = [$key, $max,$min]; |
|
134 | - $args = array_merge($args,$options); |
|
133 | + $args = [$key, $max, $min]; |
|
134 | + $args = array_merge($args, $options); |
|
135 | 135 | |
136 | 136 | return $this->dispatch(Builder::build($command, $args)); |
137 | 137 | } |
@@ -154,12 +154,12 @@ discard block |
||
154 | 154 | } |
155 | 155 | $promise = $this->dispatch(Builder::build($command, $args)); |
156 | 156 | |
157 | - return $withScores ? $promise->then(function ($value) { |
|
157 | + return $withScores ? $promise->then(function($value) { |
|
158 | 158 | $len = is_array($value) ? count($value) : 0; |
159 | 159 | if ($len > 0) { |
160 | 160 | $ret = []; |
161 | - for ($i=0; $i<$len; $i+=2) { |
|
162 | - $ret[$value[$i]] = $value[$i+1]; |
|
161 | + for ($i = 0; $i < $len; $i += 2) { |
|
162 | + $ret[$value[$i]] = $value[$i + 1]; |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | return $ret; |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | public function zRank($key, $member) |
177 | 177 | { |
178 | 178 | $command = Enum::ZRANK; |
179 | - $args = [$key,$member]; |
|
179 | + $args = [$key, $member]; |
|
180 | 180 | |
181 | 181 | return $this->dispatch(Builder::build($command, $args)); |
182 | 182 | } |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | public function zRemRangeByRank($key, $start, $stop) |
215 | 215 | { |
216 | 216 | $command = Enum::ZREMRANGEBYRANK; |
217 | - $args = [$key, $start,$stop]; |
|
217 | + $args = [$key, $start, $stop]; |
|
218 | 218 | |
219 | 219 | return $this->dispatch(Builder::build($command, $args)); |
220 | 220 | } |
@@ -245,13 +245,13 @@ discard block |
||
245 | 245 | $args[] = 'WITHSCORES'; |
246 | 246 | |
247 | 247 | return $this->dispatch(Builder::build($command, $args)) |
248 | - ->then(function ($value) { |
|
248 | + ->then(function($value) { |
|
249 | 249 | $len = is_array($value) ? count($value) : 0; |
250 | 250 | if ($len > 0) { |
251 | 251 | $ret = []; |
252 | - for ($i=0; $i<$len; $i+=2) { |
|
252 | + for ($i = 0; $i < $len; $i += 2) { |
|
253 | 253 | $member = $value[$i]; |
254 | - $score = $value[$i+1]; |
|
254 | + $score = $value[$i + 1]; |
|
255 | 255 | $ret[$member] = $score; |
256 | 256 | } |
257 | 257 | |
@@ -283,12 +283,12 @@ discard block |
||
283 | 283 | } |
284 | 284 | $promise = $this->dispatch(Builder::build($command, $args)); |
285 | 285 | |
286 | - return $withScores ? $promise->then(function ($value) { |
|
286 | + return $withScores ? $promise->then(function($value) { |
|
287 | 287 | $len = is_array($value) ? count($value) : 0; |
288 | 288 | if ($len > 0) { |
289 | 289 | $ret = []; |
290 | - for ($i=0; $i<$len; $i+=2) { |
|
291 | - $ret[$value[$i]] = $value[$i+1]; |
|
290 | + for ($i = 0; $i < $len; $i += 2) { |
|
291 | + $ret[$value[$i]] = $value[$i + 1]; |
|
292 | 292 | } |
293 | 293 | |
294 | 294 | return $ret; |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | public function zRevRank($key, $member) |
306 | 306 | { |
307 | 307 | $command = Enum::ZREVRANK; |
308 | - $args = [$key,$member]; |
|
308 | + $args = [$key, $member]; |
|
309 | 309 | |
310 | 310 | return $this->dispatch(Builder::build($command, $args)); |
311 | 311 | } |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | public function zScore($key, $member) |
318 | 318 | { |
319 | 319 | $command = Enum::ZSCORE; |
320 | - $args = [$key,$member]; |
|
320 | + $args = [$key, $member]; |
|
321 | 321 | |
322 | 322 | return $this->dispatch(Builder::build($command, $args)); |
323 | 323 | } |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | { |
331 | 331 | // TODO: Implement zScan() method. |
332 | 332 | $command = Enum::ZSCAN; |
333 | - $args = [$key , $cursor]; |
|
333 | + $args = [$key, $cursor]; |
|
334 | 334 | $args = array_merge($args, $options); |
335 | 335 | |
336 | 336 | return $this->dispatch(Builder::build($command, $args)); |
@@ -95,12 +95,14 @@ discard block |
||
95 | 95 | { |
96 | 96 | $command = Enum::ZRANGE; |
97 | 97 | $args = [$key, $star, $stop]; |
98 | - if ($withScores) { |
|
98 | + if ($withScores) |
|
99 | + { |
|
99 | 100 | $args[] = 'WITHSCORES'; |
100 | 101 | return $this->dispatch(Builder::build($command, $args))->then(function ($value) { |
101 | 102 | $len = count($value); |
102 | 103 | $ret = []; |
103 | - for ($i=0; $i<$len; $i+=2) { |
|
104 | + for ($i=0; $i<$len; $i+=2) |
|
105 | + { |
|
104 | 106 | $ret[$value[$i]] = $value[$i+1]; |
105 | 107 | } |
106 | 108 | return $ret; |
@@ -144,10 +146,12 @@ discard block |
||
144 | 146 | { |
145 | 147 | $command = Enum::ZRANGEBYSCORE; |
146 | 148 | $args = [$key, $min, $max]; |
147 | - if ($withScores === true) { |
|
149 | + if ($withScores === true) |
|
150 | + { |
|
148 | 151 | $args[] = 'WITHSCORES'; |
149 | 152 | } |
150 | - if ($offset != 0 || $count != 0) { |
|
153 | + if ($offset != 0 || $count != 0) |
|
154 | + { |
|
151 | 155 | $args[] = 'LIMIT'; |
152 | 156 | $args[] = $offset; |
153 | 157 | $args[] = $count; |
@@ -156,9 +160,11 @@ discard block |
||
156 | 160 | |
157 | 161 | return $withScores ? $promise->then(function ($value) { |
158 | 162 | $len = is_array($value) ? count($value) : 0; |
159 | - if ($len > 0) { |
|
163 | + if ($len > 0) |
|
164 | + { |
|
160 | 165 | $ret = []; |
161 | - for ($i=0; $i<$len; $i+=2) { |
|
166 | + for ($i=0; $i<$len; $i+=2) |
|
167 | + { |
|
162 | 168 | $ret[$value[$i]] = $value[$i+1]; |
163 | 169 | } |
164 | 170 | |
@@ -241,15 +247,18 @@ discard block |
||
241 | 247 | $command = Enum::ZREVRANGE; |
242 | 248 | $args = [$key, $start, $stop]; |
243 | 249 | |
244 | - if ($withScores === true) { |
|
250 | + if ($withScores === true) |
|
251 | + { |
|
245 | 252 | $args[] = 'WITHSCORES'; |
246 | 253 | |
247 | 254 | return $this->dispatch(Builder::build($command, $args)) |
248 | 255 | ->then(function ($value) { |
249 | 256 | $len = is_array($value) ? count($value) : 0; |
250 | - if ($len > 0) { |
|
257 | + if ($len > 0) |
|
258 | + { |
|
251 | 259 | $ret = []; |
252 | - for ($i=0; $i<$len; $i+=2) { |
|
260 | + for ($i=0; $i<$len; $i+=2) |
|
261 | + { |
|
253 | 262 | $member = $value[$i]; |
254 | 263 | $score = $value[$i+1]; |
255 | 264 | $ret[$member] = $score; |
@@ -273,10 +282,12 @@ discard block |
||
273 | 282 | { |
274 | 283 | $command = Enum::ZREVRANGEBYSCORE; |
275 | 284 | $args = [$key, $max, $min]; |
276 | - if ($withScores === true) { |
|
285 | + if ($withScores === true) |
|
286 | + { |
|
277 | 287 | $args[] = 'WITHSCORES'; |
278 | 288 | } |
279 | - if ($offset != 0 || $count != 0) { |
|
289 | + if ($offset != 0 || $count != 0) |
|
290 | + { |
|
280 | 291 | $args[] = 'LIMIT'; |
281 | 292 | $args[] = $offset; |
282 | 293 | $args[] = $count; |
@@ -285,9 +296,11 @@ discard block |
||
285 | 296 | |
286 | 297 | return $withScores ? $promise->then(function ($value) { |
287 | 298 | $len = is_array($value) ? count($value) : 0; |
288 | - if ($len > 0) { |
|
299 | + if ($len > 0) |
|
300 | + { |
|
289 | 301 | $ret = []; |
290 | - for ($i=0; $i<$len; $i+=2) { |
|
302 | + for ($i=0; $i<$len; $i+=2) |
|
303 | + { |
|
291 | 304 | $ret[$value[$i]] = $value[$i+1]; |
292 | 305 | } |
293 | 306 |
@@ -83,7 +83,7 @@ |
||
83 | 83 | * @param array $args |
84 | 84 | * @return mixed |
85 | 85 | */ |
86 | - public function slowLog($command, array $args=[]); |
|
86 | + public function slowLog($command, array $args = []); |
|
87 | 87 | |
88 | 88 | /** |
89 | 89 | * @doc https://redis.io/commands/save |
@@ -59,7 +59,7 @@ |
||
59 | 59 | public function sIsMember($key, $member) |
60 | 60 | { |
61 | 61 | $command = Enum::SISMEMBER; |
62 | - $args = [$key ,$member]; |
|
62 | + $args = [$key, $member]; |
|
63 | 63 | |
64 | 64 | return $this->dispatch(Builder::build($command, $args)); |
65 | 65 | } |