| @@ -6,5 +6,8 @@ | ||
| 6 | 6 | |
| 7 | 7 | interface DriverInterface | 
| 8 | 8 |  { | 
| 9 | + /** | |
| 10 | + * @return string | |
| 11 | + */ | |
| 9 | 12 | public function commands(Request $request); | 
| 10 | 13 | } | 
| 11 | 14 | \ No newline at end of file | 
| @@ -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 | +} | |
| @@ -18,7 +18,7 @@ | ||
| 18 | 18 | * @param string $message | 
| 19 | 19 | * @return mixed | 
| 20 | 20 | */ | 
| 21 | - public function ping($message='pong'); | |
| 21 | + public function ping($message = 'pong'); | |
| 22 | 22 | |
| 23 | 23 | /** | 
| 24 | 24 | * @doc https://redis.io/commands/quit | 
| @@ -37,7 +37,7 @@ | ||
| 37 | 37 | * @param array $args | 
| 38 | 38 | * @return mixed | 
| 39 | 39 | */ | 
| 40 | - public function sLowLog($command, array $args=[]); | |
| 40 | + public function sLowLog($command, array $args = []); | |
| 41 | 41 | |
| 42 | 42 | /** | 
| 43 | 43 | * @doc https://redis.io/commands/smembers | 
| @@ -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=0); | |
| 24 | + public function bitCount($key, $start = 0, $end = 0); | |
| 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=0); | |
| 55 | + public function bitPos($key, $bit, $start = 0, $end = 0); | |
| 56 | 56 | |
| 57 | 57 | /** | 
| 58 | 58 | * @doc https://redis.io/commands/decr | 
| @@ -48,13 +48,13 @@ | ||
| 48 | 48 | $command = Enum::HGETALL; | 
| 49 | 49 | $args = [$key]; | 
| 50 | 50 | |
| 51 | -        return $this->dispatch(Builder::build($command, $args))->then(function ($value) { | |
| 51 | +        return $this->dispatch(Builder::build($command, $args))->then(function($value) { | |
| 52 | 52 |              if (!empty($value)) { | 
| 53 | 53 | $tmp = []; | 
| 54 | 54 | $size = count($value); | 
| 55 | -                for ($i=0; $i<$size; $i+=2) { | |
| 55 | +                for ($i = 0; $i < $size; $i += 2) { | |
| 56 | 56 | $field = $value[$i]; | 
| 57 | - $val = $value[$i+1]; | |
| 57 | + $val = $value[$i + 1]; | |
| 58 | 58 | $tmp[$field] = $val; | 
| 59 | 59 | } | 
| 60 | 60 | $value = $tmp; | 
| @@ -49,10 +49,12 @@ discard block | ||
| 49 | 49 | $args = [$key]; | 
| 50 | 50 | |
| 51 | 51 |          return $this->dispatch(Builder::build($command, $args))->then(function ($value) { | 
| 52 | -            if (!empty($value)) { | |
| 52 | + if (!empty($value)) | |
| 53 | +            { | |
| 53 | 54 | $tmp = []; | 
| 54 | 55 | $size = count($value); | 
| 55 | -                for ($i=0; $i<$size; $i+=2) { | |
| 56 | + for ($i=0; $i<$size; $i+=2) | |
| 57 | +                { | |
| 56 | 58 | $field = $value[$i]; | 
| 57 | 59 | $val = $value[$i+1]; | 
| 58 | 60 | $tmp[$field] = $val; | 
| @@ -133,8 +135,10 @@ discard block | ||
| 133 | 135 |      { | 
| 134 | 136 | $command = Enum::HMSET; | 
| 135 | 137 | $args = [$key]; | 
| 136 | -        if (!empty($fvMap)) { | |
| 137 | -            foreach ($fvMap as $field => $value) { | |
| 138 | + if (!empty($fvMap)) | |
| 139 | +        { | |
| 140 | + foreach ($fvMap as $field => $value) | |
| 141 | +            { | |
| 138 | 142 | $tmp[] = $field; | 
| 139 | 143 | $tmp[] = $value; | 
| 140 | 144 | } | 
| @@ -60,7 +60,7 @@ | ||
| 60 | 60 |      { | 
| 61 | 61 | // TODO: Implement geoDist() method. | 
| 62 | 62 | $command = Enum::GEODIST; | 
| 63 | - $args = [$key, $memberA, $memberB ,$unit]; | |
| 63 | + $args = [$key, $memberA, $memberB, $unit]; | |
| 64 | 64 | |
| 65 | 65 | return $this->dispatch(Builder::build($command, $args)); | 
| 66 | 66 | } | 
| @@ -103,14 +103,14 @@ | ||
| 103 | 103 |      { | 
| 104 | 104 | $command = Enum::INFO; | 
| 105 | 105 | |
| 106 | -        return $this->dispatch(Builder::build($command, $section))->then(function ($value) { | |
| 106 | +        return $this->dispatch(Builder::build($command, $section))->then(function($value) { | |
| 107 | 107 |              if ($value) { | 
| 108 | 108 | $ret = explode(PHP_EOL, $value); | 
| 109 | 109 | $handled = []; | 
| 110 | 110 | $lastKey = ''; | 
| 111 | 111 |                  foreach ($ret as $_ => $v) { | 
| 112 | 112 |                      if (($pos = strpos($v, '#')) !== false) { | 
| 113 | - $lastKey = strtolower(substr($v,$pos+2)); | |
| 113 | + $lastKey = strtolower(substr($v, $pos + 2)); | |
| 114 | 114 | $handled[$lastKey] = []; | 
| 115 | 115 | continue; | 
| 116 | 116 | } | 
| @@ -104,18 +104,22 @@ | ||
| 104 | 104 | $command = Enum::INFO; | 
| 105 | 105 | |
| 106 | 106 |          return $this->dispatch(Builder::build($command, $section))->then(function ($value) { | 
| 107 | -            if ($value) { | |
| 107 | + if ($value) | |
| 108 | +            { | |
| 108 | 109 | $ret = explode(PHP_EOL, $value); | 
| 109 | 110 | $handled = []; | 
| 110 | 111 | $lastKey = ''; | 
| 111 | -                foreach ($ret as $_ => $v) { | |
| 112 | -                    if (($pos = strpos($v, '#')) !== false) { | |
| 112 | + foreach ($ret as $_ => $v) | |
| 113 | +                { | |
| 114 | + if (($pos = strpos($v, '#')) !== false) | |
| 115 | +                    { | |
| 113 | 116 | $lastKey = strtolower(substr($v,$pos+2)); | 
| 114 | 117 | $handled[$lastKey] = []; | 
| 115 | 118 | continue; | 
| 116 | 119 | } | 
| 117 | 120 |                      $statMap = explode(':', $v); | 
| 118 | -                    if ($statMap[0]) { | |
| 121 | + if ($statMap[0]) | |
| 122 | +                    { | |
| 119 | 123 |                          list($name, $stat) = explode(':', $v); | 
| 120 | 124 | $handled[$lastKey][$name] = $stat; | 
| 121 | 125 | } | 
| @@ -347,7 +347,7 @@ | ||
| 347 | 347 | * @override | 
| 348 | 348 | * @inheritDoc | 
| 349 | 349 | */ | 
| 350 | - public function del($key,...$keys) | |
| 350 | + public function del($key, ...$keys) | |
| 351 | 351 |      { | 
| 352 | 352 | $command = Enum::DEL; | 
| 353 | 353 | $keys[] = $key; | 
| @@ -45,7 +45,8 @@ | ||
| 45 | 45 | public function bitField($key, $subCommand = null, ...$param) | 
| 46 | 46 |      { | 
| 47 | 47 | $command = Enum::BITFIELD; | 
| 48 | -        switch ($subCommand = strtoupper($subCommand)) { | |
| 48 | + switch ($subCommand = strtoupper($subCommand)) | |
| 49 | +        { | |
| 49 | 50 |              case 'GET' : { | 
| 50 | 51 | list ($type, $offset) = $param; | 
| 51 | 52 | $args = [$subCommand, $type, $offset]; |