@@ -5,4 +5,5 @@ |
||
| 5 | 5 | use Clue\Redis\Protocol\Model\ModelInterface as ClueModelInterface; |
| 6 | 6 | |
| 7 | 7 | interface RequestInterface extends ClueModelInterface |
| 8 | -{} |
|
| 8 | +{ |
|
| 9 | +} |
|
@@ -118,9 +118,11 @@ discard block |
||
| 118 | 118 | $stream = $this->createClient($this->endpoint); |
| 119 | 119 | } |
| 120 | 120 | catch (Error $ex) |
| 121 | - {} |
|
| 121 | + { |
|
| 122 | +} |
|
| 122 | 123 | catch (Exception $ex) |
| 123 | - {} |
|
| 124 | + { |
|
| 125 | +} |
|
| 124 | 126 | |
| 125 | 127 | if ($ex !== null) |
| 126 | 128 | { |
@@ -310,9 +312,11 @@ discard block |
||
| 310 | 312 | return new Socket($endpoint, $this->loop); |
| 311 | 313 | } |
| 312 | 314 | catch (Error $ex) |
| 313 | - {} |
|
| 315 | + { |
|
| 316 | +} |
|
| 314 | 317 | catch (Exception $ex) |
| 315 | - {} |
|
| 318 | + { |
|
| 319 | +} |
|
| 316 | 320 | |
| 317 | 321 | throw new ExecutionException('Redis connection socket could not be created!', 0, $ex); |
| 318 | 322 | } |
@@ -358,7 +362,8 @@ discard block |
||
| 358 | 362 | public function bitField($key, $subCommand = null, ...$param) |
| 359 | 363 | { |
| 360 | 364 | $command = Enum::BITFIELD; |
| 361 | - switch ($subCommand = strtoupper($subCommand)) { |
|
| 365 | + switch ($subCommand = strtoupper($subCommand)) |
|
| 366 | + { |
|
| 362 | 367 | case 'GET' : { |
| 363 | 368 | list ($type, $offset) = $param; |
| 364 | 369 | $args = [$subCommand, $type, $offset]; |
@@ -414,7 +419,8 @@ discard block |
||
| 414 | 419 | $args = $keys; |
| 415 | 420 | $promise = $this->dispatch(Builder::build($command, $args)); |
| 416 | 421 | $promise = $promise->then(function ($value) { |
| 417 | - if (is_array($value)) { |
|
| 422 | + if (is_array($value)) |
|
| 423 | + { |
|
| 418 | 424 | list($k,$v) = $value; |
| 419 | 425 | |
| 420 | 426 | return [ |
@@ -437,7 +443,8 @@ discard block |
||
| 437 | 443 | $args = $keys; |
| 438 | 444 | $promise = $this->dispatch(Builder::build($command, $args)); |
| 439 | 445 | $promise = $promise->then(function ($value) { |
| 440 | - if (is_array($value)) { |
|
| 446 | + if (is_array($value)) |
|
| 447 | + { |
|
| 441 | 448 | list($k,$v) = $value; |
| 442 | 449 | |
| 443 | 450 | return [ |
@@ -851,10 +858,12 @@ discard block |
||
| 851 | 858 | $args = [$key]; |
| 852 | 859 | |
| 853 | 860 | return $this->dispatch(Builder::build($command, $args))->then(function ($value) { |
| 854 | - if (!empty($value)) { |
|
| 861 | + if (!empty($value)) |
|
| 862 | + { |
|
| 855 | 863 | $tmp = []; |
| 856 | 864 | $size = count($value); |
| 857 | - for ($i=0; $i<$size; $i+=2) { |
|
| 865 | + for ($i=0; $i<$size; $i+=2) |
|
| 866 | + { |
|
| 858 | 867 | $field = $value[$i]; |
| 859 | 868 | $val = $value[$i+1]; |
| 860 | 869 | $tmp[$field] = $val; |
@@ -911,8 +920,10 @@ discard block |
||
| 911 | 920 | { |
| 912 | 921 | $command = Enum::HMSET; |
| 913 | 922 | $args = [$key]; |
| 914 | - if (!empty($fvMap)) { |
|
| 915 | - foreach ($fvMap as $field => $value) { |
|
| 923 | + if (!empty($fvMap)) |
|
| 924 | + { |
|
| 925 | + foreach ($fvMap as $field => $value) |
|
| 926 | + { |
|
| 916 | 927 | $tmp[] = $field; |
| 917 | 928 | $tmp[] = $value; |
| 918 | 929 | } |
@@ -1406,18 +1417,22 @@ discard block |
||
| 1406 | 1417 | $command = Enum::INFO; |
| 1407 | 1418 | |
| 1408 | 1419 | return $this->dispatch(Builder::build($command, $section))->then(function ($value) { |
| 1409 | - if ($value) { |
|
| 1420 | + if ($value) |
|
| 1421 | + { |
|
| 1410 | 1422 | $ret = explode(PHP_EOL, $value); |
| 1411 | 1423 | $handled = []; |
| 1412 | 1424 | $lastKey = ''; |
| 1413 | - foreach ($ret as $_ => $v) { |
|
| 1414 | - if (($pos = strpos($v, '#')) !== false) { |
|
| 1425 | + foreach ($ret as $_ => $v) |
|
| 1426 | + { |
|
| 1427 | + if (($pos = strpos($v, '#')) !== false) |
|
| 1428 | + { |
|
| 1415 | 1429 | $lastKey = strtolower(substr($v,$pos+2)); |
| 1416 | 1430 | $handled[$lastKey] = []; |
| 1417 | 1431 | continue; |
| 1418 | 1432 | } |
| 1419 | 1433 | $statMap = explode(':', $v); |
| 1420 | - if ($statMap[0]) { |
|
| 1434 | + if ($statMap[0]) |
|
| 1435 | + { |
|
| 1421 | 1436 | list($name, $stat) = explode(':', $v); |
| 1422 | 1437 | $handled[$lastKey][$name] = $stat; |
| 1423 | 1438 | } |
@@ -85,7 +85,8 @@ |
||
| 85 | 85 | }); |
| 86 | 86 | |
| 87 | 87 | $redis->rename('test','new_test')->then(function ($value) use ($redis) { |
| 88 | - if ($value == 'OK') { |
|
| 88 | + if ($value == 'OK') |
|
| 89 | + { |
|
| 89 | 90 | global $ret; |
| 90 | 91 | $ret[] = 'RENAME OK'; |
| 91 | 92 | } |