@@ -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) { |
@@ -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 | |
@@ -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, PhpfastcacheLogicException, PhpfastcacheUnsupportedOperationException |
|
| 21 | + PhpfastcacheDeprecatedException, PhpfastcacheDriverCheckException, PhpfastcacheDriverNotFoundException, PhpfastcacheInstanceNotFoundException, PhpfastcacheInvalidArgumentException, PhpfastcacheInvalidConfigurationException, PhpfastcacheLogicException, PhpfastcacheUnsupportedOperationException |
|
| 22 | 22 | }; |
| 23 | 23 | use Phpfastcache\Util\ClassNamespaceResolverTrait; |
| 24 | 24 | |
@@ -102,8 +102,8 @@ discard block |
||
| 102 | 102 | if (is_array($config)) { |
| 103 | 103 | $config = new ConfigurationOption($config); |
| 104 | 104 | trigger_error( |
| 105 | - 'The CacheManager will drops the support of primitive configuration arrays, use a "\Phpfastcache\Config\ConfigurationOption" object instead', |
|
| 106 | - E_USER_DEPRECATED |
|
| 105 | + 'The CacheManager will drops the support of primitive configuration arrays, use a "\Phpfastcache\Config\ConfigurationOption" object instead', |
|
| 106 | + E_USER_DEPRECATED |
|
| 107 | 107 | ); |
| 108 | 108 | }elseif ($config === null){ |
| 109 | 109 | $config = self::getDefaultConfig(); |
@@ -304,27 +304,27 @@ discard block |
||
| 304 | 304 | { |
| 305 | 305 | trigger_error(sprintf('Method "%s" is deprecated as of the V7 and will be removed soon or later, use CacheManager::getDriverList() instead.', __METHOD__), E_USER_DEPRECATED); |
| 306 | 306 | return [ |
| 307 | - 'Apc', |
|
| 308 | - 'Apcu', |
|
| 309 | - 'Cassandra', |
|
| 310 | - 'Couchbase', |
|
| 311 | - 'Couchdb', |
|
| 312 | - 'Devnull', |
|
| 313 | - 'Files', |
|
| 314 | - 'Leveldb', |
|
| 315 | - 'Memcache', |
|
| 316 | - 'Memcached', |
|
| 317 | - 'Memstatic', |
|
| 318 | - 'Mongodb', |
|
| 319 | - 'Predis', |
|
| 320 | - 'Redis', |
|
| 321 | - 'Riak', |
|
| 322 | - 'Ssdb', |
|
| 323 | - 'Sqlite', |
|
| 324 | - 'Wincache', |
|
| 325 | - 'Xcache', |
|
| 326 | - 'Zenddisk', |
|
| 327 | - 'Zendshm', |
|
| 307 | + 'Apc', |
|
| 308 | + 'Apcu', |
|
| 309 | + 'Cassandra', |
|
| 310 | + 'Couchbase', |
|
| 311 | + 'Couchdb', |
|
| 312 | + 'Devnull', |
|
| 313 | + 'Files', |
|
| 314 | + 'Leveldb', |
|
| 315 | + 'Memcache', |
|
| 316 | + 'Memcached', |
|
| 317 | + 'Memstatic', |
|
| 318 | + 'Mongodb', |
|
| 319 | + 'Predis', |
|
| 320 | + 'Redis', |
|
| 321 | + 'Riak', |
|
| 322 | + 'Ssdb', |
|
| 323 | + 'Sqlite', |
|
| 324 | + 'Wincache', |
|
| 325 | + 'Xcache', |
|
| 326 | + 'Zenddisk', |
|
| 327 | + 'Zendshm', |
|
| 328 | 328 | ]; |
| 329 | 329 | } |
| 330 | 330 | |
@@ -336,9 +336,9 @@ discard block |
||
| 336 | 336 | { |
| 337 | 337 | trigger_error(sprintf('Method "%s" is deprecated as of the V7 and will be removed soon or later, use CacheManager::getDriverList() instead.', __METHOD__), E_USER_DEPRECATED); |
| 338 | 338 | return \array_merge(self::getStaticSystemDrivers(), [ |
| 339 | - 'Devtrue', |
|
| 340 | - 'Devfalse', |
|
| 341 | - 'Cookie', |
|
| 339 | + 'Devtrue', |
|
| 340 | + 'Devfalse', |
|
| 341 | + 'Cookie', |
|
| 342 | 342 | ]); |
| 343 | 343 | } |
| 344 | 344 | |
@@ -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 | |
@@ -105,9 +105,9 @@ discard block |
||
| 105 | 105 | 'The CacheManager will drops the support of primitive configuration arrays, use a "\Phpfastcache\Config\ConfigurationOption" object instead', |
| 106 | 106 | E_USER_DEPRECATED |
| 107 | 107 | ); |
| 108 | - }elseif ($config === null){ |
|
| 108 | + }elseif ($config === null) { |
|
| 109 | 109 | $config = self::getDefaultConfig(); |
| 110 | - }else if(!($config instanceof ConfigurationOption)){ |
|
| 110 | + } else if (!($config instanceof ConfigurationOption)) { |
|
| 111 | 111 | throw new PhpfastcacheInvalidArgumentException(sprintf('Unsupported config type: %s', gettype($config))); |
| 112 | 112 | } |
| 113 | 113 | |
@@ -119,14 +119,14 @@ discard block |
||
| 119 | 119 | |
| 120 | 120 | $instance = $instanceId ?: md5($driver . \serialize($config->toArray())); |
| 121 | 121 | |
| 122 | - if (!isset(self::$instances[ $instance ])) { |
|
| 123 | - $badPracticeOmeter[ $driver ] = 1; |
|
| 122 | + if (!isset(self::$instances[$instance])) { |
|
| 123 | + $badPracticeOmeter[$driver] = 1; |
|
| 124 | 124 | $driverClass = self::getNamespacePath() . $driver . '\Driver'; |
| 125 | 125 | try { |
| 126 | 126 | if (\class_exists($driverClass)) { |
| 127 | 127 | $configClass = $driverClass::getConfigClass(); |
| 128 | - self::$instances[ $instance ] = new $driverClass(new $configClass($config->toArray()), $instance); |
|
| 129 | - self::$instances[ $instance ]->setEventManager(EventManager::getInstance()); |
|
| 128 | + self::$instances[$instance] = new $driverClass(new $configClass($config->toArray()), $instance); |
|
| 129 | + self::$instances[$instance]->setEventManager(EventManager::getInstance()); |
|
| 130 | 130 | } else { |
| 131 | 131 | throw new PhpfastcacheDriverNotFoundException(sprintf('The driver "%s" does not exists', $driver)); |
| 132 | 132 | } |
@@ -144,14 +144,14 @@ discard block |
||
| 144 | 144 | throw new PhpfastcacheDriverCheckException($e->getMessage(), $e->getCode(), $e); |
| 145 | 145 | } |
| 146 | 146 | } |
| 147 | - } else if ($badPracticeOmeter[ $driver ] >= 2) { |
|
| 147 | + } else if ($badPracticeOmeter[$driver] >= 2) { |
|
| 148 | 148 | trigger_error('[' . $driver . '] Calling many times CacheManager::getInstance() for already instanced drivers is a bad practice and have a significant impact on performances. |
| 149 | 149 | See https://github.com/PHPSocialNetwork/phpfastcache/wiki/[V5]-Why-calling-getInstance%28%29-each-time-is-a-bad-practice-%3F'); |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | - $badPracticeOmeter[ $driver ]++; |
|
| 152 | + $badPracticeOmeter[$driver]++; |
|
| 153 | 153 | |
| 154 | - return self::$instances[ $instance ]; |
|
| 154 | + return self::$instances[$instance]; |
|
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | /** |
@@ -168,8 +168,8 @@ discard block |
||
| 168 | 168 | throw new PhpfastcacheInvalidArgumentException('The Instance ID must be a string'); |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | - if (isset(self::$instances[ $instanceId ])) { |
|
| 172 | - return self::$instances[ $instanceId ]; |
|
| 171 | + if (isset(self::$instances[$instanceId])) { |
|
| 172 | + return self::$instances[$instanceId]; |
|
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | throw new PhpfastcacheInstanceNotFoundException(sprintf('Instance ID %s not found', $instanceId)); |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | } |
| 227 | 227 | } |
| 228 | 228 | |
| 229 | - if(!$autoDriver || !\is_string($autoDriver)){ |
|
| 229 | + if (!$autoDriver || !\is_string($autoDriver)) { |
|
| 230 | 230 | throw new PhpfastcacheLogicException('Unable to find out a valid driver automatically'); |
| 231 | 231 | } |
| 232 | 232 | |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | */ |
| 241 | 241 | public static function __callStatic(string $name, array $arguments): ExtendedCacheItemPoolInterface |
| 242 | 242 | { |
| 243 | - $options = (\array_key_exists(0, $arguments) && \is_array($arguments) ? $arguments[ 0 ] : []); |
|
| 243 | + $options = (\array_key_exists(0, $arguments) && \is_array($arguments) ? $arguments[0] : []); |
|
| 244 | 244 | |
| 245 | 245 | return self::getInstance($name, $options); |
| 246 | 246 | } |
@@ -350,14 +350,14 @@ discard block |
||
| 350 | 350 | { |
| 351 | 351 | static $driverList; |
| 352 | 352 | |
| 353 | - if(self::getDefaultNamespacePath() === self::getNamespacePath()){ |
|
| 354 | - if($driverList === null){ |
|
| 353 | + if (self::getDefaultNamespacePath() === self::getNamespacePath()) { |
|
| 354 | + if ($driverList === null) { |
|
| 355 | 355 | $prefix = 'Phpfastcache\Drivers\\'; |
| 356 | 356 | $classMap = self::createClassMap(__DIR__ . '/Drivers'); |
| 357 | 357 | $driverList = []; |
| 358 | 358 | |
| 359 | 359 | foreach ($classMap as $class => $file) { |
| 360 | - $driverList[] = str_replace($prefix, '', substr($class, 0, strrpos($class, '\\') )); |
|
| 360 | + $driverList[] = str_replace($prefix, '', substr($class, 0, strrpos($class, '\\'))); |
|
| 361 | 361 | } |
| 362 | 362 | |
| 363 | 363 | $driverList = array_values(array_unique($driverList)); |
@@ -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 |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | use LevelDB as LeveldbClient; |
| 19 | 19 | use Phpfastcache\Core\Pool\{DriverBaseTrait, ExtendedCacheItemPoolInterface, IO\IOHelperTrait}; |
| 20 | 20 | use Phpfastcache\Exceptions\{ |
| 21 | - PhpfastcacheInvalidArgumentException, PhpfastcacheLogicException |
|
| 21 | + PhpfastcacheInvalidArgumentException, PhpfastcacheLogicException |
|
| 22 | 22 | }; |
| 23 | 23 | use Psr\Cache\CacheItemInterface; |
| 24 | 24 | |
@@ -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\Leveldb; |
| 17 | 17 | |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | * Check for Cross-Driver type confusion |
| 85 | 85 | */ |
| 86 | 86 | if ($item instanceof Item) { |
| 87 | - return (bool)$this->instance->set($item->getKey(), $this->encode($this->driverPreWrap($item))); |
|
| 87 | + return (bool) $this->instance->set($item->getKey(), $this->encode($this->driverPreWrap($item))); |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | throw new PhpfastcacheInvalidArgumentException('Cross-Driver type confusion detected'); |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | $this->instance->close(); |
| 117 | 117 | $this->instance = null; |
| 118 | 118 | } |
| 119 | - $result = (bool)LeveldbClient::destroy($this->getLeveldbFile()); |
|
| 119 | + $result = (bool) LeveldbClient::destroy($this->getLeveldbFile()); |
|
| 120 | 120 | $this->driverConnect(); |
| 121 | 121 | |
| 122 | 122 | return $result; |
@@ -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 | |
@@ -133,10 +133,10 @@ discard block |
||
| 133 | 133 | $date = (new \DateTime())->setTimestamp($stats[ 'start_time' ]); |
| 134 | 134 | |
| 135 | 135 | return (new DriverStatistic()) |
| 136 | - ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
| 137 | - ->setInfo(\sprintf("The APC cache is up since %s, and have %d item(s) in cache.\n For more information see RawData.", $date->format(DATE_RFC2822), |
|
| 136 | + ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
| 137 | + ->setInfo(\sprintf("The APC cache is up since %s, and have %d item(s) in cache.\n For more information see RawData.", $date->format(DATE_RFC2822), |
|
| 138 | 138 | $stats[ 'num_entries' ])) |
| 139 | - ->setRawData($stats) |
|
| 140 | - ->setSize($stats[ 'mem_size' ]); |
|
| 139 | + ->setRawData($stats) |
|
| 140 | + ->setSize($stats[ 'mem_size' ]); |
|
| 141 | 141 | } |
| 142 | 142 | } |
| 143 | 143 | \ 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\Apc; |
| 17 | 17 | |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | if ($item instanceof Item) { |
| 88 | 88 | $ttl = $item->getExpirationDate()->getTimestamp() - time(); |
| 89 | 89 | |
| 90 | - return (bool)apc_store($item->getKey(), $this->driverPreWrap($item), ($ttl > 0 ? $ttl : 0)); |
|
| 90 | + return (bool) apc_store($item->getKey(), $this->driverPreWrap($item), ($ttl > 0 ? $ttl : 0)); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | throw new PhpfastcacheInvalidArgumentException('Cross-Driver type confusion detected'); |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | * Check for Cross-Driver type confusion |
| 105 | 105 | */ |
| 106 | 106 | if ($item instanceof Item) { |
| 107 | - return (bool)apc_delete($item->getKey()); |
|
| 107 | + return (bool) apc_delete($item->getKey()); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | throw new PhpfastcacheInvalidArgumentException('Cross-Driver type confusion detected'); |
@@ -129,14 +129,14 @@ discard block |
||
| 129 | 129 | */ |
| 130 | 130 | public function getStats(): DriverStatistic |
| 131 | 131 | { |
| 132 | - $stats = (array)apc_cache_info('user'); |
|
| 133 | - $date = (new \DateTime())->setTimestamp($stats[ 'start_time' ]); |
|
| 132 | + $stats = (array) apc_cache_info('user'); |
|
| 133 | + $date = (new \DateTime())->setTimestamp($stats['start_time']); |
|
| 134 | 134 | |
| 135 | 135 | return (new DriverStatistic()) |
| 136 | 136 | ->setData(\implode(', ', \array_keys($this->itemInstances))) |
| 137 | 137 | ->setInfo(\sprintf("The APC cache is up since %s, and have %d item(s) in cache.\n For more information see RawData.", $date->format(DATE_RFC2822), |
| 138 | - $stats[ 'num_entries' ])) |
|
| 138 | + $stats['num_entries'])) |
|
| 139 | 139 | ->setRawData($stats) |
| 140 | - ->setSize($stats[ 'mem_size' ]); |
|
| 140 | + ->setSize($stats['mem_size']); |
|
| 141 | 141 | } |
| 142 | 142 | } |
| 143 | 143 | \ No newline at end of file |