@@ -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) { |
@@ -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 | |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | public function __construct($testName) |
| 37 | 37 | { |
| 38 | - $this->printText('[PhpFastCache CORE v' . Api::getPhpFastCacheVersion() . Api::getPhpFastCacheGitHeadHash() . ']', true); |
|
| 38 | + $this->printText('[PhpFastCache CORE v' . Api::getPhpFastCacheVersion() . Api::getPhpFastCacheGitHeadHash() . ']', true); |
|
| 39 | 39 | $this->printText('[PhpFastCache API v' . Api::getVersion() . ']', true); |
| 40 | 40 | $this->printText('[PHP v' . PHP_VERSION . ']', true); |
| 41 | 41 | $this->printText("[Begin Test: '{$testName}']"); |
@@ -184,9 +184,9 @@ discard block |
||
| 184 | 184 | * @param \Throwable $exception |
| 185 | 185 | */ |
| 186 | 186 | public function exceptionHandler(\Throwable $exception) { |
| 187 | - if($exception instanceof PhpfastcacheDriverCheckException){ |
|
| 187 | + if ($exception instanceof PhpfastcacheDriverCheckException) { |
|
| 188 | 188 | $this->printSkipText('A driver could not be initialized due to missing requirement: ' . $exception->getMessage()); |
| 189 | - }else{ |
|
| 189 | + } else { |
|
| 190 | 190 | $this->printFailText(sprintf( |
| 191 | 191 | 'Uncaught exception "%s" in "%s" line %d with message: "%s"', |
| 192 | 192 | \get_class($exception), |
@@ -86,33 +86,33 @@ discard block |
||
| 86 | 86 | public function __construct(...$args) |
| 87 | 87 | { |
| 88 | 88 | parent::__construct(...$args); |
| 89 | - $array =& $this->getArray(); |
|
| 89 | + $array = & $this->getArray(); |
|
| 90 | 90 | |
| 91 | 91 | /** |
| 92 | 92 | * Detect unwanted keys and throw an exception. |
| 93 | 93 | * No more kidding now, it's 21th century. |
| 94 | 94 | */ |
| 95 | - if(array_diff_key($array, get_object_vars($this))){ |
|
| 95 | + if (array_diff_key($array, get_object_vars($this))) { |
|
| 96 | 96 | throw new PhpfastcacheInvalidConfigurationException(sprintf( |
| 97 | 97 | 'Invalid option(s) for the config %s: %s', |
| 98 | 98 | static::class, |
| 99 | - implode(', ', array_keys(array_diff_key($array, get_object_vars($this)))) |
|
| 99 | + implode(', ', array_keys(array_diff_key($array, get_object_vars($this)))) |
|
| 100 | 100 | )); |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | foreach (get_object_vars($this) as $property => $value) { |
| 104 | 104 | |
| 105 | - if(array_key_exists($property, $array)){ |
|
| 106 | - $this->$property = &$array[ $property ]; |
|
| 107 | - }else{ |
|
| 108 | - $array[ $property ] = &$this->$property; |
|
| 105 | + if (array_key_exists($property, $array)) { |
|
| 106 | + $this->$property = &$array[$property]; |
|
| 107 | + } else { |
|
| 108 | + $array[$property] = &$this->$property; |
|
| 109 | 109 | } |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | foreach (get_class_methods($this) as $method) { |
| 113 | - if(strpos($method, 'set') === 0){ |
|
| 113 | + if (strpos($method, 'set') === 0) { |
|
| 114 | 114 | $value = null; |
| 115 | - try{ |
|
| 115 | + try { |
|
| 116 | 116 | /** |
| 117 | 117 | * We use property instead of getter |
| 118 | 118 | * because of is/get conditions and |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | */ |
| 122 | 122 | $value = $this->{lcfirst(substr($method, 3))}; |
| 123 | 123 | $this->{$method}($value); |
| 124 | - }catch(\TypeError $e){ |
|
| 124 | + } catch (\TypeError $e) { |
|
| 125 | 125 | $typeHintGot = \is_object($value) ? \get_class($value) : \gettype($value); |
| 126 | 126 | $reflectionMethod = new \ReflectionMethod($this, $method); |
| 127 | 127 | $parameter = $reflectionMethod->getParameters()[0] ?? null; |
@@ -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 | } |
@@ -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."); |
@@ -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 |
@@ -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 |
@@ -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\Memcache; |
| 17 | 17 | |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | 'path' => !empty($this->config->getOption('path')) ? $this->config->getOption('path') : false, |
| 79 | 79 | 'port' => !empty($this->config->getOption('port')) ? $this->config->getOption('port') : 11211, |
| 80 | 80 | 'saslUser' => !empty($this->config->getOption('saslUser')) ? $this->config->getOption('saslUser') : false, |
| 81 | - 'saslPassword' =>!empty($this->config->getOption('saslPassword')) ? $this->config->getOption('saslPassword'): false, |
|
| 81 | + 'saslPassword' =>!empty($this->config->getOption('saslPassword')) ? $this->config->getOption('saslPassword') : false, |
|
| 82 | 82 | ], |
| 83 | 83 | ]; |
| 84 | 84 | } |
@@ -88,13 +88,13 @@ discard block |
||
| 88 | 88 | /** |
| 89 | 89 | * If path is provided we consider it as an UNIX Socket |
| 90 | 90 | */ |
| 91 | - if(!empty($server[ 'path' ]) && !$this->instance->addServer($server[ 'path' ], 0)){ |
|
| 91 | + if (!empty($server['path']) && !$this->instance->addServer($server['path'], 0)) { |
|
| 92 | 92 | $this->fallback = true; |
| 93 | - }else if (!empty($server[ 'host' ]) && !$this->instance->addServer($server[ 'host' ], $server[ 'port' ])) { |
|
| 93 | + } else if (!empty($server['host']) && !$this->instance->addServer($server['host'], $server['port'])) { |
|
| 94 | 94 | $this->fallback = true; |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | - if (!empty($server[ 'saslUser' ]) && !empty($server[ 'saslPassword' ])) { |
|
| 97 | + if (!empty($server['saslUser']) && !empty($server['saslPassword'])) { |
|
| 98 | 98 | throw new PhpfastcacheDriverException('Unlike Memcached, Memcache does not support SASL authentication'); |
| 99 | 99 | } |
| 100 | 100 | } catch (\Exception $e) { |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | * Since Memcached does not throw |
| 106 | 106 | * any error if not connected ... |
| 107 | 107 | */ |
| 108 | - if(!$this->instance->getServerStatus(!empty($server[ 'path' ]) ? $server[ 'path' ] : $server[ 'host' ], !empty($server[ 'port' ]) ? $server[ 'port' ] : 0)){ |
|
| 108 | + if (!$this->instance->getServerStatus(!empty($server['path']) ? $server['path'] : $server['host'], !empty($server['port']) ? $server['port'] : 0)) { |
|
| 109 | 109 | throw new PhpfastcacheDriverException('Memcache seems to not be connected'); |
| 110 | 110 | } |
| 111 | 111 | } |
@@ -188,17 +188,17 @@ discard block |
||
| 188 | 188 | */ |
| 189 | 189 | public function getStats(): DriverStatistic |
| 190 | 190 | { |
| 191 | - $stats = (array)$this->instance->getstats(); |
|
| 192 | - $stats[ 'uptime' ] = (isset($stats[ 'uptime' ]) ? $stats[ 'uptime' ] : 0); |
|
| 193 | - $stats[ 'version' ] = (isset($stats[ 'version' ]) ? $stats[ 'version' ] : 'UnknownVersion'); |
|
| 194 | - $stats[ 'bytes' ] = (isset($stats[ 'bytes' ]) ? $stats[ 'version' ] : 0); |
|
| 191 | + $stats = (array) $this->instance->getstats(); |
|
| 192 | + $stats['uptime'] = (isset($stats['uptime']) ? $stats['uptime'] : 0); |
|
| 193 | + $stats['version'] = (isset($stats['version']) ? $stats['version'] : 'UnknownVersion'); |
|
| 194 | + $stats['bytes'] = (isset($stats['bytes']) ? $stats['version'] : 0); |
|
| 195 | 195 | |
| 196 | - $date = (new \DateTime())->setTimestamp(time() - $stats[ 'uptime' ]); |
|
| 196 | + $date = (new \DateTime())->setTimestamp(time() - $stats['uptime']); |
|
| 197 | 197 | |
| 198 | 198 | return (new DriverStatistic()) |
| 199 | 199 | ->setData(\implode(', ', \array_keys($this->itemInstances))) |
| 200 | - ->setInfo(\sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats[ 'version' ], $date->format(DATE_RFC2822))) |
|
| 200 | + ->setInfo(\sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats['version'], $date->format(DATE_RFC2822))) |
|
| 201 | 201 | ->setRawData($stats) |
| 202 | - ->setSize((int)$stats[ 'bytes' ]); |
|
| 202 | + ->setSize((int) $stats['bytes']); |
|
| 203 | 203 | } |
| 204 | 204 | } |
| 205 | 205 | \ 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\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; |