@@ -78,7 +78,7 @@ |
||
| 78 | 78 | ->setData(implode(', ', array_keys($this->itemInstances))) |
| 79 | 79 | ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats['version'], $date->format(DATE_RFC2822))) |
| 80 | 80 | ->setRawData($stats) |
| 81 | - ->setSize((int)$stats['bytes']); |
|
| 81 | + ->setSize((int) $stats['bytes']); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | /** |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | * Check for Cross-Driver type confusion |
| 118 | 118 | */ |
| 119 | 119 | if ($item instanceof Item) { |
| 120 | - return (bool)$this->instance->setx($item->getEncodedKey(), $this->encode($this->driverPreWrap($item)), $item->getTtl()); |
|
| 120 | + return (bool) $this->instance->setx($item->getEncodedKey(), $this->encode($this->driverPreWrap($item)), $item->getTtl()); |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | throw new PhpfastcacheInvalidArgumentException('Cross-Driver type confusion detected'); |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | * Check for Cross-Driver type confusion |
| 135 | 135 | */ |
| 136 | 136 | if ($item instanceof Item) { |
| 137 | - return (bool)$this->instance->del($item->getEncodedKey()); |
|
| 137 | + return (bool) $this->instance->del($item->getEncodedKey()); |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | throw new PhpfastcacheInvalidArgumentException('Cross-Driver type confusion detected'); |
@@ -151,6 +151,6 @@ discard block |
||
| 151 | 151 | */ |
| 152 | 152 | protected function driverClear(): bool |
| 153 | 153 | { |
| 154 | - return (bool)$this->instance->flushdb('kv'); |
|
| 154 | + return (bool) $this->instance->flushdb('kv'); |
|
| 155 | 155 | } |
| 156 | 156 | } |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | ) |
| 97 | 97 | )->toArray()[0]; |
| 98 | 98 | |
| 99 | - $array_filter_recursive = static function ($array, callable $callback = null) use (&$array_filter_recursive) { |
|
| 99 | + $array_filter_recursive = static function($array, callable $callback = null) use (&$array_filter_recursive) { |
|
| 100 | 100 | $array = $callback($array); |
| 101 | 101 | |
| 102 | 102 | if (\is_object($array) || \is_array($array)) { |
@@ -108,12 +108,12 @@ discard block |
||
| 108 | 108 | return $array; |
| 109 | 109 | }; |
| 110 | 110 | |
| 111 | - $callback = static function ($item) { |
|
| 111 | + $callback = static function($item) { |
|
| 112 | 112 | /** |
| 113 | 113 | * Remove unserializable properties |
| 114 | 114 | */ |
| 115 | 115 | if ($item instanceof UTCDateTime) { |
| 116 | - return (string)$item; |
|
| 116 | + return (string) $item; |
|
| 117 | 117 | } |
| 118 | 118 | return $item; |
| 119 | 119 | }; |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | ) : new UTCDateTime(time() * 1000)), |
| 214 | 214 | ]; |
| 215 | 215 | } |
| 216 | - $result = (array)$this->getCollection()->updateOne( |
|
| 216 | + $result = (array) $this->getCollection()->updateOne( |
|
| 217 | 217 | ['_id' => $item->getEncodedKey()], |
| 218 | 218 | [ |
| 219 | 219 | '$set' => $set, |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | if (count($servers) > 0) { |
| 309 | 309 | $host = array_reduce( |
| 310 | 310 | $servers, |
| 311 | - static function ($carry, $data) { |
|
| 311 | + static function($carry, $data) { |
|
| 312 | 312 | $carry .= ($carry === '' ? '' : ',') . $data['host'] . ':' . $data['port']; |
| 313 | 313 | return $carry; |
| 314 | 314 | }, |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | */ |
| 48 | 48 | public function getStats(): DriverStatistic |
| 49 | 49 | { |
| 50 | - $stats = (array)apcu_cache_info(); |
|
| 50 | + $stats = (array) apcu_cache_info(); |
|
| 51 | 51 | $date = (new DateTime())->setTimestamp($stats['start_time']); |
| 52 | 52 | |
| 53 | 53 | return (new DriverStatistic()) |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | ) |
| 61 | 61 | ) |
| 62 | 62 | ->setRawData($stats) |
| 63 | - ->setSize((int)$stats['mem_size']); |
|
| 63 | + ->setSize((int) $stats['mem_size']); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | /** |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | * Check for Cross-Driver type confusion |
| 83 | 83 | */ |
| 84 | 84 | if ($item instanceof Item) { |
| 85 | - return (bool)apcu_store($item->getKey(), $this->driverPreWrap($item), $item->getTtl()); |
|
| 85 | + return (bool) apcu_store($item->getKey(), $this->driverPreWrap($item), $item->getTtl()); |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | throw new PhpfastcacheInvalidArgumentException('Cross-Driver type confusion detected'); |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | * Check for Cross-Driver type confusion |
| 115 | 115 | */ |
| 116 | 116 | if ($item instanceof Item) { |
| 117 | - return (bool)apcu_delete($item->getKey()); |
|
| 117 | + return (bool) apcu_delete($item->getKey()); |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | throw new PhpfastcacheInvalidArgumentException('Cross-Driver type confusion detected'); |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | */ |
| 152 | 152 | if ($item instanceof Item) { |
| 153 | 153 | try { |
| 154 | - return (bool)$this->getBucket()->upsert( |
|
| 154 | + return (bool) $this->getBucket()->upsert( |
|
| 155 | 155 | $item->getEncodedKey(), |
| 156 | 156 | $this->encode($this->driverPreWrap($item)), |
| 157 | 157 | ['expiry' => $item->getTtl()] |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | */ |
| 177 | 177 | if ($item instanceof Item) { |
| 178 | 178 | try { |
| 179 | - return (bool)$this->getBucket()->remove($item->getEncodedKey()); |
|
| 179 | + return (bool) $this->getBucket()->remove($item->getEncodedKey()); |
|
| 180 | 180 | } catch (Exception $e) { |
| 181 | 181 | return $e->getCode() === COUCHBASE_KEY_ENOENT; |
| 182 | 182 | } |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | { |
| 60 | 60 | return $this->getStandardizedItem( |
| 61 | 61 | $this->makeOperation( |
| 62 | - static function (ExtendedCacheItemPoolInterface $pool) use ($key) { |
|
| 62 | + static function(ExtendedCacheItemPoolInterface $pool) use ($key) { |
|
| 63 | 63 | return $pool->getItem($key); |
| 64 | 64 | } |
| 65 | 65 | ) ?? new Item($this, $key), |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | public function hasItem($key) |
| 113 | 113 | { |
| 114 | 114 | return $this->makeOperation( |
| 115 | - static function (ExtendedCacheItemPoolInterface $pool) use ($key) { |
|
| 115 | + static function(ExtendedCacheItemPoolInterface $pool) use ($key) { |
|
| 116 | 116 | return $pool->hasItem($key); |
| 117 | 117 | } |
| 118 | 118 | ); |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | public function clear() |
| 125 | 125 | { |
| 126 | 126 | return $this->makeOperation( |
| 127 | - static function (ExtendedCacheItemPoolInterface $pool) { |
|
| 127 | + static function(ExtendedCacheItemPoolInterface $pool) { |
|
| 128 | 128 | return $pool->clear(); |
| 129 | 129 | } |
| 130 | 130 | ); |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | public function deleteItem($key) |
| 137 | 137 | { |
| 138 | 138 | return $this->makeOperation( |
| 139 | - static function (ExtendedCacheItemPoolInterface $pool) use ($key) { |
|
| 139 | + static function(ExtendedCacheItemPoolInterface $pool) use ($key) { |
|
| 140 | 140 | return $pool->deleteItem($key); |
| 141 | 141 | } |
| 142 | 142 | ); |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | public function save(CacheItemInterface $item) |
| 149 | 149 | { |
| 150 | 150 | return $this->makeOperation( |
| 151 | - function (ExtendedCacheItemPoolInterface $pool) use ($item) { |
|
| 151 | + function(ExtendedCacheItemPoolInterface $pool) use ($item) { |
|
| 152 | 152 | $item->setHit(true); |
| 153 | 153 | return $pool->save($this->getStandardizedItem($item, $pool)); |
| 154 | 154 | } |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | public function commit() |
| 163 | 163 | { |
| 164 | 164 | return $this->makeOperation( |
| 165 | - static function (ExtendedCacheItemPoolInterface $pool) { |
|
| 165 | + static function(ExtendedCacheItemPoolInterface $pool) { |
|
| 166 | 166 | return $pool->commit(); |
| 167 | 167 | } |
| 168 | 168 | ); |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | \implode( |
| 201 | 201 | ', ', |
| 202 | 202 | \array_map( |
| 203 | - static function (ExtendedCacheItemPoolInterface $pool) { |
|
| 203 | + static function(ExtendedCacheItemPoolInterface $pool) { |
|
| 204 | 204 | return \get_class($pool); |
| 205 | 205 | }, |
| 206 | 206 | $this->clusterPools |
@@ -210,9 +210,9 @@ discard block |
||
| 210 | 210 | ); |
| 211 | 211 | |
| 212 | 212 | $stats->setSize( |
| 213 | - (int)\array_sum( |
|
| 213 | + (int) \array_sum( |
|
| 214 | 214 | \array_map( |
| 215 | - static function (ExtendedCacheItemPoolInterface $pool) { |
|
| 215 | + static function(ExtendedCacheItemPoolInterface $pool) { |
|
| 216 | 216 | return $pool->getStats()->getSize(); |
| 217 | 217 | }, |
| 218 | 218 | $this->clusterPools |
@@ -221,8 +221,8 @@ discard block |
||
| 221 | 221 | ); |
| 222 | 222 | |
| 223 | 223 | $stats->setData( |
| 224 | - (int)\array_map( |
|
| 225 | - static function (ExtendedCacheItemPoolInterface $pool) { |
|
| 224 | + (int) \array_map( |
|
| 225 | + static function(ExtendedCacheItemPoolInterface $pool) { |
|
| 226 | 226 | return $pool->getStats()->getData(); |
| 227 | 227 | }, |
| 228 | 228 | $this->clusterPools |
@@ -233,7 +233,7 @@ |
||
| 233 | 233 | */ |
| 234 | 234 | protected function decode($value) |
| 235 | 235 | { |
| 236 | - return \unserialize((string)$value, ['allowed_classes' => true]); |
|
| 236 | + return \unserialize((string) $value, ['allowed_classes' => true]); |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | /** |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | public function getItemsByTagsAsJsonString(array $tagNames, int $option = 0, int $depth = 512, int $strategy = TaggableCacheItemPoolInterface::TAG_STRATEGY_ONE): string |
| 36 | 36 | { |
| 37 | - $callback = static function (CacheItemInterface $item) { |
|
| 37 | + $callback = static function(CacheItemInterface $item) { |
|
| 38 | 38 | return $item->get(); |
| 39 | 39 | }; |
| 40 | 40 | |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | if (\is_string($tagName)) { |
| 88 | 88 | $driverResponse = $this->getItem($this->getTagKey($tagName)); |
| 89 | 89 | if ($driverResponse->isHit()) { |
| 90 | - $tagsItems = (array)$driverResponse->get(); |
|
| 90 | + $tagsItems = (array) $driverResponse->get(); |
|
| 91 | 91 | |
| 92 | 92 | /** |
| 93 | 93 | * getItems() may provides expired item(s) |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | */ |
| 102 | 102 | return \array_filter( |
| 103 | 103 | $this->getItems(\array_unique(\array_keys($tagsItems))), |
| 104 | - static function (ExtendedCacheItemInterface $item) { |
|
| 104 | + static function(ExtendedCacheItemInterface $item) { |
|
| 105 | 105 | return $item->isHit(); |
| 106 | 106 | } |
| 107 | 107 | ); |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | } |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | - return (bool)$return; |
|
| 137 | + return (bool) $return; |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | /** |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | } |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | - return (bool)$return; |
|
| 154 | + return (bool) $return; |
|
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | throw new PhpfastcacheInvalidArgumentException('$tagName must be a string'); |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | } |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | - return (bool)$return; |
|
| 189 | + return (bool) $return; |
|
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | /** |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | $this->saveDeferred($item); |
| 201 | 201 | } |
| 202 | 202 | |
| 203 | - return (bool)$this->commit(); |
|
| 203 | + return (bool) $this->commit(); |
|
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | throw new PhpfastcacheInvalidArgumentException('$tagName must be a string and $step an integer'); |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | } |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | - return (bool)$return; |
|
| 222 | + return (bool) $return; |
|
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | /** |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | $this->saveDeferred($item); |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | - return (bool)$this->commit(); |
|
| 236 | + return (bool) $this->commit(); |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | throw new PhpfastcacheInvalidArgumentException('$tagName must be a string and $step an integer'); |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | } |
| 253 | 253 | } |
| 254 | 254 | |
| 255 | - return (bool)$return; |
|
| 255 | + return (bool) $return; |
|
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | /** |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | $this->saveDeferred($item); |
| 267 | 267 | } |
| 268 | 268 | |
| 269 | - return (bool)$this->commit(); |
|
| 269 | + return (bool) $this->commit(); |
|
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | throw new PhpfastcacheInvalidArgumentException('$tagName must be a string'); |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | } |
| 286 | 286 | } |
| 287 | 287 | |
| 288 | - return (bool)$return; |
|
| 288 | + return (bool) $return; |
|
| 289 | 289 | } |
| 290 | 290 | |
| 291 | 291 | /** |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | $this->saveDeferred($item); |
| 300 | 300 | } |
| 301 | 301 | |
| 302 | - return (bool)$this->commit(); |
|
| 302 | + return (bool) $this->commit(); |
|
| 303 | 303 | } |
| 304 | 304 | |
| 305 | 305 | throw new PhpfastcacheInvalidArgumentException('$tagName must be a string'); |
@@ -360,7 +360,7 @@ discard block |
||
| 360 | 360 | * that has slow performances |
| 361 | 361 | */ |
| 362 | 362 | |
| 363 | - $tagsItem->set(\array_merge((array)$data, [$item->getKey() => $expTimestamp])); |
|
| 363 | + $tagsItem->set(\array_merge((array) $data, [$item->getKey() => $expTimestamp])); |
|
| 364 | 364 | |
| 365 | 365 | /** |
| 366 | 366 | * Set the expiration date |
@@ -382,7 +382,7 @@ discard block |
||
| 382 | 382 | $tagsItems = $this->getItems($this->getTagKeys($item->getRemovedTags())); |
| 383 | 383 | |
| 384 | 384 | foreach ($tagsItems as $tagsItem) { |
| 385 | - $data = (array)$tagsItem->get(); |
|
| 385 | + $data = (array) $tagsItem->get(); |
|
| 386 | 386 | |
| 387 | 387 | unset($data[$item->getKey()]); |
| 388 | 388 | $tagsItem->set($data); |
@@ -413,7 +413,7 @@ discard block |
||
| 413 | 413 | protected function getTagKeys(array $keys): array |
| 414 | 414 | { |
| 415 | 415 | return \array_map( |
| 416 | - function (string $key) { |
|
| 416 | + function(string $key) { |
|
| 417 | 417 | return $this->getTagKey($key); |
| 418 | 418 | }, |
| 419 | 419 | $keys |