@@ -62,7 +62,7 @@ |
||
| 62 | 62 | |
| 63 | 63 | /** |
| 64 | 64 | * @param \Psr\Cache\CacheItemInterface $item |
| 65 | - * @return mixed |
|
| 65 | + * @return boolean |
|
| 66 | 66 | * @throws phpFastCacheInvalidArgumentException |
| 67 | 67 | */ |
| 68 | 68 | protected function driverWrite(CacheItemInterface $item) |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | */ |
| 80 | 80 | if ($item instanceof Item) { |
| 81 | 81 | try { |
| 82 | - return (bool)$this->getBucket()->upsert($item->getEncodedKey(), $this->encode($this->driverPreWrap($item)), ['expiry' => $item->getTtl()]); |
|
| 82 | + return (bool) $this->getBucket()->upsert($item->getEncodedKey(), $this->encode($this->driverPreWrap($item)), ['expiry' => $item->getTtl()]); |
|
| 83 | 83 | } catch (\CouchbaseException $e) { |
| 84 | 84 | return false; |
| 85 | 85 | } |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | */ |
| 117 | 117 | if ($item instanceof Item) { |
| 118 | 118 | try { |
| 119 | - return (bool)$this->getBucket()->remove($item->getEncodedKey()); |
|
| 119 | + return (bool) $this->getBucket()->remove($item->getEncodedKey()); |
|
| 120 | 120 | } catch (\Couchbase\Exception $e) { |
| 121 | 121 | return $e->getCode() === COUCHBASE_KEY_ENOENT; |
| 122 | 122 | } |
@@ -144,11 +144,11 @@ discard block |
||
| 144 | 144 | } else { |
| 145 | 145 | |
| 146 | 146 | |
| 147 | - $host = isset($this->config[ 'host' ]) ? $this->config[ 'host' ] : '127.0.0.1'; |
|
| 148 | - $port = isset($this->config[ 'port' ]) ? $this->config[ 'port' ] : 8091; |
|
| 149 | - $password = isset($this->config[ 'password' ]) ? $this->config[ 'password' ] : ''; |
|
| 150 | - $username = isset($this->config[ 'username' ]) ? $this->config[ 'username' ] : ''; |
|
| 151 | - $buckets = isset($this->config[ 'buckets' ]) ? $this->config[ 'buckets' ] : [ |
|
| 147 | + $host = isset($this->config['host']) ? $this->config['host'] : '127.0.0.1'; |
|
| 148 | + $port = isset($this->config['port']) ? $this->config['port'] : 8091; |
|
| 149 | + $password = isset($this->config['password']) ? $this->config['password'] : ''; |
|
| 150 | + $username = isset($this->config['username']) ? $this->config['username'] : ''; |
|
| 151 | + $buckets = isset($this->config['buckets']) ? $this->config['buckets'] : [ |
|
| 152 | 152 | [ |
| 153 | 153 | 'bucket' => 'default', |
| 154 | 154 | 'password' => '', |
@@ -158,8 +158,8 @@ discard block |
||
| 158 | 158 | $this->instance = new CouchbaseClient("couchbase://{$host}:{$port}", $username, $password); |
| 159 | 159 | |
| 160 | 160 | foreach ($buckets as $bucket) { |
| 161 | - $this->bucketCurrent = $this->bucketCurrent ?: $bucket[ 'bucket' ]; |
|
| 162 | - $this->setBucket($bucket[ 'bucket' ], $this->instance->openBucket($bucket[ 'bucket' ], $bucket[ 'password' ])); |
|
| 161 | + $this->bucketCurrent = $this->bucketCurrent ?: $bucket['bucket']; |
|
| 162 | + $this->setBucket($bucket['bucket'], $this->instance->openBucket($bucket['bucket'], $bucket['password'])); |
|
| 163 | 163 | } |
| 164 | 164 | } |
| 165 | 165 | |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | */ |
| 172 | 172 | protected function getBucket() |
| 173 | 173 | { |
| 174 | - return $this->bucketInstances[ $this->bucketCurrent ]; |
|
| 174 | + return $this->bucketInstances[$this->bucketCurrent]; |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | /** |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | protected function setBucket($bucketName, \CouchbaseBucket $CouchbaseBucket) |
| 183 | 183 | { |
| 184 | 184 | if (!array_key_exists($bucketName, $this->bucketInstances)) { |
| 185 | - $this->bucketInstances[ $bucketName ] = $CouchbaseBucket; |
|
| 185 | + $this->bucketInstances[$bucketName] = $CouchbaseBucket; |
|
| 186 | 186 | } else { |
| 187 | 187 | throw new phpFastCacheLogicException('A bucket instance with this name already exists.'); |
| 188 | 188 | } |
@@ -202,10 +202,10 @@ discard block |
||
| 202 | 202 | $info = $this->getBucket()->manager()->info(); |
| 203 | 203 | |
| 204 | 204 | return (new DriverStatistic()) |
| 205 | - ->setSize($info[ 'basicStats' ][ 'diskUsed' ]) |
|
| 205 | + ->setSize($info['basicStats']['diskUsed']) |
|
| 206 | 206 | ->setRawData($info) |
| 207 | 207 | ->setData(implode(', ', array_keys($this->itemInstances))) |
| 208 | - ->setInfo('CouchBase version ' . $info[ 'nodes' ][ 0 ][ 'version' ] . ', Uptime (in days): ' . round($info[ 'nodes' ][ 0 ][ 'uptime' ] / 86400, |
|
| 208 | + ->setInfo('CouchBase version ' . $info['nodes'][0]['version'] . ', Uptime (in days): ' . round($info['nodes'][0]['uptime'] / 86400, |
|
| 209 | 209 | 1) . "\n For more information see RawData."); |
| 210 | 210 | } |
| 211 | 211 | } |
| 212 | 212 | \ No newline at end of file |