@@ -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 @@ |
||
| 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 @@ |
||
| 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 @@ |
||
| 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; |
| 17 | 17 | |
@@ -64,29 +64,29 @@ discard block |
||
| 64 | 64 | */ |
| 65 | 65 | static $version; |
| 66 | 66 | |
| 67 | - if($version && $cacheable){ |
|
| 67 | + if ($version && $cacheable) { |
|
| 68 | 68 | return $version; |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - if(\function_exists('shell_exec')){ |
|
| 71 | + if (\function_exists('shell_exec')) { |
|
| 72 | 72 | $stdout = shell_exec('git describe --abbrev=0 --tags'); |
| 73 | - if(\is_string($stdout)){ |
|
| 73 | + if (\is_string($stdout)) { |
|
| 74 | 74 | $version = \trim($stdout); |
| 75 | 75 | return $version; |
| 76 | 76 | } |
| 77 | 77 | throw new PhpfastcacheLogicException('The git command used to retrieve the PhpFastCache version has failed.'); |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - if(!$fallbackOnChangelog){ |
|
| 80 | + if (!$fallbackOnChangelog) { |
|
| 81 | 81 | throw new PhpfastcacheLogicException('shell_exec is disabled therefore the PhpFastCache version cannot be retrieved.'); |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | $changelogFilename = __DIR__ . '/../../CHANGELOG.md'; |
| 85 | - if(\file_exists($changelogFilename)){ |
|
| 85 | + if (\file_exists($changelogFilename)) { |
|
| 86 | 86 | $versionPrefix = '## '; |
| 87 | 87 | $changelog = \explode("\n", self::getPhpFastCacheChangelog()); |
| 88 | - foreach ($changelog as $line){ |
|
| 89 | - if(\strpos($line, $versionPrefix) === 0){ |
|
| 88 | + foreach ($changelog as $line) { |
|
| 89 | + if (\strpos($line, $versionPrefix) === 0) { |
|
| 90 | 90 | $version = \trim(\str_replace($versionPrefix, '', $line)); |
| 91 | 91 | return $version; |
| 92 | 92 | } |
@@ -104,13 +104,13 @@ discard block |
||
| 104 | 104 | { |
| 105 | 105 | static $hash; |
| 106 | 106 | |
| 107 | - if($hash && $cacheable){ |
|
| 107 | + if ($hash && $cacheable) { |
|
| 108 | 108 | return $hash; |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - if(\function_exists('shell_exec')){ |
|
| 111 | + if (\function_exists('shell_exec')) { |
|
| 112 | 112 | $stdout = shell_exec('git rev-parse --short HEAD'); |
| 113 | - if(\is_string($stdout)){ |
|
| 113 | + if (\is_string($stdout)) { |
|
| 114 | 114 | $hash = \trim($stdout); |
| 115 | 115 | return "#{$hash}"; |
| 116 | 116 | } |
@@ -128,9 +128,9 @@ discard block |
||
| 128 | 128 | public static function getChangelog(): string |
| 129 | 129 | { |
| 130 | 130 | $changelogFilename = __DIR__ . '/../../CHANGELOG_API.md'; |
| 131 | - if(\file_exists($changelogFilename)){ |
|
| 131 | + if (\file_exists($changelogFilename)) { |
|
| 132 | 132 | $string = \str_replace(["\r\n", "\r"], "\n", \trim(file_get_contents($changelogFilename))); |
| 133 | - if($string){ |
|
| 133 | + if ($string) { |
|
| 134 | 134 | return $string; |
| 135 | 135 | } |
| 136 | 136 | throw new PhpfastcacheLogicException('Unable to retrieve the PhpFastCache API changelog as it seems to be empty.'); |
@@ -147,9 +147,9 @@ discard block |
||
| 147 | 147 | public static function getPhpFastCacheChangelog(): string |
| 148 | 148 | { |
| 149 | 149 | $changelogFilename = __DIR__ . '/../../CHANGELOG.md'; |
| 150 | - if(\file_exists($changelogFilename)){ |
|
| 150 | + if (\file_exists($changelogFilename)) { |
|
| 151 | 151 | $string = \str_replace(["\r\n", "\r"], "\n", \trim(file_get_contents($changelogFilename))); |
| 152 | - if($string){ |
|
| 152 | + if ($string) { |
|
| 153 | 153 | return $string; |
| 154 | 154 | } |
| 155 | 155 | throw new PhpfastcacheLogicException('Unable to retrieve the PhpFastCache changelog as it seems to be empty.'); |
@@ -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 | |
@@ -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; |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | use Phpfastcache\Entities\ItemBatch; |
| 22 | 22 | use Phpfastcache\Util\ClassNamespaceResolverTrait; |
| 23 | 23 | use Phpfastcache\Exceptions\{ |
| 24 | - PhpfastcacheInvalidArgumentException, PhpfastcacheCoreException, PhpfastcacheLogicException |
|
| 24 | + PhpfastcacheInvalidArgumentException, PhpfastcacheCoreException, PhpfastcacheLogicException |
|
| 25 | 25 | }; |
| 26 | 26 | use Phpfastcache\Config\ConfigurationOption; |
| 27 | 27 | use Psr\Cache\CacheItemInterface; |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | if ($driverArray) { |
| 92 | 92 | if (!\is_array($driverArray)) { |
| 93 | 93 | throw new PhpfastcacheCoreException(sprintf('The driverRead method returned an unexpected variable type: %s', |
| 94 | - \gettype($driverArray))); |
|
| 94 | + \gettype($driverArray))); |
|
| 95 | 95 | } |
| 96 | 96 | $driverData = $this->driverUnwrapData($driverArray); |
| 97 | 97 | |
@@ -156,9 +156,9 @@ discard block |
||
| 156 | 156 | * Reset the Item |
| 157 | 157 | */ |
| 158 | 158 | $item->set(null) |
| 159 | - ->expiresAfter(abs((int)$this->getConfig()[ 'defaultTtl' ])) |
|
| 160 | - ->setHit(false) |
|
| 161 | - ->setTags([]); |
|
| 159 | + ->expiresAfter(abs((int)$this->getConfig()[ 'defaultTtl' ])) |
|
| 160 | + ->setHit(false) |
|
| 161 | + ->setTags([]); |
|
| 162 | 162 | if ($this->getConfigOption( 'itemDetailedDate')) { |
| 163 | 163 | |
| 164 | 164 | /** |
@@ -342,8 +342,8 @@ discard block |
||
| 342 | 342 | $class = new \ReflectionClass((new \ReflectionObject($this))->getNamespaceName() . '\Item'); |
| 343 | 343 | $itemBatch = $class->newInstanceArgs([$this, $item->getKey()]); |
| 344 | 344 | $itemBatch->setEventManager($this->eventManager) |
| 345 | - ->set(new ItemBatch($item->getKey(), new \DateTime())) |
|
| 346 | - ->expiresAfter($this->getConfigOption('cacheSlamsTimeout')); |
|
| 345 | + ->set(new ItemBatch($item->getKey(), new \DateTime())) |
|
| 346 | + ->expiresAfter($this->getConfigOption('cacheSlamsTimeout')); |
|
| 347 | 347 | |
| 348 | 348 | /** |
| 349 | 349 | * To avoid SPL mismatches |
@@ -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 | |
@@ -70,9 +70,9 @@ discard block |
||
| 70 | 70 | * due to performance issue on huge |
| 71 | 71 | * loop dispatching operations |
| 72 | 72 | */ |
| 73 | - if (!isset($this->itemInstances[ $key ])) { |
|
| 73 | + if (!isset($this->itemInstances[$key])) { |
|
| 74 | 74 | if (preg_match('~([' . preg_quote(self::$unsupportedKeyChars, '~') . ']+)~', $key, $matches)) { |
| 75 | - throw new PhpfastcacheInvalidArgumentException('Unsupported key character detected: "' . $matches[ 1 ] . '". Please check: https://github.com/PHPSocialNetwork/phpfastcache/wiki/%5BV6%5D-Unsupported-characters-in-key-identifiers'); |
|
| 75 | + throw new PhpfastcacheInvalidArgumentException('Unsupported key character detected: "' . $matches[1] . '". Please check: https://github.com/PHPSocialNetwork/phpfastcache/wiki/%5BV6%5D-Unsupported-characters-in-key-identifiers'); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | /** |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | } |
| 96 | 96 | $driverData = $this->driverUnwrapData($driverArray); |
| 97 | 97 | |
| 98 | - if ($this->getConfig()[ 'preventCacheSlams' ]) { |
|
| 98 | + if ($this->getConfig()['preventCacheSlams']) { |
|
| 99 | 99 | while ($driverData instanceof ItemBatch) { |
| 100 | 100 | if ($driverData->getItemDate()->getTimestamp() + $this->getConfigOption('cacheSlamsTimeout') < time()) { |
| 101 | 101 | /** |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | $item->set($driverData); |
| 130 | 130 | $item->expiresAt($this->driverUnwrapEdate($driverArray)); |
| 131 | 131 | |
| 132 | - if ($this->getConfigOption( 'itemDetailedDate')) { |
|
| 132 | + if ($this->getConfigOption('itemDetailedDate')) { |
|
| 133 | 133 | /** |
| 134 | 134 | * If the itemDetailedDate has been |
| 135 | 135 | * set after caching, we MUST inject |
@@ -156,10 +156,10 @@ discard block |
||
| 156 | 156 | * Reset the Item |
| 157 | 157 | */ |
| 158 | 158 | $item->set(null) |
| 159 | - ->expiresAfter(abs((int)$this->getConfig()[ 'defaultTtl' ])) |
|
| 159 | + ->expiresAfter(abs((int) $this->getConfig()['defaultTtl'])) |
|
| 160 | 160 | ->setHit(false) |
| 161 | 161 | ->setTags([]); |
| 162 | - if ($this->getConfigOption( 'itemDetailedDate')) { |
|
| 162 | + if ($this->getConfigOption('itemDetailedDate')) { |
|
| 163 | 163 | |
| 164 | 164 | /** |
| 165 | 165 | * If the itemDetailedDate has been |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | $item->setHit(true); |
| 174 | 174 | } |
| 175 | 175 | } else { |
| 176 | - $item->expiresAfter(abs((int)$this->getConfig()[ 'defaultTtl' ])); |
|
| 176 | + $item->expiresAfter(abs((int) $this->getConfig()['defaultTtl'])); |
|
| 177 | 177 | } |
| 178 | 178 | } |
| 179 | 179 | } |
@@ -186,9 +186,9 @@ discard block |
||
| 186 | 186 | * @param $this ExtendedCacheItemPoolInterface |
| 187 | 187 | * @param $this ExtendedCacheItemInterface |
| 188 | 188 | */ |
| 189 | - $this->eventManager->dispatch('CacheGetItem', $this, $this->itemInstances[ $key ]); |
|
| 189 | + $this->eventManager->dispatch('CacheGetItem', $this, $this->itemInstances[$key]); |
|
| 190 | 190 | |
| 191 | - return $this->itemInstances[ $key ]; |
|
| 191 | + return $this->itemInstances[$key]; |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | /** |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | public function setItem(CacheItemInterface $item) |
| 200 | 200 | { |
| 201 | 201 | if ($this->getClassNamespace() . '\\Item' === \get_class($item)) { |
| 202 | - $this->itemInstances[ $item->getKey() ] = $item; |
|
| 202 | + $this->itemInstances[$item->getKey()] = $item; |
|
| 203 | 203 | |
| 204 | 204 | return $this; |
| 205 | 205 | } |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | { |
| 217 | 217 | $collection = []; |
| 218 | 218 | foreach ($keys as $key) { |
| 219 | - $collection[ $key ] = $this->getItem($key); |
|
| 219 | + $collection[$key] = $this->getItem($key); |
|
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | return $collection; |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | } |
| 304 | 304 | } |
| 305 | 305 | |
| 306 | - return (bool)$return; |
|
| 306 | + return (bool) $return; |
|
| 307 | 307 | } |
| 308 | 308 | |
| 309 | 309 | /** |
@@ -321,9 +321,9 @@ discard block |
||
| 321 | 321 | * due to performance issue on huge |
| 322 | 322 | * loop dispatching operations |
| 323 | 323 | */ |
| 324 | - if (!isset($this->itemInstances[ $item->getKey() ])) { |
|
| 325 | - $this->itemInstances[ $item->getKey() ] = $item; |
|
| 326 | - } else if (\spl_object_hash($item) !== \spl_object_hash($this->itemInstances[ $item->getKey() ])) { |
|
| 324 | + if (!isset($this->itemInstances[$item->getKey()])) { |
|
| 325 | + $this->itemInstances[$item->getKey()] = $item; |
|
| 326 | + } else if (\spl_object_hash($item) !== \spl_object_hash($this->itemInstances[$item->getKey()])) { |
|
| 327 | 327 | throw new \RuntimeException('Spl object hash mismatches ! You probably tried to save a detached item which has been already retrieved from cache.'); |
| 328 | 328 | } |
| 329 | 329 | |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | $this->eventManager->dispatch('CacheSaveItem', $this, $item); |
| 336 | 336 | |
| 337 | 337 | |
| 338 | - if ($this->getConfig()[ 'preventCacheSlams' ]) { |
|
| 338 | + if ($this->getConfig()['preventCacheSlams']) { |
|
| 339 | 339 | /** |
| 340 | 340 | * @var $itemBatch ExtendedCacheItemInterface |
| 341 | 341 | */ |
@@ -375,8 +375,8 @@ discard block |
||
| 375 | 375 | public function saveDeferred(CacheItemInterface $item) |
| 376 | 376 | { |
| 377 | 377 | if (!\array_key_exists($item->getKey(), $this->itemInstances)) { |
| 378 | - $this->itemInstances[ $item->getKey() ] = $item; |
|
| 379 | - } else if (\spl_object_hash($item) !== \spl_object_hash($this->itemInstances[ $item->getKey() ])) { |
|
| 378 | + $this->itemInstances[$item->getKey()] = $item; |
|
| 379 | + } else if (\spl_object_hash($item) !== \spl_object_hash($this->itemInstances[$item->getKey()])) { |
|
| 380 | 380 | throw new \RuntimeException('Spl object hash mismatches ! You probably tried to save a detached item which has been already retrieved from cache.'); |
| 381 | 381 | } |
| 382 | 382 | |
@@ -387,7 +387,7 @@ discard block |
||
| 387 | 387 | */ |
| 388 | 388 | $this->eventManager->dispatch('CacheSaveDeferredItem', $this, $item); |
| 389 | 389 | |
| 390 | - return $this->deferredList[ $item->getKey() ] = $item; |
|
| 390 | + return $this->deferredList[$item->getKey()] = $item; |
|
| 391 | 391 | } |
| 392 | 392 | |
| 393 | 393 | /** |
@@ -407,11 +407,11 @@ discard block |
||
| 407 | 407 | foreach ($this->deferredList as $key => $item) { |
| 408 | 408 | $result = $this->save($item); |
| 409 | 409 | if ($return !== false) { |
| 410 | - unset($this->deferredList[ $key ]); |
|
| 410 | + unset($this->deferredList[$key]); |
|
| 411 | 411 | $return = $result; |
| 412 | 412 | } |
| 413 | 413 | } |
| 414 | 414 | |
| 415 | - return (bool)$return; |
|
| 415 | + return (bool) $return; |
|
| 416 | 416 | } |
| 417 | 417 | } |
| 418 | 418 | \ No newline at end of file |