Completed
Push — master ( 52cc4c...9e125a )
by Kamil
11s
created
src/Redis/Driver/DriverInterface.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -6,5 +6,8 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
src/Redis/Driver/RequestInterface.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,4 +5,5 @@
 block discarded – undo
5 5
 use Clue\Redis\Protocol\Model\ModelInterface as ClueModelInterface;
6 6
 
7 7
 interface RequestInterface extends ClueModelInterface
8
-{}
8
+{
9
+}
Please login to merge, or discard this patch.
src/Redis/Redis.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -162,7 +162,7 @@
 block discarded – undo
162 162
 
163 163
         $this->reqs = [];
164 164
 
165
-         // TODO patch missing pub/sub, pipeline, auth
165
+            // TODO patch missing pub/sub, pipeline, auth
166 166
         $this->handleStop();
167 167
         $this->emit('stop', [ $this ]);
168 168
 
Please login to merge, or discard this patch.
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 
134 134
         // TODO patch missing pub/sub, pipeline, auth
135 135
         $this->handleStart();
136
-        $this->emit('start', [ $this ]);
136
+        $this->emit('start', [$this]);
137 137
 
138 138
         return true;
139 139
     }
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 
165 165
          // TODO patch missing pub/sub, pipeline, auth
166 166
         $this->handleStop();
167
-        $this->emit('stop', [ $this ]);
167
+        $this->emit('stop', [$this]);
168 168
 
169 169
         return true;
170 170
     }
@@ -216,8 +216,8 @@  discard block
 block discarded – undo
216 216
     {
217 217
         if ($this->stream !== null)
218 218
         {
219
-            $this->stream->on('data', [ $this, 'handleData' ]);
220
-            $this->stream->on('close', [ $this, 'stop' ]);
219
+            $this->stream->on('data', [$this, 'handleData']);
220
+            $this->stream->on('close', [$this, 'stop']);
221 221
         }
222 222
     }
223 223
 
@@ -228,8 +228,8 @@  discard block
 block discarded – undo
228 228
     {
229 229
         if ($this->stream !== null)
230 230
         {
231
-            $this->stream->removeListener('data', [ $this, 'handleData' ]);
232
-            $this->stream->removeListener('close', [ $this, 'stop' ]);
231
+            $this->stream->removeListener('data', [$this, 'handleData']);
232
+            $this->stream->removeListener('close', [$this, 'stop']);
233 233
         }
234 234
     }
235 235
 
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
         }
247 247
         catch (ParserException $error)
248 248
         {
249
-            $this->emit('error', [ $this, $error ]);
249
+            $this->emit('error', [$this, $error]);
250 250
             $this->stop();
251 251
             return;
252 252
         }
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
             }
260 260
             catch (UnderflowException $error)
261 261
             {
262
-                $this->emit('error', [ $this, $error ]);
262
+                $this->emit('error', [$this, $error]);
263 263
                 $this->stop();
264 264
                 return;
265 265
             }
@@ -413,9 +413,9 @@  discard block
 block discarded – undo
413 413
         $keys[] = $timeout;
414 414
         $args = $keys;
415 415
         $promise = $this->dispatch(Builder::build($command, $args));
