@@ -148,9 +148,9 @@ discard block |
||
| 148 | 148 | $password = isset($this->config[ 'password' ]) ? $this->config[ 'password' ] : NULL; |
| 149 | 149 | $username = isset($this->config[ 'username' ]) ? $this->config[ 'username' ] : NULL; |
| 150 | 150 | $buckets = isset($this->config[ 'buckets' ]) ? $this->config[ 'buckets' ] : [ |
| 151 | - [ |
|
| 151 | + [ |
|
| 152 | 152 | 'bucket' => 'default', |
| 153 | - ], |
|
| 153 | + ], |
|
| 154 | 154 | ]; |
| 155 | 155 | |
| 156 | 156 | // Establish username and password for bucket access |
@@ -213,10 +213,10 @@ discard block |
||
| 213 | 213 | $info = $this->getBucket()->manager()->info(); |
| 214 | 214 | |
| 215 | 215 | return (new DriverStatistic()) |
| 216 | - ->setSize($info[ 'basicStats' ][ 'diskUsed' ]) |
|
| 217 | - ->setRawData($info) |
|
| 218 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 219 | - ->setInfo('CouchBase version ' . $info[ 'nodes' ][ 0 ][ 'version' ] . ', Uptime (in days): ' . round($info[ 'nodes' ][ 0 ][ 'uptime' ] / 86400, |
|
| 220 | - 1) . "\n For more information see RawData."); |
|
| 216 | + ->setSize($info[ 'basicStats' ][ 'diskUsed' ]) |
|
| 217 | + ->setRawData($info) |
|
| 218 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 219 | + ->setInfo('CouchBase version ' . $info[ 'nodes' ][ 0 ][ 'version' ] . ', Uptime (in days): ' . round($info[ 'nodes' ][ 0 ][ 'uptime' ] / 86400, |
|
| 220 | + 1) . "\n For more information see RawData."); |
|
| 221 | 221 | } |
| 222 | 222 | } |
| 223 | 223 | \ No newline at end of file |
@@ -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 | } |
@@ -143,11 +143,11 @@ discard block |
||
| 143 | 143 | throw new phpFastCacheLogicException('Already connected to Couchbase server'); |
| 144 | 144 | } else { |
| 145 | 145 | |
| 146 | - $host = isset($this->config[ 'host' ]) ? $this->config[ 'host' ] : '127.0.0.1'; |
|
| 147 | - $port = isset($this->config[ 'port' ]) ? $this->config[ 'port' ] : NULL; |
|
| 148 | - $password = isset($this->config[ 'password' ]) ? $this->config[ 'password' ] : NULL; |
|
| 149 | - $username = isset($this->config[ 'username' ]) ? $this->config[ 'username' ] : NULL; |
|
| 150 | - $buckets = isset($this->config[ 'buckets' ]) ? $this->config[ 'buckets' ] : [ |
|
| 146 | + $host = isset($this->config['host']) ? $this->config['host'] : '127.0.0.1'; |
|
| 147 | + $port = isset($this->config['port']) ? $this->config['port'] : NULL; |
|
| 148 | + $password = isset($this->config['password']) ? $this->config['password'] : NULL; |
|
| 149 | + $username = isset($this->config['username']) ? $this->config['username'] : NULL; |
|
| 150 | + $buckets = isset($this->config['buckets']) ? $this->config['buckets'] : [ |
|
| 151 | 151 | [ |
| 152 | 152 | 'bucket' => 'default', |
| 153 | 153 | ], |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | |
| 156 | 156 | // Establish username and password for bucket access |
| 157 | 157 | $authenticator = new \Couchbase\PasswordAuthenticator(); |
| 158 | - $authenticator->username($this->config[ 'username' ])->password($this->config[ 'password' ]); |
|
| 158 | + $authenticator->username($this->config['username'])->password($this->config['password']); |
|
| 159 | 159 | |
| 160 | 160 | // Connect to Couchbase Server |
| 161 | 161 | if (isset($port)) { |
@@ -169,8 +169,8 @@ discard block |
||
| 169 | 169 | $this->instance = $this->instance ?: $cluster; |
| 170 | 170 | |
| 171 | 171 | foreach ($buckets as $bucket) { |
| 172 | - $this->bucketCurrent = $this->bucketCurrent ?: $bucket[ 'bucket' ]; |
|
| 173 | - $this->setBucket($bucket[ 'bucket' ], $this->instance->openBucket($bucket[ 'bucket' ])); |
|
| 172 | + $this->bucketCurrent = $this->bucketCurrent ?: $bucket['bucket']; |
|
| 173 | + $this->setBucket($bucket['bucket'], $this->instance->openBucket($bucket['bucket'])); |
|
| 174 | 174 | } |
| 175 | 175 | } |
| 176 | 176 | |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | */ |
| 183 | 183 | protected function getBucket() |
| 184 | 184 | { |
| 185 | - return $this->bucketInstances[ $this->bucketCurrent ]; |
|
| 185 | + return $this->bucketInstances[$this->bucketCurrent]; |
|
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | /** |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | protected function setBucket($bucketName, \CouchbaseBucket $CouchbaseBucket) |
| 194 | 194 | { |
| 195 | 195 | if (!array_key_exists($bucketName, $this->bucketInstances)) { |
| 196 | - $this->bucketInstances[ $bucketName ] = $CouchbaseBucket; |
|
| 196 | + $this->bucketInstances[$bucketName] = $CouchbaseBucket; |
|
| 197 | 197 | } else { |
| 198 | 198 | throw new phpFastCacheLogicException('A bucket instance with this name already exists.'); |
| 199 | 199 | } |
@@ -213,10 +213,10 @@ discard block |
||
| 213 | 213 | $info = $this->getBucket()->manager()->info(); |
| 214 | 214 | |
| 215 | 215 | return (new DriverStatistic()) |
| 216 | - ->setSize($info[ 'basicStats' ][ 'diskUsed' ]) |
|
| 216 | + ->setSize($info['basicStats']['diskUsed']) |
|
| 217 | 217 | ->setRawData($info) |
| 218 | 218 | ->setData(implode(', ', array_keys($this->itemInstances))) |
| 219 | - ->setInfo('CouchBase version ' . $info[ 'nodes' ][ 0 ][ 'version' ] . ', Uptime (in days): ' . round($info[ 'nodes' ][ 0 ][ 'uptime' ] / 86400, |
|
| 219 | + ->setInfo('CouchBase version ' . $info['nodes'][0]['version'] . ', Uptime (in days): ' . round($info['nodes'][0]['uptime'] / 86400, |
|
| 220 | 220 | 1) . "\n For more information see RawData."); |
| 221 | 221 | } |
| 222 | 222 | } |
| 223 | 223 | \ No newline at end of file |