@@ -19,7 +19,7 @@ |
||
19 | 19 | use Phpfastcache\Core\Pool\ExtendedCacheItemPoolInterface; |
20 | 20 | use Phpfastcache\Drivers\Files\Driver as FilesDriver; |
21 | 21 | use Phpfastcache\Exceptions\{ |
22 | - phpFastCacheInvalidArgumentException |
|
22 | + phpFastCacheInvalidArgumentException |
|
23 | 23 | }; |
24 | 24 | |
25 | 25 | /** |
@@ -11,7 +11,7 @@ |
||
11 | 11 | * @author Georges.L (Geolim4) <[email protected]> |
12 | 12 | * |
13 | 13 | */ |
14 | -declare(strict_types=1); |
|
14 | +declare(strict_types = 1); |
|
15 | 15 | |
16 | 16 | namespace Phpfastcache\Drivers\Files; |
17 | 17 |
@@ -17,7 +17,7 @@ |
||
17 | 17 | |
18 | 18 | use Phpfastcache\Core\Pool\{DriverBaseTrait, ExtendedCacheItemPoolInterface, IO\IOHelperTrait}; |
19 | 19 | use Phpfastcache\Exceptions\{ |
20 | - phpFastCacheInvalidArgumentException |
|
20 | + phpFastCacheInvalidArgumentException |
|
21 | 21 | }; |
22 | 22 | use Phpfastcache\Util\Directory; |
23 | 23 | use Psr\Cache\CacheItemInterface; |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * @author Georges.L (Geolim4) <[email protected]> |
12 | 12 | * |
13 | 13 | */ |
14 | -declare(strict_types=1); |
|
14 | +declare(strict_types = 1); |
|
15 | 15 | |
16 | 16 | namespace Phpfastcache\Drivers\Files; |
17 | 17 | |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | */ |
144 | 144 | protected function driverClear(): bool |
145 | 145 | { |
146 | - return (bool)Directory::rrmdir($this->getPath(true)); |
|
146 | + return (bool) Directory::rrmdir($this->getPath(true)); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | /** |
@@ -19,7 +19,7 @@ |
||
19 | 19 | use Phpfastcache\Core\Pool\ExtendedCacheItemPoolInterface; |
20 | 20 | use Phpfastcache\Drivers\Couchbase\Driver as CouchbaseDriver; |
21 | 21 | use Phpfastcache\Exceptions\{ |
22 | - phpFastCacheInvalidArgumentException, phpFastCacheInvalidArgumentTypeException |
|
22 | + phpFastCacheInvalidArgumentException, phpFastCacheInvalidArgumentTypeException |
|
23 | 23 | }; |
24 | 24 | |
25 | 25 | /** |
@@ -11,7 +11,7 @@ |
||
11 | 11 | * @author Georges.L (Geolim4) <[email protected]> |
12 | 12 | * |
13 | 13 | */ |
14 | -declare(strict_types=1); |
|
14 | +declare(strict_types = 1); |
|
15 | 15 | |
16 | 16 | namespace Phpfastcache\Drivers\Couchbase; |
17 | 17 |
@@ -32,10 +32,10 @@ |
||
32 | 32 | * @var array |
33 | 33 | */ |
34 | 34 | protected $buckets = [ |
35 | - [ |
|
35 | + [ |
|
36 | 36 | 'bucket' => 'default', |
37 | 37 | 'password' => '', |
38 | - ], |
|
38 | + ], |
|
39 | 39 | ]; |
40 | 40 | |
41 | 41 | /** |
@@ -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 Phpfastcache\Util\ArrayObject; |
27 | 27 | use Psr\Cache\CacheItemInterface; |
@@ -187,10 +187,10 @@ discard block |
||
187 | 187 | $info = $this->getBucket()->manager()->info(); |
188 | 188 | |
189 | 189 | return (new DriverStatistic()) |
190 | - ->setSize($info[ 'basicStats' ][ 'diskUsed' ]) |
|
191 | - ->setRawData($info) |
|
192 | - ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
193 | - ->setInfo('CouchBase version ' . $info[ 'nodes' ][ 0 ][ 'version' ] . ', Uptime (in days): ' . round($info[ 'nodes' ][ 0 ][ 'uptime' ] / 86400, |
|
194 | - 1) . "\n For more information see RawData."); |
|
190 | + ->setSize($info[ 'basicStats' ][ 'diskUsed' ]) |
|
191 | + ->setRawData($info) |
|
192 | + ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
193 | + ->setInfo('CouchBase version ' . $info[ 'nodes' ][ 0 ][ 'version' ] . ', Uptime (in days): ' . round($info[ 'nodes' ][ 0 ][ 'uptime' ] / 86400, |
|
194 | + 1) . "\n For more information see RawData."); |
|
195 | 195 | } |
196 | 196 | } |
197 | 197 | \ No newline at end of file |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * @author Georges.L (Geolim4) <[email protected]> |
12 | 12 | * |
13 | 13 | */ |
14 | -declare(strict_types=1); |
|
14 | +declare(strict_types = 1); |
|
15 | 15 | |
16 | 16 | namespace Phpfastcache\Drivers\Couchbase; |
17 | 17 | |
@@ -69,16 +69,16 @@ discard block |
||
69 | 69 | |
70 | 70 | $this->instance = new CouchbaseClient("couchbase://{$clientConfig['host']}:{$clientConfig['port']}"); |
71 | 71 | |
72 | - if ($clientConfig[ 'username' ]) { |
|
72 | + if ($clientConfig['username']) { |
|
73 | 73 | $authenticator = new \Couchbase\ClassicAuthenticator(); |
74 | - $authenticator->cluster($clientConfig[ 'username' ], $clientConfig[ 'password' ]); |
|
74 | + $authenticator->cluster($clientConfig['username'], $clientConfig['password']); |
|
75 | 75 | //$authenticator->bucket('protected', 'secret'); |
76 | 76 | $this->instance->authenticate($authenticator); |
77 | 77 | } |
78 | 78 | |
79 | - foreach ($clientConfig[ 'buckets' ] as $bucket) { |
|
80 | - $this->bucketCurrent = $this->bucketCurrent ?: $bucket[ 'bucket' ]; |
|
81 | - $this->setBucket($bucket[ 'bucket' ], $this->instance->openBucket($bucket[ 'bucket' ], $bucket[ 'password' ])); |
|
79 | + foreach ($clientConfig['buckets'] as $bucket) { |
|
80 | + $this->bucketCurrent = $this->bucketCurrent ?: $bucket['bucket']; |
|
81 | + $this->setBucket($bucket['bucket'], $this->instance->openBucket($bucket['bucket'], $bucket['password'])); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | return true; |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | */ |
113 | 113 | if ($item instanceof Item) { |
114 | 114 | try { |
115 | - return (bool)$this->getBucket()->upsert($item->getEncodedKey(), $this->encode($this->driverPreWrap($item)), ['expiry' => $item->getTtl()]); |
|
115 | + return (bool) $this->getBucket()->upsert($item->getEncodedKey(), $this->encode($this->driverPreWrap($item)), ['expiry' => $item->getTtl()]); |
|
116 | 116 | } catch (\CouchbaseException $e) { |
117 | 117 | return false; |
118 | 118 | } |
@@ -132,9 +132,9 @@ discard block |
||
132 | 132 | * Check for Cross-Driver type confusion |
133 | 133 | */ |
134 | 134 | if ($item instanceof Item) { |
135 | - try{ |
|
136 | - return (bool)$this->getBucket()->remove($item->getEncodedKey()); |
|
137 | - }catch (\Couchbase\Exception $e){ |
|
135 | + try { |
|
136 | + return (bool) $this->getBucket()->remove($item->getEncodedKey()); |
|
137 | + } catch (\Couchbase\Exception $e) { |
|
138 | 138 | return $e->getCode() === COUCHBASE_KEY_ENOENT; |
139 | 139 | } |
140 | 140 | } |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | */ |
157 | 157 | protected function getBucket(): \CouchbaseBucket |
158 | 158 | { |
159 | - return $this->bucketInstances[ $this->bucketCurrent ]; |
|
159 | + return $this->bucketInstances[$this->bucketCurrent]; |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | /** |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | protected function setBucket($bucketName, \CouchbaseBucket $CouchbaseBucket) |
168 | 168 | { |
169 | 169 | if (!\array_key_exists($bucketName, $this->bucketInstances)) { |
170 | - $this->bucketInstances[ $bucketName ] = $CouchbaseBucket; |
|
170 | + $this->bucketInstances[$bucketName] = $CouchbaseBucket; |
|
171 | 171 | } else { |
172 | 172 | throw new phpFastCacheLogicException('A bucket instance with this name already exists.'); |
173 | 173 | } |
@@ -187,10 +187,10 @@ discard block |
||
187 | 187 | $info = $this->getBucket()->manager()->info(); |
188 | 188 | |
189 | 189 | return (new DriverStatistic()) |
190 | - ->setSize($info[ 'basicStats' ][ 'diskUsed' ]) |
|
190 | + ->setSize($info['basicStats']['diskUsed']) |
|
191 | 191 | ->setRawData($info) |
192 | 192 | ->setData(\implode(', ', \array_keys($this->itemInstances))) |
193 | - ->setInfo('CouchBase version ' . $info[ 'nodes' ][ 0 ][ 'version' ] . ', Uptime (in days): ' . round($info[ 'nodes' ][ 0 ][ 'uptime' ] / 86400, |
|
193 | + ->setInfo('CouchBase version ' . $info['nodes'][0]['version'] . ', Uptime (in days): ' . round($info['nodes'][0]['uptime'] / 86400, |
|
194 | 194 | 1) . "\n For more information see RawData."); |
195 | 195 | } |
196 | 196 | } |
197 | 197 | \ No newline at end of file |
@@ -134,7 +134,7 @@ |
||
134 | 134 | if ($item instanceof Item) { |
135 | 135 | try{ |
136 | 136 | return (bool)$this->getBucket()->remove($item->getEncodedKey()); |
137 | - }catch (\Couchbase\Exception $e){ |
|
137 | + } catch (\Couchbase\Exception $e){ |
|
138 | 138 | return $e->getCode() === COUCHBASE_KEY_ENOENT; |
139 | 139 | } |
140 | 140 | } |
@@ -19,7 +19,7 @@ |
||
19 | 19 | use Phpfastcache\Core\Pool\ExtendedCacheItemPoolInterface; |
20 | 20 | use Phpfastcache\Drivers\Apcu\Driver as ApcuDriver; |
21 | 21 | use Phpfastcache\Exceptions\{ |
22 | - phpFastCacheInvalidArgumentException, phpFastCacheInvalidArgumentTypeException |
|
22 | + phpFastCacheInvalidArgumentException, phpFastCacheInvalidArgumentTypeException |
|
23 | 23 | }; |
24 | 24 | |
25 | 25 | /** |
@@ -11,7 +11,7 @@ |
||
11 | 11 | * @author Georges.L (Geolim4) <[email protected]> |
12 | 12 | * |
13 | 13 | */ |
14 | -declare(strict_types=1); |
|
14 | +declare(strict_types = 1); |
|
15 | 15 | |
16 | 16 | namespace Phpfastcache\Drivers\Apcu; |
17 | 17 |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | use Phpfastcache\Core\Pool\{DriverBaseTrait, ExtendedCacheItemPoolInterface}; |
19 | 19 | use Phpfastcache\Entities\DriverStatistic; |
20 | 20 | use Phpfastcache\Exceptions\{ |
21 | - phpFastCacheInvalidArgumentException |
|
21 | + phpFastCacheInvalidArgumentException |
|
22 | 22 | }; |
23 | 23 | use Psr\Cache\CacheItemInterface; |
24 | 24 | |
@@ -121,10 +121,10 @@ discard block |
||
121 | 121 | $date = (new \DateTime())->setTimestamp($stats[ 'start_time' ]); |
122 | 122 | |
123 | 123 | return (new DriverStatistic()) |
124 | - ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
125 | - ->setInfo(\sprintf("The APCU cache is up since %s, and have %d item(s) in cache.\n For more information see RawData.", $date->format(DATE_RFC2822), |
|
124 | + ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
125 | + ->setInfo(\sprintf("The APCU cache is up since %s, and have %d item(s) in cache.\n For more information see RawData.", $date->format(DATE_RFC2822), |
|
126 | 126 | $stats[ 'num_entries' ])) |
127 | - ->setRawData($stats) |
|
128 | - ->setSize($stats[ 'mem_size' ]); |
|
127 | + ->setRawData($stats) |
|
128 | + ->setSize($stats[ 'mem_size' ]); |
|
129 | 129 | } |
130 | 130 | } |
131 | 131 | \ No newline at end of file |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * @author Georges.L (Geolim4) <[email protected]> |
12 | 12 | * |
13 | 13 | */ |
14 | -declare(strict_types=1); |
|
14 | +declare(strict_types = 1); |
|
15 | 15 | |
16 | 16 | namespace Phpfastcache\Drivers\Apcu; |
17 | 17 | |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | if ($item instanceof Item) { |
62 | 62 | $ttl = $item->getExpirationDate()->getTimestamp() - time(); |
63 | 63 | |
64 | - return (bool)apcu_store($item->getKey(), $this->driverPreWrap($item), ($ttl > 0 ? $ttl : 0)); |
|
64 | + return (bool) apcu_store($item->getKey(), $this->driverPreWrap($item), ($ttl > 0 ? $ttl : 0)); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | throw new phpFastCacheInvalidArgumentException('Cross-Driver type confusion detected'); |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | * Check for Cross-Driver type confusion |
93 | 93 | */ |
94 | 94 | if ($item instanceof Item) { |
95 | - return (bool)apcu_delete($item->getKey()); |
|
95 | + return (bool) apcu_delete($item->getKey()); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | throw new phpFastCacheInvalidArgumentException('Cross-Driver type confusion detected'); |
@@ -117,14 +117,14 @@ discard block |
||
117 | 117 | */ |
118 | 118 | public function getStats(): DriverStatistic |
119 | 119 | { |
120 | - $stats = (array)apcu_cache_info(); |
|
121 | - $date = (new \DateTime())->setTimestamp($stats[ 'start_time' ]); |
|
120 | + $stats = (array) apcu_cache_info(); |
|
121 | + $date = (new \DateTime())->setTimestamp($stats['start_time']); |
|
122 | 122 | |
123 | 123 | return (new DriverStatistic()) |
124 | 124 | ->setData(\implode(', ', \array_keys($this->itemInstances))) |
125 | 125 | ->setInfo(\sprintf("The APCU cache is up since %s, and have %d item(s) in cache.\n For more information see RawData.", $date->format(DATE_RFC2822), |
126 | - $stats[ 'num_entries' ])) |
|
126 | + $stats['num_entries'])) |
|
127 | 127 | ->setRawData($stats) |
128 | - ->setSize($stats[ 'mem_size' ]); |
|
128 | + ->setSize($stats['mem_size']); |
|
129 | 129 | } |
130 | 130 | } |
131 | 131 | \ No newline at end of file |
@@ -20,7 +20,7 @@ |
||
20 | 20 | use Phpfastcache\Core\Pool\ExtendedCacheItemPoolInterface; |
21 | 21 | use Phpfastcache\Drivers\Devfalse\Driver as DevfalseDriver; |
22 | 22 | use Phpfastcache\Exceptions\{ |
23 | - phpFastCacheInvalidArgumentException, phpFastCacheInvalidArgumentTypeException |
|
23 | + phpFastCacheInvalidArgumentException, phpFastCacheInvalidArgumentTypeException |
|
24 | 24 | }; |
25 | 25 | |
26 | 26 | /** |
@@ -11,7 +11,7 @@ |
||
11 | 11 | * @author Georges.L (Geolim4) <[email protected]> |
12 | 12 | * |
13 | 13 | */ |
14 | -declare(strict_types=1); |
|
14 | +declare(strict_types = 1); |
|
15 | 15 | |
16 | 16 | namespace Phpfastcache\Drivers\Devfalse; |
17 | 17 |
@@ -16,11 +16,11 @@ discard block |
||
16 | 16 | namespace Phpfastcache\Drivers\Devfalse; |
17 | 17 | |
18 | 18 | use Phpfastcache\Core\Pool\{ |
19 | - DriverBaseTrait, ExtendedCacheItemPoolInterface |
|
19 | + DriverBaseTrait, ExtendedCacheItemPoolInterface |
|
20 | 20 | }; |
21 | 21 | use Phpfastcache\Entities\DriverStatistic; |
22 | 22 | use Phpfastcache\Exceptions\{ |
23 | - phpFastCacheInvalidArgumentException |
|
23 | + phpFastCacheInvalidArgumentException |
|
24 | 24 | }; |
25 | 25 | use Psr\Cache\CacheItemInterface; |
26 | 26 | |
@@ -66,9 +66,9 @@ discard block |
||
66 | 66 | protected function driverRead(CacheItemInterface $item): array |
67 | 67 | { |
68 | 68 | return [ |
69 | - self::DRIVER_DATA_WRAPPER_INDEX => false, |
|
70 | - self::DRIVER_TAGS_WRAPPER_INDEX => [], |
|
71 | - self::DRIVER_EDATE_WRAPPER_INDEX => new \DateTime(), |
|
69 | + self::DRIVER_DATA_WRAPPER_INDEX => false, |
|
70 | + self::DRIVER_TAGS_WRAPPER_INDEX => [], |
|
71 | + self::DRIVER_EDATE_WRAPPER_INDEX => new \DateTime(), |
|
72 | 72 | ]; |
73 | 73 | } |
74 | 74 | |
@@ -118,9 +118,9 @@ discard block |
||
118 | 118 | { |
119 | 119 | $stat = new DriverStatistic(); |
120 | 120 | $stat->setInfo('[Devfalse] A void info string') |
121 | - ->setSize(0) |
|
122 | - ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
123 | - ->setRawData(false); |
|
121 | + ->setSize(0) |
|
122 | + ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
123 | + ->setRawData(false); |
|
124 | 124 | |
125 | 125 | return $stat; |
126 | 126 | } |
@@ -11,7 +11,7 @@ |
||
11 | 11 | * @author Georges.L (Geolim4) <[email protected]> |
12 | 12 | * |
13 | 13 | */ |
14 | -declare(strict_types=1); |
|
14 | +declare(strict_types = 1); |
|
15 | 15 | |
16 | 16 | namespace Phpfastcache\Drivers\Devfalse; |
17 | 17 |