@@ -16,12 +16,12 @@ |
||
16 | 16 | * @var array |
17 | 17 | */ |
18 | 18 | protected $servers = [ |
19 | - [ |
|
19 | + [ |
|
20 | 20 | 'host' => '127.0.0.1', |
21 | 21 | 'port' => 11211, |
22 | 22 | 'saslUser' => false, |
23 | 23 | 'saslPassword' => false, |
24 | - ], |
|
24 | + ], |
|
25 | 25 | ]; |
26 | 26 | |
27 | 27 | /** |
@@ -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\Riak; |
17 | 17 |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | use Phpfastcache\Core\Pool\{DriverBaseTrait, ExtendedCacheItemPoolInterface}; |
20 | 20 | use Phpfastcache\Entities\DriverStatistic; |
21 | 21 | use Phpfastcache\Exceptions\{ |
22 | - PhpfastcacheInvalidArgumentException, PhpfastcacheLogicException |
|
22 | + PhpfastcacheInvalidArgumentException, PhpfastcacheLogicException |
|
23 | 23 | }; |
24 | 24 | use Phpfastcache\Util\ArrayObject; |
25 | 25 | use Psr\Cache\CacheItemInterface; |
@@ -89,9 +89,9 @@ discard block |
||
89 | 89 | */ |
90 | 90 | if ($item instanceof Item) { |
91 | 91 | $this->instance |
92 | - ->bucket($this->bucketName) |
|
93 | - ->newBinary($item->getKey(), $this->encode($this->driverPreWrap($item))) |
|
94 | - ->store(); |
|
92 | + ->bucket($this->bucketName) |
|
93 | + ->newBinary($item->getKey(), $this->encode($this->driverPreWrap($item))) |
|
94 | + ->store(); |
|
95 | 95 | return true; |
96 | 96 | } |
97 | 97 | |
@@ -142,9 +142,9 @@ discard block |
||
142 | 142 | $info = $this->instance->bucket($this->bucketName)->getProperties(); |
143 | 143 | |
144 | 144 | return (new DriverStatistic()) |
145 | - ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
146 | - ->setRawData($info) |
|
147 | - ->setSize(false) |
|
148 | - ->setInfo('Riak does not provide size/date information att all :('); |
|
145 | + ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
146 | + ->setRawData($info) |
|
147 | + ->setSize(false) |
|
148 | + ->setInfo('Riak does not provide size/date information att all :('); |
|
149 | 149 | } |
150 | 150 | } |
151 | 151 | \ No newline at end of file |
@@ -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\Devnull; |
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 | |
@@ -112,9 +112,9 @@ discard block |
||
112 | 112 | { |
113 | 113 | $stat = new DriverStatistic(); |
114 | 114 | $stat->setInfo('[Devnull] A void info string') |
115 | - ->setSize(0) |
|
116 | - ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
117 | - ->setRawData(null); |
|
115 | + ->setSize(0) |
|
116 | + ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
117 | + ->setRawData(null); |
|
118 | 118 | |
119 | 119 | return $stat; |
120 | 120 | } |
@@ -10,7 +10,7 @@ |
||
10 | 10 | * @author Lucas Brucksch <[email protected]> |
11 | 11 | * |
12 | 12 | */ |
13 | -declare(strict_types=1); |
|
13 | +declare(strict_types = 1); |
|
14 | 14 | |
15 | 15 | namespace Phpfastcache\Drivers\Zenddisk; |
16 | 16 |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | use Phpfastcache\Core\Pool\{DriverBaseTrait, ExtendedCacheItemPoolInterface}; |
18 | 18 | use Phpfastcache\Entities\DriverStatistic; |
19 | 19 | use Phpfastcache\Exceptions\{ |
20 | - PhpfastcacheInvalidArgumentException |
|
20 | + PhpfastcacheInvalidArgumentException |
|
21 | 21 | }; |
22 | 22 | use Psr\Cache\CacheItemInterface; |
23 | 23 | |
@@ -131,9 +131,9 @@ discard block |
||
131 | 131 | { |
132 | 132 | $stat = new DriverStatistic(); |
133 | 133 | $stat->setInfo('[ZendDisk] A void info string') |
134 | - ->setSize(0) |
|
135 | - ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
136 | - ->setRawData(false); |
|
134 | + ->setSize(0) |
|
135 | + ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
136 | + ->setRawData(false); |
|
137 | 137 | |
138 | 138 | return $stat; |
139 | 139 | } |
@@ -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\Util; |
17 | 17 |
@@ -41,7 +41,7 @@ |
||
41 | 41 | return true; |
42 | 42 | } else if (\constant($CONSTANT_NAME) !== $driverName) { |
43 | 43 | trigger_error('Memcache collision detected, you used both Memcache and Memcached driver in your script, this may leads to unexpected behaviours', |
44 | - E_USER_WARNING); |
|
44 | + E_USER_WARNING); |
|
45 | 45 | |
46 | 46 | return false; |
47 | 47 | } |
@@ -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\Core\Item; |
17 | 17 |
@@ -18,7 +18,7 @@ |
||
18 | 18 | use Phpfastcache\Core\Pool\ExtendedCacheItemPoolInterface; |
19 | 19 | use Phpfastcache\EventManager; |
20 | 20 | use Phpfastcache\Exceptions\{ |
21 | - PhpfastcacheInvalidArgumentException, PhpfastcacheLogicException |
|
21 | + PhpfastcacheInvalidArgumentException, PhpfastcacheLogicException |
|
22 | 22 | }; |
23 | 23 | use Psr\Cache\CacheItemInterface; |
24 | 24 |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | use Phpfastcache\Core\Item\ExtendedCacheItemInterface; |
20 | 20 | use Phpfastcache\Core\Pool\ExtendedCacheItemPoolInterface; |
21 | 21 | use Phpfastcache\Exceptions\{ |
22 | - PhpfastcacheDriverCheckException, PhpfastcacheInvalidArgumentException, PhpfastcacheRootException, PhpfastcacheSimpleCacheException |
|
22 | + PhpfastcacheDriverCheckException, PhpfastcacheInvalidArgumentException, PhpfastcacheRootException, PhpfastcacheSimpleCacheException |
|
23 | 23 | }; |
24 | 24 | use Psr\SimpleCache\CacheInterface; |
25 | 25 | |
@@ -76,8 +76,8 @@ discard block |
||
76 | 76 | { |
77 | 77 | try { |
78 | 78 | $cacheItem = $this->internalCacheInstance |
79 | - ->getItem($key) |
|
80 | - ->set($value); |
|
79 | + ->getItem($key) |
|
80 | + ->set($value); |
|
81 | 81 | if (\is_int($ttl) && $ttl <= 0) { |
82 | 82 | $cacheItem->expiresAt((new \DateTime('@0'))); |
83 | 83 | } elseif (\is_int($ttl) || $ttl instanceof \DateInterval) { |
@@ -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\Helper; |
17 | 17 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | public function getMultiple($keys, $default = null) |
126 | 126 | { |
127 | 127 | try { |
128 | - return array_map(function (ExtendedCacheItemInterface $item) { |
|
128 | + return array_map(function(ExtendedCacheItemInterface $item) { |
|
129 | 129 | return $item->get(); |
130 | 130 | }, $this->internalCacheInstance->getItems($keys)); |
131 | 131 | } catch (PhpfastcacheInvalidArgumentException $e) { |
@@ -16,14 +16,14 @@ discard block |
||
16 | 16 | namespace Phpfastcache\Drivers\Couchdb; |
17 | 17 | |
18 | 18 | use Doctrine\CouchDB\{ |
19 | - CouchDBClient as CouchdbClient, CouchDBException |
|
19 | + CouchDBClient as CouchdbClient, CouchDBException |
|
20 | 20 | }; |
21 | 21 | use Phpfastcache\Config\ConfigurationOption; |
22 | 22 | use Phpfastcache\Core\Pool\{ |
23 | - DriverBaseTrait, ExtendedCacheItemPoolInterface |
|
23 | + DriverBaseTrait, ExtendedCacheItemPoolInterface |
|
24 | 24 | }; |
25 | 25 | use Phpfastcache\Exceptions\{ |
26 | - PhpfastcacheDriverException, PhpfastcacheInvalidArgumentException, PhpfastcacheLogicException |
|
26 | + PhpfastcacheDriverException, PhpfastcacheInvalidArgumentException, PhpfastcacheLogicException |
|
27 | 27 | }; |
28 | 28 | use Phpfastcache\Entities\DriverStatistic; |
29 | 29 | use Phpfastcache\Util\ArrayObject; |
@@ -75,9 +75,9 @@ discard block |
||
75 | 75 | $url .= $clientConfig[ 'path' ]; |
76 | 76 | |
77 | 77 | $this->instance = CouchDBClient::create([ |
78 | - 'dbname' => $this->getDatabaseName(), |
|
79 | - 'url' => $url, |
|
80 | - 'timeout' => $clientConfig[ 'timeout' ], |
|
78 | + 'dbname' => $this->getDatabaseName(), |
|
79 | + 'url' => $url, |
|
80 | + 'timeout' => $clientConfig[ 'timeout' ], |
|
81 | 81 | ]); |
82 | 82 | |
83 | 83 | $this->createDatabase(); |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | if ($item instanceof Item) { |
123 | 123 | try { |
124 | 124 | $this->instance->putDocument(['data' => $this->encode($this->driverPreWrap($item))], $item->getEncodedKey(), |
125 | - $this->getLatestDocumentRevision($item->getEncodedKey())); |
|
125 | + $this->getLatestDocumentRevision($item->getEncodedKey())); |
|
126 | 126 | } catch (CouchDBException $e) { |
127 | 127 | throw new PhpfastcacheDriverException('Got error while trying to upsert a document: ' . $e->getMessage(), null, $e); |
128 | 128 | } |
@@ -179,10 +179,10 @@ discard block |
||
179 | 179 | $path = '/' . $this->getDatabaseName() . '/' . urlencode($docId); |
180 | 180 | |
181 | 181 | $response = $this->instance->getHttpClient()->request( |
182 | - 'HEAD', |
|
183 | - $path, |
|
184 | - null, |
|
185 | - false |
|
182 | + 'HEAD', |
|
183 | + $path, |
|
184 | + null, |
|
185 | + false |
|
186 | 186 | ); |
187 | 187 | if (!empty($response->headers[ 'etag' ])) { |
188 | 188 | return \trim($response->headers[ 'etag' ], " '\"\t\n\r\0\x0B"); |
@@ -236,9 +236,9 @@ discard block |
||
236 | 236 | $info = $this->instance->getDatabaseInfo(); |
237 | 237 | |
238 | 238 | return (new DriverStatistic()) |
239 | - ->setSize($info[ 'sizes' ][ 'active' ]) |
|
240 | - ->setRawData($info) |
|
241 | - ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
242 | - ->setInfo('Couchdb version ' . $this->instance->getVersion() . "\n For more information see RawData."); |
|
239 | + ->setSize($info[ 'sizes' ][ 'active' ]) |
|
240 | + ->setRawData($info) |
|
241 | + ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
242 | + ->setInfo('Couchdb version ' . $this->instance->getVersion() . "\n For more information see RawData."); |
|
243 | 243 | } |
244 | 244 | } |
245 | 245 | \ 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\Couchdb; |
17 | 17 | |
@@ -62,22 +62,22 @@ discard block |
||
62 | 62 | |
63 | 63 | $clientConfig = $this->getConfig(); |
64 | 64 | |
65 | - $url = ($clientConfig[ 'ssl' ] ? 'https://' : 'http://'); |
|
66 | - if ($clientConfig[ 'username' ]) { |
|
65 | + $url = ($clientConfig['ssl'] ? 'https://' : 'http://'); |
|
66 | + if ($clientConfig['username']) { |
|
67 | 67 | $url .= "{$clientConfig['username']}"; |
68 | - if ($clientConfig[ 'password' ]) { |
|
68 | + if ($clientConfig['password']) { |
|
69 | 69 | $url .= ":{$clientConfig['password']}"; |
70 | 70 | } |
71 | 71 | $url .= '@'; |
72 | 72 | } |
73 | - $url .= $clientConfig[ 'host' ]; |
|
73 | + $url .= $clientConfig['host']; |
|
74 | 74 | $url .= ":{$clientConfig['port']}"; |
75 | - $url .= $clientConfig[ 'path' ]; |
|
75 | + $url .= $clientConfig['path']; |
|
76 | 76 | |
77 | 77 | $this->instance = CouchDBClient::create([ |
78 | 78 | 'dbname' => $this->getDatabaseName(), |
79 | 79 | 'url' => $url, |
80 | - 'timeout' => $clientConfig[ 'timeout' ], |
|
80 | + 'timeout' => $clientConfig['timeout'], |
|
81 | 81 | ]); |
82 | 82 | |
83 | 83 | $this->createDatabase(); |
@@ -98,10 +98,10 @@ discard block |
||
98 | 98 | throw new PhpfastcacheDriverException('Got error while trying to get a document: ' . $e->getMessage(), null, $e); |
99 | 99 | } |
100 | 100 | |
101 | - if ($response->status === 404 || empty($response->body[ 'data' ])) { |
|
101 | + if ($response->status === 404 || empty($response->body['data'])) { |
|
102 | 102 | return null; |
103 | 103 | } else if ($response->status === 200) { |
104 | - return $this->decode($response->body[ 'data' ]); |
|
104 | + return $this->decode($response->body['data']); |
|
105 | 105 | } else { |
106 | 106 | throw new PhpfastcacheDriverException('Got unexpected HTTP status: ' . $response->status); |
107 | 107 | } |
@@ -184,8 +184,8 @@ discard block |
||
184 | 184 | null, |
185 | 185 | false |
186 | 186 | ); |
187 | - if (!empty($response->headers[ 'etag' ])) { |
|
188 | - return \trim($response->headers[ 'etag' ], " '\"\t\n\r\0\x0B"); |
|
187 | + if (!empty($response->headers['etag'])) { |
|
188 | + return \trim($response->headers['etag'], " '\"\t\n\r\0\x0B"); |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | return null; |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | $info = $this->instance->getDatabaseInfo(); |
237 | 237 | |
238 | 238 | return (new DriverStatistic()) |
239 | - ->setSize($info[ 'sizes' ][ 'active' ]) |
|
239 | + ->setSize($info['sizes']['active']) |
|
240 | 240 | ->setRawData($info) |
241 | 241 | ->setData(\implode(', ', \array_keys($this->itemInstances))) |
242 | 242 | ->setInfo('Couchdb version ' . $this->instance->getVersion() . "\n For more information see RawData."); |
@@ -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 |