@@ -17,11 +17,11 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | use CouchbaseCluster as CouchbaseClient; |
| 19 | 19 | use Phpfastcache\Core\Pool\{ |
| 20 | - DriverBaseTrait, ExtendedCacheItemPoolInterface |
|
| 20 | + DriverBaseTrait, ExtendedCacheItemPoolInterface |
|
| 21 | 21 | }; |
| 22 | 22 | use Phpfastcache\Entities\DriverStatistic; |
| 23 | 23 | use Phpfastcache\Exceptions\{ |
| 24 | - PhpfastcacheInvalidArgumentException, PhpfastcacheLogicException |
|
| 24 | + PhpfastcacheInvalidArgumentException, PhpfastcacheLogicException |
|
| 25 | 25 | }; |
| 26 | 26 | use Psr\Cache\CacheItemInterface; |
| 27 | 27 | |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | |
| 73 | 73 | |
| 74 | 74 | $this->instance = new CouchbaseClient( |
| 75 | - 'couchbase://' . $clientConfig->getHost() . ($clientConfig->getPort() ? ":{$clientConfig->getPort()}" : '') |
|
| 75 | + 'couchbase://' . $clientConfig->getHost() . ($clientConfig->getPort() ? ":{$clientConfig->getPort()}" : '') |
|
| 76 | 76 | ); |
| 77 | 77 | |
| 78 | 78 | $this->instance->authenticate($authenticator); |
@@ -114,9 +114,9 @@ discard block |
||
| 114 | 114 | if ($item instanceof Item) { |
| 115 | 115 | try { |
| 116 | 116 | return (bool)$this->getBucket()->upsert( |
| 117 | - $item->getEncodedKey(), |
|
| 118 | - $this->encode($this->driverPreWrap($item)), |
|
| 119 | - ['expiry' => $item->getTtl()] |
|
| 117 | + $item->getEncodedKey(), |
|
| 118 | + $this->encode($this->driverPreWrap($item)), |
|
| 119 | + ['expiry' => $item->getTtl()] |
|
| 120 | 120 | ); |
| 121 | 121 | } catch (\CouchbaseException $e) { |
| 122 | 122 | return false; |
@@ -192,10 +192,10 @@ discard block |
||
| 192 | 192 | $info = $this->getBucket()->manager()->info(); |
| 193 | 193 | |
| 194 | 194 | return (new DriverStatistic()) |
| 195 | - ->setSize($info[ 'basicStats' ][ 'diskUsed' ]) |
|
| 196 | - ->setRawData($info) |
|
| 197 | - ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
| 198 | - ->setInfo('CouchBase version ' . $info[ 'nodes' ][ 0 ][ 'version' ] . ', Uptime (in days): ' . round($info[ 'nodes' ][ 0 ][ 'uptime' ] / 86400, |
|
| 199 | - 1) . "\n For more information see RawData."); |
|
| 195 | + ->setSize($info[ 'basicStats' ][ 'diskUsed' ]) |
|
| 196 | + ->setRawData($info) |
|
| 197 | + ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
| 198 | + ->setInfo('CouchBase version ' . $info[ 'nodes' ][ 0 ][ 'version' ] . ', Uptime (in days): ' . round($info[ 'nodes' ][ 0 ][ 'uptime' ] / 86400, |
|
| 199 | + 1) . "\n For more information see RawData."); |
|
| 200 | 200 | } |
| 201 | 201 | } |
| 202 | 202 | \ No newline at end of file |
@@ -78,8 +78,8 @@ discard block |
||
| 78 | 78 | $this->instance->authenticate($authenticator); |
| 79 | 79 | |
| 80 | 80 | foreach ($clientConfig->getBuckets() as $bucket) { |
| 81 | - $this->currentBucket = $this->currentBucket ?: $bucket[ 'bucket' ]; |
|
| 82 | - $this->setBucket($bucket[ 'bucket' ], $this->instance->openBucket($bucket[ 'bucket' ])); |
|
| 81 | + $this->currentBucket = $this->currentBucket ?: $bucket['bucket']; |
|
| 82 | + $this->setBucket($bucket['bucket'], $this->instance->openBucket($bucket['bucket'])); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | return true; |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | */ |
| 114 | 114 | if ($item instanceof Item) { |
| 115 | 115 | try { |
| 116 | - return (bool)$this->getBucket()->upsert( |
|
| 116 | + return (bool) $this->getBucket()->upsert( |
|
| 117 | 117 | $item->getEncodedKey(), |
| 118 | 118 | $this->encode($this->driverPreWrap($item)), |
| 119 | 119 | ['expiry' => $item->getTtl()] |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | */ |
| 139 | 139 | if ($item instanceof Item) { |
| 140 | 140 | try { |
| 141 | - return (bool)$this->getBucket()->remove($item->getEncodedKey()); |
|
| 141 | + return (bool) $this->getBucket()->remove($item->getEncodedKey()); |
|
| 142 | 142 | } catch (\Couchbase\Exception $e) { |
| 143 | 143 | return $e->getCode() === COUCHBASE_KEY_ENOENT; |
| 144 | 144 | } |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | */ |
| 162 | 162 | protected function getBucket(): \CouchbaseBucket |
| 163 | 163 | { |
| 164 | - return $this->bucketInstances[ $this->currentBucket ]; |
|
| 164 | + return $this->bucketInstances[$this->currentBucket]; |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | /** |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | protected function setBucket($bucketName, \CouchbaseBucket $CouchbaseBucket) |
| 173 | 173 | { |
| 174 | 174 | if (!\array_key_exists($bucketName, $this->bucketInstances)) { |
| 175 | - $this->bucketInstances[ $bucketName ] = $CouchbaseBucket; |
|
| 175 | + $this->bucketInstances[$bucketName] = $CouchbaseBucket; |
|
| 176 | 176 | } else { |
| 177 | 177 | throw new PhpfastcacheLogicException('A bucket instance with this name already exists.'); |
| 178 | 178 | } |
@@ -192,10 +192,10 @@ discard block |
||
| 192 | 192 | $info = $this->getBucket()->manager()->info(); |
| 193 | 193 | |
| 194 | 194 | return (new DriverStatistic()) |
| 195 | - ->setSize($info[ 'basicStats' ][ 'diskUsed' ]) |
|
| 195 | + ->setSize($info['basicStats']['diskUsed']) |
|
| 196 | 196 | ->setRawData($info) |
| 197 | 197 | ->setData(\implode(', ', \array_keys($this->itemInstances))) |
| 198 | - ->setInfo('CouchBase version ' . $info[ 'nodes' ][ 0 ][ 'version' ] . ', Uptime (in days): ' . round($info[ 'nodes' ][ 0 ][ 'uptime' ] / 86400, |
|
| 198 | + ->setInfo('CouchBase version ' . $info['nodes'][0]['version'] . ', Uptime (in days): ' . round($info['nodes'][0]['uptime'] / 86400, |
|
| 199 | 199 | 1) . "\n For more information see RawData."); |
| 200 | 200 | } |
| 201 | 201 | } |
| 202 | 202 | \ No newline at end of file |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | */ |
| 68 | 68 | public function printHeaders() |
| 69 | 69 | { |
| 70 | - if(!$this->isCli() && !\headers_sent()){ |
|
| 70 | + if (!$this->isCli() && !\headers_sent()) { |
|
| 71 | 71 | \header('Content-Type: text/plain, true'); |
| 72 | 72 | } |
| 73 | 73 | |
@@ -343,7 +343,7 @@ discard block |
||
| 343 | 343 | return true; |
| 344 | 344 | } |
| 345 | 345 | |
| 346 | - if (empty($_SERVER[ 'REMOTE_ADDR' ]) && !isset($_SERVER[ 'HTTP_USER_AGENT' ]) && \count($_SERVER[ 'argv' ]) > 0) { |
|
| 346 | + if (empty($_SERVER['REMOTE_ADDR']) && !isset($_SERVER['HTTP_USER_AGENT']) && \count($_SERVER['argv']) > 0) { |
|
| 347 | 347 | return true; |
| 348 | 348 | } |
| 349 | 349 | |