@@ -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; |
@@ -89,8 +89,7 @@ discard block |
||
| 89 | 89 | return \unlink($source); |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - $files = new RecursiveIteratorIterator |
|
| 93 | - ( |
|
| 92 | + $files = new RecursiveIteratorIterator( |
|
| 94 | 93 | new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS), |
| 95 | 94 | RecursiveIteratorIterator::CHILD_FIRST |
| 96 | 95 | ); |
@@ -142,7 +141,7 @@ discard block |
||
| 142 | 141 | /** |
| 143 | 142 | * Allows to dereference char |
| 144 | 143 | */ |
| 145 | - $__FILE__ = \preg_replace('~^(([a-z0-9\-]+)://)~', '', __FILE__);// remove file protocols such as "phar://" etc. |
|
| 144 | + $__FILE__ = \preg_replace('~^(([a-z0-9\-]+)://)~', '', __FILE__); // remove file protocols such as "phar://" etc. |
|
| 146 | 145 | $prefix = $__FILE__[0] === \DIRECTORY_SEPARATOR ? \DIRECTORY_SEPARATOR : ''; |
| 147 | 146 | return $prefix . \implode(\DIRECTORY_SEPARATOR, $absolutes); |
| 148 | 147 | } |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | /** |
| 28 | 28 | * Register Autoload |
| 29 | 29 | */ |
| 30 | -\spl_autoload_register(function ($entity) { |
|
| 30 | +\spl_autoload_register(function($entity) { |
|
| 31 | 31 | $module = \explode('\\', $entity, 2); |
| 32 | 32 | if (!\in_array($module[0], ['Phpfastcache', 'Psr'])) { |
| 33 | 33 | /** |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | */ |
| 40 | 40 | public function __construct() |
| 41 | 41 | { |
| 42 | - $this->instances =& CacheManager::getInternalInstances(); |
|
| 42 | + $this->instances = & CacheManager::getInternalInstances(); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | /** |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | */ |
| 48 | 48 | protected function getGenericCallback(): \Closure |
| 49 | 49 | { |
| 50 | - return function ($method, $args) { |
|
| 50 | + return function($method, $args) { |
|
| 51 | 51 | $return = []; |
| 52 | 52 | foreach ($this->instances as $instance) { |
| 53 | 53 | $reflectionMethod = new \ReflectionMethod(\get_class($instance), $method); |
@@ -133,7 +133,7 @@ |
||
| 133 | 133 | public function getMultiple($keys, $default = null) |
| 134 | 134 | { |
| 135 | 135 | try { |
| 136 | - return array_map(function (ExtendedCacheItemInterface $item) { |
|
| 136 | + return array_map(function(ExtendedCacheItemInterface $item) { |
|
| 137 | 137 | return $item->get(); |
| 138 | 138 | }, $this->internalCacheInstance->getItems($keys)); |
| 139 | 139 | } catch (PhpfastcacheInvalidArgumentException $e) { |
@@ -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 | } |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | * Reset the Item |
| 156 | 156 | */ |
| 157 | 157 | $item->set(null) |
| 158 | - ->expiresAfter(\abs((int)$this->getConfig()['defaultTtl'])) |
|
| 158 | + ->expiresAfter(\abs((int) $this->getConfig()['defaultTtl'])) |
|
| 159 | 159 | ->setHit(false) |
| 160 | 160 | ->setTags([]); |
| 161 | 161 | if ($this->getConfig()->isItemDetailedDate()) { |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | $item->setHit(true); |
| 173 | 173 | } |
| 174 | 174 | } else { |
| 175 | - $item->expiresAfter(\abs((int)$this->getConfig()['defaultTtl'])); |
|
| 175 | + $item->expiresAfter(\abs((int) $this->getConfig()['defaultTtl'])); |
|
| 176 | 176 | } |
| 177 | 177 | } |
| 178 | 178 | } |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | } |
| 303 | 303 | } |
| 304 | 304 | |
| 305 | - return (bool)$return; |
|
| 305 | + return (bool) $return; |
|
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | /** |
@@ -415,6 +415,6 @@ discard block |
||
| 415 | 415 | } |
| 416 | 416 | } |
| 417 | 417 | |
| 418 | - return (bool)$return; |
|
| 418 | + return (bool) $return; |
|
| 419 | 419 | } |
| 420 | 420 | } |
| 421 | 421 | \ No newline at end of file |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | */ |
| 133 | 133 | protected function decode($value) |
| 134 | 134 | { |
| 135 | - return \unserialize((string)$value); |
|
| 135 | + return \unserialize((string) $value); |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | /** |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | * that has slow performances |
| 273 | 273 | */ |
| 274 | 274 | |
| 275 | - $tagsItem->set(\array_merge((array)$data, [$item->getKey() => $expTimestamp])); |
|
| 275 | + $tagsItem->set(\array_merge((array) $data, [$item->getKey() => $expTimestamp])); |
|
| 276 | 276 | |
| 277 | 277 | /** |
| 278 | 278 | * Set the expiration date |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | $tagsItems = $this->getItems($this->getTagKeys($item->getRemovedTags())); |
| 295 | 295 | |
| 296 | 296 | foreach ($tagsItems as $tagsItem) { |
| 297 | - $data = (array)$tagsItem->get(); |
|
| 297 | + $data = (array) $tagsItem->get(); |
|
| 298 | 298 | |
| 299 | 299 | unset($data[$item->getKey()]); |
| 300 | 300 | $tagsItem->set($data); |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | */ |
| 37 | 37 | public function getItemsAsJsonString(array $keys = [], $option = 0, $depth = 512): string |
| 38 | 38 | { |
| 39 | - $callback = function (CacheItemInterface $item) { |
|
| 39 | + $callback = function(CacheItemInterface $item) { |
|
| 40 | 40 | return $item->get(); |
| 41 | 41 | }; |
| 42 | 42 | return \json_encode(\array_map($callback, \array_values($this->getItems($keys))), $option, $depth); |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | if (\is_string($tagName)) { |
| 51 | 51 | $driverResponse = $this->getItem($this->getTagKey($tagName)); |
| 52 | 52 | if ($driverResponse->isHit()) { |
| 53 | - $items = (array)$driverResponse->get(); |
|
| 53 | + $items = (array) $driverResponse->get(); |
|
| 54 | 54 | |
| 55 | 55 | /** |
| 56 | 56 | * getItems() may provides expired item(s) |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | * |
| 63 | 63 | * #headache |
| 64 | 64 | */ |
| 65 | - return \array_filter($this->getItems(\array_unique(\array_keys($items))), function (ExtendedCacheItemInterface $item) { |
|
| 65 | + return \array_filter($this->getItems(\array_unique(\array_keys($items))), function(ExtendedCacheItemInterface $item) { |
|
| 66 | 66 | return $item->isHit(); |
| 67 | 67 | }); |
| 68 | 68 | } |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | */ |
| 113 | 113 | public function getItemsByTagsAsJsonString(array $tagNames, $option = 0, $depth = 512) |
| 114 | 114 | { |
| 115 | - $callback = function (CacheItemInterface $item) { |
|
| 115 | + $callback = function(CacheItemInterface $item) { |
|
| 116 | 116 | return $item->get(); |
| 117 | 117 | }; |
| 118 | 118 | |