@@ -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 |
@@ -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 |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | * @author Georges.L (Geolim4) <[email protected]> |
13 | 13 | * |
14 | 14 | */ |
15 | -declare(strict_types=1); |
|
15 | +declare(strict_types = 1); |
|
16 | 16 | |
17 | 17 | namespace Phpfastcache\Drivers\Predis; |
18 | 18 | |
@@ -55,12 +55,12 @@ discard block |
||
55 | 55 | */ |
56 | 56 | protected function driverConnect(): bool |
57 | 57 | { |
58 | - if(!empty($this->config->getOption('path'))){ |
|
58 | + if (!empty($this->config->getOption('path'))) { |
|
59 | 59 | $this->instance = new PredisClient([ |
60 | 60 | 'scheme' => 'unix', |
61 | 61 | 'path' => $this->config->getOption('path') |
62 | 62 | ]); |
63 | - }else{ |
|
63 | + } else { |
|
64 | 64 | $this->instance = new PredisClient($this->getConfig()->getPredisConfigArray()); |
65 | 65 | } |
66 | 66 | |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | * @see https://redis.io/commands/expire |
107 | 107 | */ |
108 | 108 | if ($ttl <= 0) { |
109 | - return (bool)$this->instance->expire($item->getKey(), 0); |
|
109 | + return (bool) $this->instance->expire($item->getKey(), 0); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | return $this->instance->setex($item->getKey(), $ttl, $this->encode($this->driverPreWrap($item)))->getPayload() === 'OK'; |
@@ -166,9 +166,9 @@ discard block |
||
166 | 166 | public function getStats(): DriverStatistic |
167 | 167 | { |
168 | 168 | $info = $this->instance->info(); |
169 | - $size = (isset($info[ 'Memory' ][ 'used_memory' ]) ? $info[ 'Memory' ][ 'used_memory' ] : 0); |
|
170 | - $version = (isset($info[ 'Server' ][ 'redis_version' ]) ? $info[ 'Server' ][ 'redis_version' ] : 0); |
|
171 | - $date = (isset($info[ 'Server' ][ 'uptime_in_seconds' ]) ? (new \DateTime())->setTimestamp(time() - $info[ 'Server' ][ 'uptime_in_seconds' ]) : 'unknown date'); |
|
169 | + $size = (isset($info['Memory']['used_memory']) ? $info['Memory']['used_memory'] : 0); |
|
170 | + $version = (isset($info['Server']['redis_version']) ? $info['Server']['redis_version'] : 0); |
|
171 | + $date = (isset($info['Server']['uptime_in_seconds']) ? (new \DateTime())->setTimestamp(time() - $info['Server']['uptime_in_seconds']) : 'unknown date'); |
|
172 | 172 | |
173 | 173 | return (new DriverStatistic()) |
174 | 174 | ->setData(\implode(', ', \array_keys($this->itemInstances))) |
@@ -60,7 +60,7 @@ |
||
60 | 60 | 'scheme' => 'unix', |
61 | 61 | 'path' => $this->config->getOption('path') |
62 | 62 | ]); |
63 | - }else{ |
|
63 | + } else{ |
|
64 | 64 | $this->instance = new PredisClient($this->getConfig()->getPredisConfigArray()); |
65 | 65 | } |
66 | 66 |
@@ -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, PhpfastcacheDriverException |
|
22 | + PhpfastcacheInvalidArgumentException, PhpfastcacheDriverException |
|
23 | 23 | }; |
24 | 24 | use Phpfastcache\Util\ArrayObject; |
25 | 25 | use Predis\Client as PredisClient; |
@@ -57,8 +57,8 @@ discard block |
||
57 | 57 | { |
58 | 58 | if(!empty($this->config->getOption('path'))){ |
59 | 59 | $this->instance = new PredisClient([ |
60 | - 'scheme' => 'unix', |
|
61 | - 'path' => $this->config->getOption('path') |
|
60 | + 'scheme' => 'unix', |
|
61 | + 'path' => $this->config->getOption('path') |
|
62 | 62 | ]); |
63 | 63 | }else{ |
64 | 64 | $this->instance = new PredisClient($this->getConfig()->getPredisConfigArray()); |
@@ -171,10 +171,10 @@ discard block |
||
171 | 171 | $date = (isset($info[ 'Server' ][ 'uptime_in_seconds' ]) ? (new \DateTime())->setTimestamp(time() - $info[ 'Server' ][ 'uptime_in_seconds' ]) : 'unknown date'); |
172 | 172 | |
173 | 173 | return (new DriverStatistic()) |
174 | - ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
175 | - ->setRawData($info) |
|
176 | - ->setSize((int) $size) |
|
177 | - ->setInfo(\sprintf("The Redis daemon v%s is up since %s.\n For more information see RawData. \n Driver size includes the memory allocation size.", |
|
174 | + ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
175 | + ->setRawData($info) |
|
176 | + ->setSize((int) $size) |
|
177 | + ->setInfo(\sprintf("The Redis daemon v%s is up since %s.\n For more information see RawData. \n Driver size includes the memory allocation size.", |
|
178 | 178 | $version, $date->format(DATE_RFC2822))); |
179 | 179 | } |
180 | 180 | } |
181 | 181 | \ No newline at end of file |
@@ -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) { |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | use Phpfastcache\Config\ConfigurationOption; |
19 | 19 | use Phpfastcache\Core\Pool\ExtendedCacheItemPoolInterface; |
20 | 20 | use Phpfastcache\Exceptions\{ |
21 | - PhpfastcacheDeprecatedException, PhpfastcacheDriverCheckException, PhpfastcacheDriverNotFoundException, PhpfastcacheInstanceNotFoundException, PhpfastcacheInvalidArgumentException, PhpfastcacheInvalidConfigurationException |
|
21 | + PhpfastcacheDeprecatedException, PhpfastcacheDriverCheckException, PhpfastcacheDriverNotFoundException, PhpfastcacheInstanceNotFoundException, PhpfastcacheInvalidArgumentException, PhpfastcacheInvalidConfigurationException |
|
22 | 22 | }; |
23 | 23 | |
24 | 24 | /** |
@@ -99,8 +99,8 @@ discard block |
||
99 | 99 | if (is_array($config)) { |
100 | 100 | $config = new ConfigurationOption($config); |
101 | 101 | trigger_error( |
102 | - 'The CacheManager will drops the support of primitive configuration arrays, use a "\Phpfastcache\Config\ConfigurationOption" object instead', |
|
103 | - E_USER_DEPRECATED |
|
102 | + 'The CacheManager will drops the support of primitive configuration arrays, use a "\Phpfastcache\Config\ConfigurationOption" object instead', |
|
103 | + E_USER_DEPRECATED |
|
104 | 104 | ); |
105 | 105 | }elseif ($config === null){ |
106 | 106 | $config = self::getDefaultConfig(); |
@@ -291,27 +291,27 @@ discard block |
||
291 | 291 | * @todo Reflection reader |
292 | 292 | */ |
293 | 293 | return [ |
294 | - 'Apc', |
|
295 | - 'Apcu', |
|
296 | - 'Cassandra', |
|
297 | - 'Couchbase', |
|
298 | - 'Couchdb', |
|
299 | - 'Devnull', |
|
300 | - 'Files', |
|
301 | - 'Leveldb', |
|
302 | - 'Memcache', |
|
303 | - 'Memcached', |
|
304 | - 'Memstatic', |
|
305 | - 'Mongodb', |
|
306 | - 'Predis', |
|
307 | - 'Redis', |
|
308 | - 'Riak', |
|
309 | - 'Ssdb', |
|
310 | - 'Sqlite', |
|
311 | - 'Wincache', |
|
312 | - 'Xcache', |
|
313 | - 'Zenddisk', |
|
314 | - 'Zendshm', |
|
294 | + 'Apc', |
|
295 | + 'Apcu', |
|
296 | + 'Cassandra', |
|
297 | + 'Couchbase', |
|
298 | + 'Couchdb', |
|
299 | + 'Devnull', |
|
300 | + 'Files', |
|
301 | + 'Leveldb', |
|
302 | + 'Memcache', |
|
303 | + 'Memcached', |
|
304 | + 'Memstatic', |
|
305 | + 'Mongodb', |
|
306 | + 'Predis', |
|
307 | + 'Redis', |
|
308 | + 'Riak', |
|
309 | + 'Ssdb', |
|
310 | + 'Sqlite', |
|
311 | + 'Wincache', |
|
312 | + 'Xcache', |
|
313 | + 'Zenddisk', |
|
314 | + 'Zendshm', |
|
315 | 315 | ]; |
316 | 316 | } |
317 | 317 | |
@@ -324,9 +324,9 @@ discard block |
||
324 | 324 | * @todo Reflection reader |
325 | 325 | */ |
326 | 326 | return \array_merge(self::getStaticSystemDrivers(), [ |
327 | - 'Devtrue', |
|
328 | - 'Devfalse', |
|
329 | - 'Cookie', |
|
327 | + 'Devtrue', |
|
328 | + 'Devfalse', |
|
329 | + 'Cookie', |
|
330 | 330 | ]); |
331 | 331 | } |
332 | 332 |
@@ -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; |
17 | 17 | |
@@ -102,9 +102,9 @@ discard block |
||
102 | 102 | 'The CacheManager will drops the support of primitive configuration arrays, use a "\Phpfastcache\Config\ConfigurationOption" object instead', |
103 | 103 | E_USER_DEPRECATED |
104 | 104 | ); |
105 | - }elseif ($config === null){ |
|
105 | + }elseif ($config === null) { |
|
106 | 106 | $config = self::getDefaultConfig(); |
107 | - }else if(!($config instanceof ConfigurationOption)){ |
|
107 | + } else if (!($config instanceof ConfigurationOption)) { |
|
108 | 108 | throw new PhpfastcacheInvalidArgumentException(sprintf('Unsupported config type: %s', gettype($config))); |
109 | 109 | } |
110 | 110 | |
@@ -116,14 +116,14 @@ discard block |
||
116 | 116 | |
117 | 117 | $instance = $instanceId ?: md5($driver . \serialize($config->toArray())); |
118 | 118 | |
119 | - if (!isset(self::$instances[ $instance ])) { |
|
120 | - $badPracticeOmeter[ $driver ] = 1; |
|
119 | + if (!isset(self::$instances[$instance])) { |
|
120 | + $badPracticeOmeter[$driver] = 1; |
|
121 | 121 | $driverClass = self::getNamespacePath() . $driver . '\Driver'; |
122 | 122 | try { |
123 | 123 | if (\class_exists($driverClass)) { |
124 | 124 | $configClass = $driverClass::getConfigClass(); |
125 | - self::$instances[ $instance ] = new $driverClass(new $configClass($config->toArray()), $instance); |
|
126 | - self::$instances[ $instance ]->setEventManager(EventManager::getInstance()); |
|
125 | + self::$instances[$instance] = new $driverClass(new $configClass($config->toArray()), $instance); |
|
126 | + self::$instances[$instance]->setEventManager(EventManager::getInstance()); |
|
127 | 127 | } else { |
128 | 128 | throw new PhpfastcacheDriverNotFoundException(sprintf('The driver "%s" does not exists', $driver)); |
129 | 129 | } |
@@ -142,14 +142,14 @@ discard block |
||
142 | 142 | throw new PhpfastcacheDriverCheckException($e->getMessage(), $e->getCode(), $e); |
143 | 143 | } |
144 | 144 | } |
145 | - } else if ($badPracticeOmeter[ $driver ] >= 2) { |
|
145 | + } else if ($badPracticeOmeter[$driver] >= 2) { |
|
146 | 146 | trigger_error('[' . $driver . '] Calling many times CacheManager::getInstance() for already instanced drivers is a bad practice and have a significant impact on performances. |
147 | 147 | See https://github.com/PHPSocialNetwork/phpfastcache/wiki/[V5]-Why-calling-getInstance%28%29-each-time-is-a-bad-practice-%3F'); |
148 | 148 | } |
149 | 149 | |
150 | - $badPracticeOmeter[ $driver ]++; |
|
150 | + $badPracticeOmeter[$driver]++; |
|
151 | 151 | |
152 | - return self::$instances[ $instance ]; |
|
152 | + return self::$instances[$instance]; |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | /** |
@@ -166,8 +166,8 @@ discard block |
||
166 | 166 | throw new PhpfastcacheInvalidArgumentException('The Instance ID must be a string'); |
167 | 167 | } |
168 | 168 | |
169 | - if (isset(self::$instances[ $instanceId ])) { |
|
170 | - return self::$instances[ $instanceId ]; |
|
169 | + if (isset(self::$instances[$instanceId])) { |
|
170 | + return self::$instances[$instanceId]; |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | throw new PhpfastcacheInstanceNotFoundException(sprintf('Instance ID %s not found', $instanceId)); |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | */ |
235 | 235 | public static function __callStatic($name, $arguments) |
236 | 236 | { |
237 | - $options = (\array_key_exists(0, $arguments) && \is_array($arguments) ? $arguments[ 0 ] : []); |
|
237 | + $options = (\array_key_exists(0, $arguments) && \is_array($arguments) ? $arguments[0] : []); |
|
238 | 238 | |
239 | 239 | return self::getInstance($name, $options); |
240 | 240 | } |
@@ -102,9 +102,9 @@ |
||
102 | 102 | 'The CacheManager will drops the support of primitive configuration arrays, use a "\Phpfastcache\Config\ConfigurationOption" object instead', |
103 | 103 | E_USER_DEPRECATED |
104 | 104 | ); |
105 | - }elseif ($config === null){ |
|
105 | + } elseif ($config === null){ |
|
106 | 106 | $config = self::getDefaultConfig(); |
107 | - }else if(!($config instanceof ConfigurationOption)){ |
|
107 | + } else if(!($config instanceof ConfigurationOption)){ |
|
108 | 108 | throw new PhpfastcacheInvalidArgumentException(sprintf('Unsupported config type: %s', gettype($config))); |
109 | 109 | } |
110 | 110 |
@@ -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."); |
@@ -17,11 +17,11 @@ discard block |
||
17 | 17 | |
18 | 18 | use Phpfastcache\Config\ConfigurationOption; |
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; |
@@ -162,10 +162,10 @@ discard block |
||
162 | 162 | $date = (new \DateTime())->setTimestamp(time() - $info[ 'uptime_in_seconds' ]); |
163 | 163 | |
164 | 164 | return (new DriverStatistic()) |
165 | - ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
166 | - ->setRawData($info) |
|
167 | - ->setSize((int)$info[ 'used_memory' ]) |
|
168 | - ->setInfo(\sprintf("The Redis daemon v%s is up since %s.\n For more information see RawData. \n Driver size includes the memory allocation size.", |
|
165 | + ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
166 | + ->setRawData($info) |
|
167 | + ->setSize((int)$info[ 'used_memory' ]) |
|
168 | + ->setInfo(\sprintf("The Redis daemon v%s is up since %s.\n For more information see RawData. \n Driver size includes the memory allocation size.", |
|
169 | 169 | $info[ 'redis_version' ], $date->format(DATE_RFC2822))); |
170 | 170 | } |
171 | 171 | } |
172 | 172 | \ 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\Redis; |
17 | 17 | |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | if ($this->config->getOption('path')) { |
64 | 64 | $isConnected = $this->instance->connect($this->config->getOption('path')); |
65 | 65 | } else { |
66 | - $isConnected = $this->instance->connect($this->config->getOption('host'), $this->config->getOption('port'), (int)$this->config->getOption('timeout')); |
|
66 | + $isConnected = $this->instance->connect($this->config->getOption('host'), $this->config->getOption('port'), (int) $this->config->getOption('timeout')); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | if (!$isConnected && $this->config->getOption('path')) { |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | * Check for Cross-Driver type confusion |
133 | 133 | */ |
134 | 134 | if ($item instanceof Item) { |
135 | - return (bool)$this->instance->del($item->getKey()); |
|
135 | + return (bool) $this->instance->del($item->getKey()); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | throw new PhpfastcacheInvalidArgumentException('Cross-Driver type confusion detected'); |
@@ -159,13 +159,13 @@ discard block |
||
159 | 159 | { |
160 | 160 | // used_memory |
161 | 161 | $info = $this->instance->info(); |
162 | - $date = (new \DateTime())->setTimestamp(time() - $info[ 'uptime_in_seconds' ]); |
|
162 | + $date = (new \DateTime())->setTimestamp(time() - $info['uptime_in_seconds']); |
|
163 | 163 | |
164 | 164 | return (new DriverStatistic()) |
165 | 165 | ->setData(\implode(', ', \array_keys($this->itemInstances))) |
166 | 166 | ->setRawData($info) |
167 | - ->setSize((int)$info[ 'used_memory' ]) |
|
167 | + ->setSize((int) $info['used_memory']) |
|
168 | 168 | ->setInfo(\sprintf("The Redis daemon v%s is up since %s.\n For more information see RawData. \n Driver size includes the memory allocation size.", |
169 | - $info[ 'redis_version' ], $date->format(DATE_RFC2822))); |
|
169 | + $info['redis_version'], $date->format(DATE_RFC2822))); |
|
170 | 170 | } |
171 | 171 | } |
172 | 172 | \ No newline at end of file |
@@ -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 |