@@ -103,11 +103,11 @@ discard block |
||
| 103 | 103 | $args = [$key, $star, $stop]; |
| 104 | 104 | if ($withScores) { |
| 105 | 105 | $args[] = 'WITHSCORES'; |
| 106 | - return $this->dispatch(Builder::build($command, $args))->then(function ($value) { |
|
| 106 | + return $this->dispatch(Builder::build($command, $args))->then(function($value) { |
|
| 107 | 107 | $len = count($value); |
| 108 | 108 | $ret = []; |
| 109 | - for ($i=0; $i<$len; $i+=2) { |
|
| 110 | - $ret[$value[$i]] = $value[$i+1]; |
|
| 109 | + for ($i = 0; $i < $len; $i += 2) { |
|
| 110 | + $ret[$value[$i]] = $value[$i + 1]; |
|
| 111 | 111 | } |
| 112 | 112 | return $ret; |
| 113 | 113 | }); |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | { |
| 125 | 125 | $command = Enum::ZRANGEBYLEX; |
| 126 | 126 | $args = [$key, $min, $max]; |
| 127 | - $args = array_merge($args,$options); |
|
| 127 | + $args = array_merge($args, $options); |
|
| 128 | 128 | |
| 129 | 129 | return $this->dispatch(Builder::build($command, $args)); |
| 130 | 130 | } |
@@ -136,8 +136,8 @@ discard block |
||
| 136 | 136 | public function zRevRangeByLex($key, $max, $min, array $options = []) |
| 137 | 137 | { |
| 138 | 138 | $command = Enum::ZREVRANGEBYLEX; |
| 139 | - $args = [$key, $max,$min]; |
|
| 140 | - $args = array_merge($args,$options); |
|
| 139 | + $args = [$key, $max, $min]; |
|
| 140 | + $args = array_merge($args, $options); |
|
| 141 | 141 | |
| 142 | 142 | return $this->dispatch(Builder::build($command, $args)); |
| 143 | 143 | } |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | public function zRangeByScore($key, $min, $max, array $options = []) |
| 150 | 150 | { |
| 151 | 151 | $command = Enum::ZRANGEBYSCORE; |
| 152 | - $args = [$key, $min,$max]; |
|
| 152 | + $args = [$key, $min, $max]; |
|
| 153 | 153 | $args = array_merge($args, $options); |
| 154 | 154 | |
| 155 | 155 | return $this->dispatch(Builder::build($command, $args)); |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | public function zRank($key, $member) |
| 163 | 163 | { |
| 164 | 164 | $command = Enum::ZRANK; |
| 165 | - $args = [$key,$member]; |
|
| 165 | + $args = [$key, $member]; |
|
| 166 | 166 | |
| 167 | 167 | return $this->dispatch(Builder::build($command, $args)); |
| 168 | 168 | } |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | public function zRemRangeByRank($key, $start, $stop) |
| 201 | 201 | { |
| 202 | 202 | $command = Enum::ZREMRANGEBYRANK; |
| 203 | - $args = [$key, $start,$stop]; |
|
| 203 | + $args = [$key, $start, $stop]; |
|
| 204 | 204 | |
| 205 | 205 | return $this->dispatch(Builder::build($command, $args)); |
| 206 | 206 | } |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | public function zRevRangeByScore($key, $max, $min, array $options = []) |
| 239 | 239 | { |
| 240 | 240 | $command = Enum::ZREVRANGEBYSCORE; |
| 241 | - $args = [$key,$max,$min]; |
|
| 241 | + $args = [$key, $max, $min]; |
|
| 242 | 242 | $args = array_merge($args, $options); |
| 243 | 243 | |
| 244 | 244 | return $this->dispatch(Builder::build($command, $args)); |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | public function zRevRank($key, $member) |
| 252 | 252 | { |
| 253 | 253 | $command = Enum::ZREVRANK; |
| 254 | - $args = [$key,$member]; |
|
| 254 | + $args = [$key, $member]; |
|
| 255 | 255 | |
| 256 | 256 | return $this->dispatch(Builder::build($command, $args)); |
| 257 | 257 | } |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | public function zScore($key, $member) |
| 264 | 264 | { |
| 265 | 265 | $command = Enum::ZSCORE; |
| 266 | - $args = [$key,$member]; |
|
| 266 | + $args = [$key, $member]; |
|
| 267 | 267 | |
| 268 | 268 | return $this->dispatch(Builder::build($command, $args)); |
| 269 | 269 | } |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | { |
| 277 | 277 | // TODO: Implement zScan() method. |
| 278 | 278 | $command = Enum::ZSCAN; |
| 279 | - $args = [$key , $cursor]; |
|
| 279 | + $args = [$key, $cursor]; |
|
| 280 | 280 | $args = array_merge($args, $options); |
| 281 | 281 | |
| 282 | 282 | return $this->dispatch(Builder::build($command, $args)); |
@@ -22,8 +22,10 @@ discard block |
||
| 22 | 22 | { |
| 23 | 23 | $command = Enum::ZADD; |
| 24 | 24 | $args = array_merge([$key], $options); |
| 25 | - if (!empty($scoreMembers)) { |
|
| 26 | - foreach ($scoreMembers as $score => $member) { |
|
| 25 | + if (!empty($scoreMembers)) |
|
| 26 | + { |
|
| 27 | + foreach ($scoreMembers as $score => $member) |
|
| 28 | + { |
|
| 27 | 29 | $args[] = (float) $score; |
| 28 | 30 | $args[] = $member; |
| 29 | 31 | } |
@@ -101,12 +103,14 @@ discard block |
||
| 101 | 103 | { |
| 102 | 104 | $command = Enum::ZRANGE; |
| 103 | 105 | $args = [$key, $star, $stop]; |
| 104 | - if ($withScores) { |
|
| 106 | + if ($withScores) |
|
| 107 | + { |
|
| 105 | 108 | $args[] = 'WITHSCORES'; |
| 106 | 109 | return $this->dispatch(Builder::build($command, $args))->then(function ($value) { |
| 107 | 110 | $len = count($value); |
| 108 | 111 | $ret = []; |
| 109 | - for ($i=0; $i<$len; $i+=2) { |
|
| 112 | + for ($i=0; $i<$len; $i+=2) |
|
| 113 | + { |
|
| 110 | 114 | $ret[$value[$i]] = $value[$i+1]; |
| 111 | 115 | } |
| 112 | 116 | return $ret; |
@@ -66,7 +66,6 @@ |
||
| 66 | 66 | * @param $key |
| 67 | 67 | * @param $star |
| 68 | 68 | * @param $stop |
| 69 | - * @param array $options |
|
| 70 | 69 | * @return mixed |
| 71 | 70 | */ |
| 72 | 71 | public function zRange($key, $star = 0, $stop = -1, $withScores = false); |
@@ -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 |
@@ -47,7 +47,8 @@ discard block |
||
| 47 | 47 | $command = Enum::BITFIELD; |
| 48 | 48 | $subCommand = strtoupper($subCommand); |
| 49 | 49 | //TODO: control flow improvement |
| 50 | - switch ($subCommand) { |
|
| 50 | + switch ($subCommand) |
|
| 51 | + { |
|
| 51 | 52 | case 'GET' : { |
| 52 | 53 | @list ($type, $offset) = $param; |
| 53 | 54 | $args = [$key, $subCommand, $type, $offset]; |
@@ -304,8 +305,10 @@ discard block |
||
| 304 | 305 | { |
| 305 | 306 | $command = Enum::MSET; |
| 306 | 307 | $args = []; |
| 307 | - if (!empty($kvMap)) { |
|
| 308 | - foreach ($kvMap as $key => $val) { |
|
| 308 | + if (!empty($kvMap)) |
|
| 309 | + { |
|
| 310 | + foreach ($kvMap as $key => $val) |
|
| 311 | + { |
|
| 309 | 312 | $args[] = $key; |
| 310 | 313 | $args[] = $val; |
| 311 | 314 | } |
@@ -322,8 +325,10 @@ discard block |
||
| 322 | 325 | { |
| 323 | 326 | $command = Enum::MSETNX; |
| 324 | 327 | $args = []; |
| 325 | - if (!empty($kvMap)) { |
|
| 326 | - foreach ($kvMap as $key => $val) { |
|
| 328 | + if (!empty($kvMap)) |
|
| 329 | + { |
|
| 330 | + foreach ($kvMap as $key => $val) |
|
| 331 | + { |
|
| 327 | 332 | $args[] = $key; |
| 328 | 333 | $args[] = $val; |
| 329 | 334 | } |