@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | /** |
| 108 | 108 | * Obtain multiple cache items by their unique keys |
| 109 | 109 | * |
| 110 | - * @param array|Traversable $keys A list of keys that can obtained in a single operation. |
|
| 110 | + * @param string[] $keys A list of keys that can obtained in a single operation. |
|
| 111 | 111 | * |
| 112 | 112 | * @return array An array of key => value pairs. Cache keys that do not exist or are stale will have a value of null. |
| 113 | 113 | */ |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | /** |
| 140 | 140 | * Delete multiple cache items in a single operation |
| 141 | 141 | * |
| 142 | - * @param array|Traversable $keys The array of string-based keys to be deleted |
|
| 142 | + * @param string[] $keys The array of string-based keys to be deleted |
|
| 143 | 143 | * |
| 144 | 144 | * @return bool True on success and false on failure |
| 145 | 145 | */ |
@@ -28,20 +28,20 @@ discard block |
||
| 28 | 28 | public function __construct(array $config) |
| 29 | 29 | { |
| 30 | 30 | $this->handler = new Redis(); |
| 31 | - $redisConfig= $this::$defaults; |
|
| 31 | + $redisConfig = $this::$defaults; |
|
| 32 | 32 | foreach ($config as $key=>$value) { |
| 33 | 33 | $redisConfig[$key] = $value; |
| 34 | 34 | } |
| 35 | 35 | if (file_exists('igbinary_serialize')) { |
| 36 | 36 | $this->serializer = "IGBINARY"; |
| 37 | 37 | } |
| 38 | - if ( isset($redisConfig['persistent']) && ($redisConfig['persistent'] === true)) { |
|
| 38 | + if (isset($redisConfig['persistent']) && ($redisConfig['persistent'] === true)) { |
|
| 39 | 39 | return $this->persistentConnect($redisConfig); |
| 40 | 40 | } |
| 41 | 41 | return $this->connect($redisConfig); |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - private function connect( array $redisConfig) |
|
| 44 | + private function connect(array $redisConfig) |
|
| 45 | 45 | { |
| 46 | 46 | $this->handler->connect( |
| 47 | 47 | $redisConfig['host'], |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | return $this->handler->select($redisConfig['dbIndex']); |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - private function persistentConnect( array $redisConfig) |
|
| 56 | + private function persistentConnect(array $redisConfig) |
|
| 57 | 57 | { |
| 58 | 58 | $this->handler->pconnect( |
| 59 | 59 | $redisConfig['host'], |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | { |
| 91 | 91 | $ttl = intval($ttl); |
| 92 | 92 | $value = $this->serialize($value); |
| 93 | - if($ttl ==0 ){ |
|
| 93 | + if ($ttl == 0) { |
|
| 94 | 94 | return $this->handler->set($key, $value); |
| 95 | 95 | } |
| 96 | 96 | return $this->handler->set($key, $value, $ttl); |
@@ -151,9 +151,9 @@ discard block |
||
| 151 | 151 | return $this->handler->mSet($items); |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | - $return =[]; |
|
| 154 | + $return = []; |
|
| 155 | 155 | foreach ($items as $key=>$value) { |
| 156 | - $return[$key] = $this->set($key, $value, $ttl); |
|
| 156 | + $return[$key] = $this->set($key, $value, $ttl); |
|
| 157 | 157 | } |
| 158 | 158 | return $return; |
| 159 | 159 | } |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | */ |
| 167 | 167 | public function deleteMultiple($keys) |
| 168 | 168 | { |
| 169 | - $return =[]; |
|
| 169 | + $return = []; |
|
| 170 | 170 | foreach ($keys as $key) { |
| 171 | 171 | $return[$key] = (bool) $this->delete($key); |
| 172 | 172 | } |
@@ -3,7 +3,7 @@ |
||
| 3 | 3 | |
| 4 | 4 | use Composer\Autoload\ClassLoader; |
| 5 | 5 | |
| 6 | -require_once dirname(__DIR__) . '/vendor/autoload.php'; |
|
| 6 | +require_once dirname(__DIR__).'/vendor/autoload.php'; |
|
| 7 | 7 | $loader = new ClassLoader(); |
| 8 | 8 | $loader->add('tests', dirname(__DIR__)); |
| 9 | 9 | $loader->register(); |
@@ -21,10 +21,10 @@ discard block |
||
| 21 | 21 | |
| 22 | 22 | public function testSetGetDeleteItem() |
| 23 | 23 | { |
| 24 | - $ins1 = $this->client->set('test1','value1'); |
|
| 24 | + $ins1 = $this->client->set('test1', 'value1'); |
|
| 25 | 25 | $this->assertTrue($ins1); |
| 26 | 26 | $value1 = $this->client->get('test1'); |
| 27 | - $this->assertEquals('value1',$value1); |
|
| 27 | + $this->assertEquals('value1', $value1); |
|
| 28 | 28 | $delete = $this->client->delete('test1'); |
| 29 | 29 | $this->assertTrue($delete); |
| 30 | 30 | } |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | $this->assertEquals(0, $counter_d_0); |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - public function testClear(){ |
|
| 72 | + public function testClear() { |
|
| 73 | 73 | $clear = $this->client->clear(); |
| 74 | 74 | $this->assertTrue($clear); |
| 75 | 75 | } |