@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | public function setItem(CacheItemInterface $item) |
| 67 | 67 | { |
| 68 | 68 | if ($this->getClassNamespace() . '\\Item' === \get_class($item)) { |
| 69 | - if(!$this->getConfig()->isUseStaticItemCaching()){ |
|
| 69 | + if (!$this->getConfig()->isUseStaticItemCaching()) { |
|
| 70 | 70 | throw new PhpfastcacheLogicException( |
| 71 | 71 | 'The static item caching option (useStaticItemCaching) is disabled so you cannot attach an item.' |
| 72 | 72 | ); |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | * Reset the Item |
| 209 | 209 | */ |
| 210 | 210 | $item->set(null) |
| 211 | - ->expiresAfter(abs((int)$this->getConfig()['defaultTtl'])) |
|
| 211 | + ->expiresAfter(abs((int) $this->getConfig()['defaultTtl'])) |
|
| 212 | 212 | ->setHit(false) |
| 213 | 213 | ->setTags([]); |
| 214 | 214 | if ($this->getConfig()->isItemDetailedDate()) { |
@@ -224,15 +224,15 @@ discard block |
||
| 224 | 224 | $item->setHit(true); |
| 225 | 225 | } |
| 226 | 226 | } else { |
| 227 | - $item->expiresAfter(abs((int)$this->getConfig()['defaultTtl'])); |
|
| 227 | + $item->expiresAfter(abs((int) $this->getConfig()['defaultTtl'])); |
|
| 228 | 228 | } |
| 229 | 229 | } |
| 230 | - }else{ |
|
| 230 | + } else { |
|
| 231 | 231 | $item = $this->itemInstances[$key]; |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | |
| 235 | - if($item !== null){ |
|
| 235 | + if ($item !== null) { |
|
| 236 | 236 | /** |
| 237 | 237 | * @eventName CacheGetItem |
| 238 | 238 | * @param $this ExtendedCacheItemPoolInterface |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | } |
| 294 | 294 | } |
| 295 | 295 | |
| 296 | - return (bool)$return; |
|
| 296 | + return (bool) $return; |
|
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | /** |
@@ -381,7 +381,7 @@ discard block |
||
| 381 | 381 | } |
| 382 | 382 | } |
| 383 | 383 | |
| 384 | - return (bool)$return; |
|
| 384 | + return (bool) $return; |
|
| 385 | 385 | } |
| 386 | 386 | |
| 387 | 387 | /** |
@@ -401,7 +401,7 @@ discard block |
||
| 401 | 401 | * loop dispatching operations |
| 402 | 402 | */ |
| 403 | 403 | if (!isset($this->itemInstances[$item->getKey()])) { |
| 404 | - if($this->getConfig()->isUseStaticItemCaching()){ |
|
| 404 | + if ($this->getConfig()->isUseStaticItemCaching()) { |
|
| 405 | 405 | $this->itemInstances[$item->getKey()] = $item; |
| 406 | 406 | } |
| 407 | 407 | } else { |
@@ -227,7 +227,7 @@ |
||
| 227 | 227 | $item->expiresAfter(abs((int)$this->getConfig()['defaultTtl'])); |
| 228 | 228 | } |
| 229 | 229 | } |
| 230 | - }else{ |
|
| 230 | + } else{ |
|
| 231 | 231 | $item = $this->itemInstances[$key]; |
| 232 | 232 | } |
| 233 | 233 | |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | public function getItemsAsJsonString(array $keys = [], int $option = 0, int $depth = 512): string |
| 42 | 42 | { |
| 43 | - $callback = static function (CacheItemInterface $item) { |
|
| 43 | + $callback = static function(CacheItemInterface $item) { |
|
| 44 | 44 | return $item->get(); |
| 45 | 45 | }; |
| 46 | 46 | return \json_encode(\array_map($callback, \array_values($this->getItems($keys))), $option, $depth); |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | ); |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - if(!$this->getConfig()->isUseStaticItemCaching()){ |
|
| 94 | + if (!$this->getConfig()->isUseStaticItemCaching()) { |
|
| 95 | 95 | throw new PhpfastcacheLogicException( |
| 96 | 96 | 'The static item caching option (useStaticItemCaching) is disabled so you cannot attach an item.' |
| 97 | 97 | ); |
@@ -64,9 +64,9 @@ discard block |
||
| 64 | 64 | ->setSize(Directory::dirSize($path)) |
| 65 | 65 | ->setInfo('Number of files used to build the cache: ' . Directory::getFileCount($path)); |
| 66 | 66 | |
| 67 | - if($this->getConfig()->isUseStaticItemCaching()){ |
|
| 67 | + if ($this->getConfig()->isUseStaticItemCaching()) { |
|
| 68 | 68 | $stat->setData(implode(', ', \array_keys($this->itemInstances))); |
| 69 | - }else{ |
|
| 69 | + } else { |
|
| 70 | 70 | $stat->setData('No data available since static item caching option (useStaticItemCaching) is disabled.'); |
| 71 | 71 | } |
| 72 | 72 | |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | protected function readFile($file): string |
| 292 | 292 | { |
| 293 | 293 | if (\function_exists('file_get_contents')) { |
| 294 | - return (string)\file_get_contents($file); |
|
| 294 | + return (string) \file_get_contents($file); |
|
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | $string = ''; |
@@ -360,6 +360,6 @@ discard block |
||
| 360 | 360 | } |
| 361 | 361 | } |
| 362 | 362 | |
| 363 | - return (bool)($octetWritten ?? false); |
|
| 363 | + return (bool) ($octetWritten ?? false); |
|
| 364 | 364 | } |
| 365 | 365 | } |
@@ -66,7 +66,7 @@ |
||
| 66 | 66 | |
| 67 | 67 | if($this->getConfig()->isUseStaticItemCaching()){ |
| 68 | 68 | $stat->setData(implode(', ', \array_keys($this->itemInstances))); |
| 69 | - }else{ |
|
| 69 | + } else{ |
|
| 70 | 70 | $stat->setData('No data available since static item caching option (useStaticItemCaching) is disabled.'); |
| 71 | 71 | } |
| 72 | 72 | |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | if (\is_string($key)) { |
| 67 | 67 | $this->key = $key; |
| 68 | 68 | $this->driver = $driver; |
| 69 | - if($driver->getConfig()->isUseStaticItemCaching()){ |
|
| 69 | + if ($driver->getConfig()->isUseStaticItemCaching()) { |
|
| 70 | 70 | $this->driver->setItem($this); |
| 71 | 71 | } |
| 72 | 72 | $this->expirationDate = new DateTime(); |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | $this->data[] = $data; |
| 283 | 283 | } else { |
| 284 | 284 | if (\is_string($data)) { |
| 285 | - $this->data .= (string)$data; |
|
| 285 | + $this->data .= (string) $data; |
|
| 286 | 286 | } else { |
| 287 | 287 | throw new PhpfastcacheInvalidArgumentException('$data must be either array nor string.'); |
| 288 | 288 | } |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | \array_unshift($this->data, $data); |
| 304 | 304 | } else { |
| 305 | 305 | if (\is_string($data)) { |
| 306 | - $this->data = (string)$data . $this->data; |
|
| 306 | + $this->data = (string) $data . $this->data; |
|
| 307 | 307 | } else { |
| 308 | 308 | throw new PhpfastcacheInvalidArgumentException('$data must be either array nor string.'); |
| 309 | 309 | } |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | $config = self::validateConfig($config); |
| 178 | 178 | $driver = self::standardizeDriverName($driver); |
| 179 | 179 | |
| 180 | - $instanceId = $instanceId ?: md5($driver . serialize(\array_filter($config->toArray(), static function ($val){ |
|
| 180 | + $instanceId = $instanceId ?: md5($driver . serialize(\array_filter($config->toArray(), static function($val) { |
|
| 181 | 181 | return !\is_callable($val); |
| 182 | 182 | }))); |
| 183 | 183 | |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | $found = false; |
| 321 | 321 | self::$instances = \array_filter( |
| 322 | 322 | \array_map( |
| 323 | - static function (ExtendedCacheItemPoolInterface $cachePool) use ($cachePoolInstance, &$found) { |
|
| 323 | + static function(ExtendedCacheItemPoolInterface $cachePool) use ($cachePoolInstance, &$found) { |
|
| 324 | 324 | if (\spl_object_hash($cachePool) === \spl_object_hash($cachePoolInstance)) { |
| 325 | 325 | $found = true; |
| 326 | 326 | return null; |
@@ -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 | ); |