416
-        $promise = $promise->then(function ($value) {
416
+        $promise = $promise->then(function($value) {
417 417
             if (is_array($value)) {
418
-                list($k,$v) = $value;
418
+                list($k, $v) = $value;
419 419
 
420 420
                 return [
421 421
                     'key'=>$k,
@@ -436,9 +436,9 @@  discard block
 block discarded – undo
436 436
         $keys[] = $timeout;
437 437
         $args = $keys;
438 438
         $promise = $this->dispatch(Builder::build($command, $args));
439
-        $promise = $promise->then(function ($value) {
439
+        $promise = $promise->then(function($value) {
440 440
             if (is_array($value)) {
441
-                list($k,$v) = $value;
441
+                list($k, $v) = $value;
442 442
 
443 443
                 return [
444 444
                     'key'=>$k,
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
         return $this->dispatch(Builder::build($command, $args));
480 480
     }
481 481
 
482
-    public function del($key,...$keys)
482
+    public function del($key, ...$keys)
483 483
     {
484 484
         $command = Enum::DEL;
485 485
         $keys[] = $key;
@@ -850,13 +850,13 @@  discard block
 block discarded – undo
850 850
         $command = Enum::HGETALL;
851 851
         $args = [$key];
852 852
 
853
-        return $this->dispatch(Builder::build($command, $args))->then(function ($value) {
853
+        return $this->dispatch(Builder::build($command, $args))->then(function($value) {
854 854
             if (!empty($value)) {
855 855
                 $tmp = [];
856 856
                 $size = count($value);
857
-                for ($i=0; $i<$size; $i+=2) {
857
+                for ($i = 0; $i < $size; $i += 2) {
858 858
                     $field = $value[$i];
859
-                    $val = $value[$i+1];
859
+                    $val = $value[$i + 1];
860 860
                     $tmp[$field] = $val;
861 861
                 }
862 862
                 $value = $tmp;
@@ -985,7 +985,7 @@  discard block
 block discarded – undo
985 985
     {
986 986
         // TODO: Implement geoDist() method.
987 987
         $command = Enum::GEODIST;
988
-        $args = [$key, $memberA, $memberB ,$unit];
988
+        $args = [$key, $memberA, $memberB, $unit];
989 989
 
990 990
         return $this->dispatch(Builder::build($command, $args));
991 991
     }
@@ -1088,7 +1088,7 @@  discard block
 block discarded – undo
1088 1088
         return $this->dispatch(Builder::build($command, $args));
1089 1089
     }
1090 1090
 
1091
-    public function lPush($key,...$values)
1091
+    public function lPush($key, ...$values)
1092 1092
     {
1093 1093
         $command = Enum::LPUSH;
1094 1094
         array_unshift($values, $key);
@@ -1405,14 +1405,14 @@  discard block
 block discarded – undo
1405 1405
     {
1406 1406
         $command = Enum::INFO;
1407 1407
 
1408
-        return $this->dispatch(Builder::build($command, $section))->then(function ($value) {
1408
+        return $this->dispatch(Builder::build($command, $section))->then(function($value) {
1409 1409
             if ($value) {
1410 1410
                 $ret = explode(PHP_EOL, $value);
1411 1411
                 $handled = [];
1412 1412
                 $lastKey = '';
1413 1413
                 foreach ($ret as $_ => $v) {
1414 1414
                     if (($pos = strpos($v, '#')) !== false) {
1415
-                        $lastKey = strtolower(substr($v,$pos+2));
1415
+                        $lastKey = strtolower(substr($v, $pos + 2));
1416 1416
                         $handled[$lastKey] = [];
1417 1417
                         continue;
1418 1418
                     }
@@ -1489,7 +1489,7 @@  discard block
 block discarded – undo
1489 1489
     {
1490 1490
         // TODO: Implement zRange() method.
1491 1491
         $command = Enum::ZRANGE;
1492
-        $args = [$key, $star,$stop];
1492
+        $args = [$key, $star, $stop];
1493 1493
         $args = array_merge($args, $options);
1494 1494
 
1495 1495
         return $this->dispatch(Builder::build($command, $args));
@@ -1500,7 +1500,7 @@  discard block
 block discarded – undo
1500 1500
         // TODO: Implement zRangeByLex() method.
1501 1501
         $command = Enum::ZRANGEBYLEX;
1502 1502
         $args = [$key, $min, $max];
1503
-        $args = array_merge($args,$options);
1503
+        $args = array_merge($args, $options);
1504 1504
 
1505 1505
         return $this->dispatch(Builder::build($command, $args));
1506 1506
     }
@@ -1509,8 +1509,8 @@  discard block
 block discarded – undo
1509 1509
     {
1510 1510
         // TODO: Implement zRevRangeByLex() method.
1511 1511
         $command = Enum::ZREVRANGEBYLEX;
1512
-        $args = [$key, $max,$min];
1513
-        $args = array_merge($args,$options);
1512
+        $args = [$key, $max, $min];
1513
+        $args = array_merge($args, $options);
1514 1514
 
1515 1515
         return $this->dispatch(Builder::build($command, $args));
1516 1516
     }
@@ -1519,7 +1519,7 @@  discard block
 block discarded – undo
1519 1519
     {
1520 1520
         // TODO: Implement zRangeByScore() method.
1521 1521
         $command = Enum::ZRANGEBYSCORE;
1522
-        $args = [$key, $min,$max];
1522
+        $args = [$key, $min, $max];
1523 1523
         $args = array_merge($args, $options);
1524 1524
 
1525 1525
         return $this->dispatch(Builder::build($command, $args));
@@ -1529,7 +1529,7 @@  discard block
 block discarded – undo
1529 1529
     {
1530 1530
         // TODO: Implement zRank() method.
1531 1531
         $command = Enum::ZRANK;
1532
-        $args = [$key,$member];
1532
+        $args = [$key, $member];
1533 1533
 
1534 1534
         return $this->dispatch(Builder::build($command, $args));
1535 1535
     }
@@ -1557,7 +1557,7 @@  discard block
 block discarded – undo
1557 1557
     {
1558 1558
         // TODO: Implement zRemRangeByRank() method.
1559 1559
         $command = Enum::ZREMRANGEBYRANK;
1560
-        $args = [$key, $start,$stop];
1560
+        $args = [$key, $start, $stop];
1561 1561
 
1562 1562
         return $this->dispatch(Builder::build($command, $args));
1563 1563
     }
@@ -1585,7 +1585,7 @@  discard block
 block discarded – undo
1585 1585
     {
1586 1586
         // TODO: Implement zRevRangeByScore() method.
1587 1587
         $command = Enum::ZREVRANGEBYSCORE;
1588
-        $args = [$key,$max,$min];
1588
+        $args = [$key, $max, $min];
1589 1589
         $args = array_merge($args, $options);
1590 1590
 
1591 1591
         return $this->dispatch(Builder::build($command, $args));
@@ -1595,7 +1595,7 @@  discard block
 block discarded – undo
1595 1595
     {
1596 1596
         // TODO: Implement zRevRank() method.
1597 1597
         $command = Enum::ZREVRANK;
1598
-        $args = [$key,$member];
1598
+        $args = [$key, $member];
1599 1599
 
1600 1600
         return $this->dispatch(Builder::build($command, $args));
1601 1601
     }
@@ -1604,7 +1604,7 @@  discard block
 block discarded – undo
1604 1604
     {
1605 1605
         // TODO: Implement zScore() method.
1606 1606
         $command = Enum::ZSCORE;
1607
-        $args = [$key,$member];
1607
+        $args = [$key, $member];
1608 1608
 
1609 1609
         return $this->dispatch(Builder::build($command, $args));
1610 1610
     }
@@ -1642,7 +1642,7 @@  discard block
 block discarded – undo
1642 1642
     {
1643 1643
         // TODO: Implement zScan() method.
1644 1644
         $command = Enum::ZSCAN;
1645
-        $args = [$key , $cursor];
1645
+        $args = [$key, $cursor];
1646 1646
         $args = array_merge($args, $options);
1647 1647
 
1648 1648
         return $this->dispatch(Builder::build($command, $args));
@@ -1671,7 +1671,7 @@  discard block
 block discarded – undo
1671 1671
     {
1672 1672
         // TODO: Implement sIsMember() method.
1673 1673
         $command = Enum::SISMEMBER;
1674
-        $args = [$key ,$member];
1674
+        $args = [$key, $member];
1675 1675
 
1676 1676
         return $this->dispatch(Builder::build($command, $args));
1677 1677
     }
@@ -1689,7 +1689,7 @@  discard block
 block discarded – undo
1689 1689
     {
1690 1690
         // TODO: Implement sLowLog() method.
1691 1691
         $command = Enum::SLOWLOG;
1692
-        $args = array_merge([$command],$args);
1692
+        $args = array_merge([$command], $args);
1693 1693
 
1694 1694
         return $this->dispatch(Builder::build($command, $args));
1695 1695
     }
@@ -1708,7 +1708,7 @@  discard block
 block discarded – undo
1708 1708
         // TODO: Implement sMove() method.
1709 1709
         $command = Enum::SMOVE;
1710 1710
         $args = [$src, $dst];
1711
-        $args = array_merge( $args, $members);
1711
+        $args = array_merge($args, $members);
1712 1712
 
1713 1713
         return $this->dispatch(Builder::build($command, $args));
1714 1714
     }
Please login to merge, or discard this patch.
Braces   +30 added lines, -15 removed lines patch added patch discarded remove patch
@@ -118,9 +118,11 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
                     }
Please login to merge, or discard this patch.
src/Redis/Command/CommandInterface.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
      * @param int $end
43 43
      * @return mixed
44 44
      */
45
-    public function bitCount($key, $start=0, $end=0);
45
+    public function bitCount($key, $start = 0, $end = 0);
46 46
 
47 47
     /**
48 48
      * @doc https://redis.io/commands/bitfield
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
      * @param int $end
74 74
      * @return mixed
75 75
      */
76
-    public function bitPos($key, $bit, $start=0, $end=0);
76
+    public function bitPos($key, $bit, $start = 0, $end = 0);
77 77
 
78 78
     /**
79 79
      * @doc https://redis.io/commands/blpop
@@ -567,7 +567,7 @@  discard block
 block discarded – undo
567 567
      * @param string $message
568 568
      * @return mixed
569 569
      */
570
-    public function ping($message='pong');
570
+    public function ping($message = 'pong');
571 571
 
572 572
     /**
573 573
      * @doc https://redis.io/commands/quit
@@ -1357,7 +1357,7 @@  discard block
 block discarded – undo
1357 1357
      * @param array $args
1358 1358
      * @return mixed
1359 1359
      */
1360
-    public function sLowLog($command, array $args=[]);
1360
+    public function sLowLog($command, array $args = []);
1361 1361
 
1362 1362
     /**
1363 1363
      * @doc https://redis.io/commands/smembers
Please login to merge, or discard this patch.