@@ -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 |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | use Phpfastcache\Core\Pool\{DriverBaseTrait, ExtendedCacheItemPoolInterface}; |
| 19 | 19 | use Phpfastcache\Entities\DriverStatistic; |
| 20 | 20 | use Phpfastcache\Exceptions\{ |
| 21 | - PhpfastcacheInvalidArgumentException, PhpfastcacheDriverException |
|
| 21 | + PhpfastcacheInvalidArgumentException, PhpfastcacheDriverException |
|
| 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\Cookie; |
| 17 | 17 | |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | { |
| 60 | 60 | $this->driverConnect(); |
| 61 | 61 | $keyword = self::PREFIX . $item->getKey(); |
| 62 | - $x = isset($_COOKIE[ $keyword ]) ? \json_decode($_COOKIE[ $keyword ], true) : false; |
|
| 62 | + $x = isset($_COOKIE[$keyword]) ? \json_decode($_COOKIE[$keyword], true) : false; |
|
| 63 | 63 | |
| 64 | 64 | if ($x == false) { |
| 65 | 65 | return null; |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | { |
| 105 | 105 | $this->driverConnect(); |
| 106 | 106 | $keyword = self::PREFIX . $key; |
| 107 | - $x = isset($_COOKIE[ $keyword ]) ? $this->decode(\json_decode($_COOKIE[ $keyword ])->t) : 0; |
|
| 107 | + $x = isset($_COOKIE[$keyword]) ? $this->decode(\json_decode($_COOKIE[$keyword])->t) : 0; |
|
| 108 | 108 | |
| 109 | 109 | return $x ? $x - \time() : $x; |
| 110 | 110 | } |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | if ($item instanceof Item) { |
| 123 | 123 | $this->driverConnect(); |
| 124 | 124 | $keyword = self::PREFIX . $item->getKey(); |
| 125 | - $_COOKIE[ $keyword ] = null; |
|
| 125 | + $_COOKIE[$keyword] = null; |
|
| 126 | 126 | |
| 127 | 127 | return @setcookie($keyword, null, -10); |
| 128 | 128 | } |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | $this->driverConnect(); |
| 140 | 140 | foreach ($_COOKIE as $keyword => $value) { |
| 141 | 141 | if (\strpos($keyword, self::PREFIX) !== false) { |
| 142 | - $_COOKIE[ $keyword ] = null; |
|
| 142 | + $_COOKIE[$keyword] = null; |
|
| 143 | 143 | $result = @setcookie($keyword, null, -10); |
| 144 | 144 | if ($return !== false) { |
| 145 | 145 | $return = $result; |
@@ -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\Exceptions; |
| 17 | 17 | |
@@ -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\Exceptions; |
| 17 | 17 | |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | public function __construct($message = "", $code = 0, $previous = null) |
| 29 | 29 | { |
| 30 | 30 | $lastError = error_get_last(); |
| 31 | - if($lastError){ |
|
| 31 | + if ($lastError) { |
|
| 32 | 32 | $message .= "\n"; |
| 33 | 33 | $message .= "Additional information provided by error_get_last():\n"; |
| 34 | 34 | $message .= "{$lastError['message']} in {$lastError['file']} line {$lastError['line']}"; |
@@ -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\Core\Pool\IO; |
| 17 | 17 | |
@@ -54,8 +54,8 @@ discard block |
||
| 54 | 54 | { |
| 55 | 55 | $securityKey = \array_key_exists('securityKey', $this->config) ? $this->config->getOption('securityKey') : ''; |
| 56 | 56 | if (!$securityKey || mb_strtolower($securityKey) === 'auto') { |
| 57 | - if (isset($_SERVER[ 'HTTP_HOST' ])) { |
|
| 58 | - $securityKey = preg_replace('/^www./', '', \strtolower(\str_replace(':', '_', $_SERVER[ 'HTTP_HOST' ]))); |
|
| 57 | + if (isset($_SERVER['HTTP_HOST'])) { |
|
| 58 | + $securityKey = preg_replace('/^www./', '', \strtolower(\str_replace(':', '_', $_SERVER['HTTP_HOST']))); |
|
| 59 | 59 | } else { |
| 60 | 60 | $securityKey = ($this->isPHPModule() ? 'web' : 'cli'); |
| 61 | 61 | } |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | return $full_path; |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | - if (!isset($this->tmp[ $full_path_hash ]) || (!@\file_exists($full_path) || !@\is_writable($full_path))) { |
|
| 101 | + if (!isset($this->tmp[$full_path_hash]) || (!@\file_exists($full_path) || !@\is_writable($full_path))) { |
|
| 102 | 102 | if (!@\file_exists($full_path)) { |
| 103 | 103 | @mkdir($full_path, $this->getDefaultChmod(), true); |
| 104 | 104 | } else if (!@\is_writable($full_path)) { |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | throw new PhpfastcacheIOException('Path "' . $full_path . '" is not writable, please set a chmod 0777 or any writable permission and make sure to make use of an absolute path !'); |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - $this->tmp[ $full_path_hash ] = $full_path; |
|
| 126 | + $this->tmp[$full_path_hash] = $full_path; |
|
| 127 | 127 | $this->htaccessGen($full_path, \array_key_exists('htaccess', $this->config) ? $this->config->getOption('htaccess') : false); |
| 128 | 128 | } |
| 129 | 129 | |
@@ -192,9 +192,9 @@ discard block |
||
| 192 | 192 | protected static function cleanFileName($filename): string |
| 193 | 193 | { |
| 194 | 194 | $regex = [ |
| 195 | - '/[\?\[\]\/\\\=\<\>\:\;\,\'\"\&\$\#\*\(\)\|\~\`\!\{\}]/', |
|
| 196 | - '/\.$/', |
|
| 197 | - '/^\./', |
|
| 195 | + '/[\?\[\]\/\\\=\<\>\:\;\,\'\"\&\$\#\*\(\)\|\~\`\!\{\}]/', |
|
| 196 | + '/\.$/', |
|
| 197 | + '/^\./', |
|
| 198 | 198 | ]; |
| 199 | 199 | $replace = ['-', '', '']; |
| 200 | 200 | |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | $tmpFilename = Directory::getAbsolutePath(\dirname($file) . '/tmp_' . \md5( |
| 291 | 291 | \str_shuffle(\uniqid($this->getDriverName(), false)) |
| 292 | 292 | . \str_shuffle(\uniqid($this->getDriverName(), false)) |
| 293 | - )); |
|
| 293 | + )); |
|
| 294 | 294 | |
| 295 | 295 | $f = \fopen($tmpFilename, 'w+'); |
| 296 | 296 | \flock($f, LOCK_EX); |
@@ -332,11 +332,11 @@ discard block |
||
| 332 | 332 | } |
| 333 | 333 | |
| 334 | 334 | $stat->setData(\implode(', ', \array_keys($this->itemInstances))) |
| 335 | - ->setRawData([ |
|
| 335 | + ->setRawData([ |
|
| 336 | 336 | 'tmp' => $this->tmp, |
| 337 | - ]) |
|
| 338 | - ->setSize(Directory::dirSize($path)) |
|
| 339 | - ->setInfo('Number of files used to build the cache: ' . Directory::getFileCount($path)); |
|
| 337 | + ]) |
|
| 338 | + ->setSize(Directory::dirSize($path)) |
|
| 339 | + ->setInfo('Number of files used to build the cache: ' . Directory::getFileCount($path)); |
|
| 340 | 340 | |
| 341 | 341 | return $stat; |
| 342 | 342 | } |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | use Phpfastcache\Core\Item\ExtendedCacheItemInterface; |
| 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 | |
@@ -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\Core\Pool; |
| 17 | 17 | |
@@ -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 | } |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | |
| 100 | 100 | foreach ($items as $key => $item) { |
| 101 | 101 | if (\array_diff($tagNames, $item->getTags())) { |
| 102 | - unset($items[ $key ]); |
|
| 102 | + unset($items[$key]); |
|
| 103 | 103 | } |
| 104 | 104 | } |
| 105 | 105 | |
@@ -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 | |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | */ |
| 384 | 384 | public function detachItem(CacheItemInterface $item) |
| 385 | 385 | { |
| 386 | - if (isset($this->itemInstances[ $item->getKey() ])) { |
|
| 386 | + if (isset($this->itemInstances[$item->getKey()])) { |
|
| 387 | 387 | $this->deregisterItem($item); |
| 388 | 388 | } |
| 389 | 389 | } |
@@ -403,11 +403,11 @@ discard block |
||
| 403 | 403 | */ |
| 404 | 404 | public function attachItem(CacheItemInterface $item) |
| 405 | 405 | { |
| 406 | - if (isset($this->itemInstances[ $item->getKey() ]) && \spl_object_hash($item) !== \spl_object_hash($this->itemInstances[ $item->getKey() ])) { |
|
| 406 | + if (isset($this->itemInstances[$item->getKey()]) && \spl_object_hash($item) !== \spl_object_hash($this->itemInstances[$item->getKey()])) { |
|
| 407 | 407 | throw new PhpfastcacheLogicException('The item already exists and cannot be overwritten because the Spl object hash mismatches ! You probably tried to re-attach a detached item which has been already retrieved from cache.'); |
| 408 | 408 | } |
| 409 | 409 | |
| 410 | - $this->itemInstances[ $item->getKey() ] = $item; |
|
| 410 | + $this->itemInstances[$item->getKey()] = $item; |
|
| 411 | 411 | } |
| 412 | 412 | |
| 413 | 413 | |
@@ -419,10 +419,10 @@ discard block |
||
| 419 | 419 | protected function deregisterItem($item) |
| 420 | 420 | { |
| 421 | 421 | if ($item instanceof CacheItemInterface) { |
| 422 | - unset($this->itemInstances[ $item->getKey() ]); |
|
| 422 | + unset($this->itemInstances[$item->getKey()]); |
|
| 423 | 423 | |
| 424 | 424 | } else if (\is_string($item)) { |
| 425 | - unset($this->itemInstances[ $item ]); |
|
| 425 | + unset($this->itemInstances[$item]); |
|
| 426 | 426 | } else { |
| 427 | 427 | throw new PhpfastcacheInvalidArgumentException('Invalid type for $item variable'); |
| 428 | 428 | } |
@@ -449,8 +449,8 @@ discard block |
||
| 449 | 449 | */ |
| 450 | 450 | public function isAttached(CacheItemInterface $item) |
| 451 | 451 | { |
| 452 | - if (isset($this->itemInstances[ $item->getKey() ])) { |
|
| 453 | - return \spl_object_hash($item) === \spl_object_hash($this->itemInstances[ $item->getKey() ]); |
|
| 452 | + if (isset($this->itemInstances[$item->getKey()])) { |
|
| 453 | + return \spl_object_hash($item) === \spl_object_hash($this->itemInstances[$item->getKey()]); |
|
| 454 | 454 | } |
| 455 | 455 | return null; |
| 456 | 456 | } |
@@ -473,8 +473,8 @@ discard block |
||
| 473 | 473 | */ |
| 474 | 474 | public function saveMultiple(...$items): bool |
| 475 | 475 | { |
| 476 | - if (isset($items[ 0 ]) && \is_array($items[ 0 ])) { |
|
| 477 | - foreach ($items[ 0 ] as $item) { |
|
| 476 | + if (isset($items[0]) && \is_array($items[0])) { |
|
| 477 | + foreach ($items[0] as $item) { |
|
| 478 | 478 | $this->save($item); |
| 479 | 479 | } |
| 480 | 480 | return true; |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | use Phpfastcache\Core\Pool\ExtendedCacheItemPoolInterface; |
| 19 | 19 | use Phpfastcache\EventManager; |
| 20 | 20 | use Phpfastcache\Exceptions\{ |
| 21 | - PhpfastcacheInvalidArgumentException, PhpfastcacheInvalidArgumentTypeException, PhpfastcacheLogicException |
|
| 21 | + PhpfastcacheInvalidArgumentException, PhpfastcacheInvalidArgumentTypeException, PhpfastcacheLogicException |
|
| 22 | 22 | }; |
| 23 | 23 | |
| 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\Core\Item; |
| 17 | 17 | |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | $this->driver = $driver; |
| 71 | 71 | $this->driver->setItem($this); |
| 72 | 72 | $this->expirationDate = new \DateTime(); |
| 73 | - if($this->driver->getConfigOption('itemDetailedDate')){ |
|
| 73 | + if ($this->driver->getConfigOption('itemDetailedDate')) { |
|
| 74 | 74 | $this->creationDate = new \DateTime(); |
| 75 | 75 | $this->modificationDate = new \DateTime(); |
| 76 | 76 | } |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | { |
| 233 | 233 | case 'array': |
| 234 | 234 | case 'object': |
| 235 | - if(\is_array($this->data) || $this->data instanceof \Countable){ |
|
| 235 | + if (\is_array($this->data) || $this->data instanceof \Countable) { |
|
| 236 | 236 | return \count($this->data); |
| 237 | 237 | } |
| 238 | 238 | break; |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | if (\is_array($this->data)) { |
| 291 | 291 | $this->data[] = $data; |
| 292 | 292 | } else if (\is_string($data)) { |
| 293 | - $this->data .= (string)$data; |
|
| 293 | + $this->data .= (string) $data; |
|
| 294 | 294 | } else { |
| 295 | 295 | throw new PhpfastcacheInvalidArgumentException('$data must be either array nor string.'); |
| 296 | 296 | } |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | if (\is_array($this->data)) { |
| 310 | 310 | \array_unshift($this->data, $data); |
| 311 | 311 | } else if (\is_string($data)) { |
| 312 | - $this->data = (string)$data . $this->data; |
|
| 312 | + $this->data = (string) $data . $this->data; |
|
| 313 | 313 | } else { |
| 314 | 314 | throw new PhpfastcacheInvalidArgumentException('$data must be either array nor string.'); |
| 315 | 315 | } |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | public function removeTag($tagName): ExtendedCacheItemInterface |
| 389 | 389 | { |
| 390 | 390 | if (($key = array_search($tagName, $this->tags)) !== false) { |
| 391 | - unset($this->tags[ $key ]); |
|
| 391 | + unset($this->tags[$key]); |
|
| 392 | 392 | $this->removedTags[] = $tagName; |
| 393 | 393 | } |
| 394 | 394 | |
@@ -467,8 +467,8 @@ discard block |
||
| 467 | 467 | final public function __debugInfo() |
| 468 | 468 | { |
| 469 | 469 | $info = \get_object_vars($this); |
| 470 | - $info[ 'driver' ] = 'object(' . \get_class($info[ 'driver' ]) . ')'; |
|
| 470 | + $info['driver'] = 'object(' . \get_class($info['driver']) . ')'; |
|
| 471 | 471 | |
| 472 | - return (array)$info; |
|
| 472 | + return (array) $info; |
|
| 473 | 473 | } |
| 474 | 474 | } |
| 475 | 475 | \ No newline at end of file |