@@ -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.'); |
@@ -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 |
@@ -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 | } |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | if (\is_array($this->data)) { |
| 247 | 247 | $this->data[] = $data; |
| 248 | 248 | } else if (\is_string($data)) { |
| 249 | - $this->data .= (string)$data; |
|
| 249 | + $this->data .= (string) $data; |
|
| 250 | 250 | } else { |
| 251 | 251 | throw new PhpfastcacheInvalidArgumentException('$data must be either array nor string.'); |
| 252 | 252 | } |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | if (\is_array($this->data)) { |
| 266 | 266 | \array_unshift($this->data, $data); |
| 267 | 267 | } else if (\is_string($data)) { |
| 268 | - $this->data = (string)$data . $this->data; |
|
| 268 | + $this->data = (string) $data . $this->data; |
|
| 269 | 269 | } else { |
| 270 | 270 | throw new PhpfastcacheInvalidArgumentException('$data must be either array nor string.'); |
| 271 | 271 | } |
@@ -344,7 +344,7 @@ discard block |
||
| 344 | 344 | public function removeTag($tagName): ExtendedCacheItemInterface |
| 345 | 345 | { |
| 346 | 346 | if (($key = array_search($tagName, $this->tags)) !== false) { |
| 347 | - unset($this->tags[ $key ]); |
|
| 347 | + unset($this->tags[$key]); |
|
| 348 | 348 | $this->removedTags[] = $tagName; |
| 349 | 349 | } |
| 350 | 350 | |
@@ -423,8 +423,8 @@ discard block |
||
| 423 | 423 | final public function __debugInfo() |
| 424 | 424 | { |
| 425 | 425 | $info = \get_object_vars($this); |
| 426 | - $info[ 'driver' ] = 'object(' . \get_class($info[ 'driver' ]) . ')'; |
|
| 426 | + $info['driver'] = 'object(' . \get_class($info['driver']) . ')'; |
|
| 427 | 427 | |
| 428 | - return (array)$info; |
|
| 428 | + return (array) $info; |
|
| 429 | 429 | } |
| 430 | 430 | } |
| 431 | 431 | \ 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; |
| 17 | 17 | |
@@ -76,8 +76,8 @@ discard block |
||
| 76 | 76 | * due to performance issue on huge |
| 77 | 77 | * loop dispatching operations |
| 78 | 78 | */ |
| 79 | - if (isset($this->events[ $eventName ])) { |
|
| 80 | - foreach ($this->events[ $eventName ] as $event) { |
|
| 79 | + if (isset($this->events[$eventName])) { |
|
| 80 | + foreach ($this->events[$eventName] as $event) { |
|
| 81 | 81 | call_user_func_array($event, $args); |
| 82 | 82 | } |
| 83 | 83 | } |
@@ -93,14 +93,14 @@ discard block |
||
| 93 | 93 | { |
| 94 | 94 | if (\strpos($name, 'on') === 0) { |
| 95 | 95 | $name = \substr($name, 2); |
| 96 | - if (\is_callable($arguments[ 0 ])) { |
|
| 97 | - if (isset($arguments[ 1 ]) && \is_string($arguments[ 0 ])) { |
|
| 98 | - $this->events[ $name ][ $arguments[ 1 ] ] = $arguments[ 0 ]; |
|
| 96 | + if (\is_callable($arguments[0])) { |
|
| 97 | + if (isset($arguments[1]) && \is_string($arguments[0])) { |
|
| 98 | + $this->events[$name][$arguments[1]] = $arguments[0]; |
|
| 99 | 99 | } else { |
| 100 | - $this->events[ $name ][] = $arguments[ 0 ]; |
|
| 100 | + $this->events[$name][] = $arguments[0]; |
|
| 101 | 101 | } |
| 102 | 102 | } else { |
| 103 | - throw new PhpfastcacheInvalidArgumentException(sprintf('Expected Callable, got "%s"', \gettype($arguments[ 0 ]))); |
|
| 103 | + throw new PhpfastcacheInvalidArgumentException(sprintf('Expected Callable, got "%s"', \gettype($arguments[0]))); |
|
| 104 | 104 | } |
| 105 | 105 | } else { |
| 106 | 106 | throw new \BadMethodCallException('An event must start with "on" such as "onCacheGetItem"'); |
@@ -114,8 +114,8 @@ discard block |
||
| 114 | 114 | */ |
| 115 | 115 | public function unbindEventCallback($eventName, $callbackName): bool |
| 116 | 116 | { |
| 117 | - $return = isset($this->events[ $eventName ][ $callbackName ]); |
|
| 118 | - unset($this->events[ $eventName ][ $callbackName ]); |
|
| 117 | + $return = isset($this->events[$eventName][$callbackName]); |
|
| 118 | + unset($this->events[$eventName][$callbackName]); |
|
| 119 | 119 | |
| 120 | 120 | return $return; |
| 121 | 121 | } |
@@ -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\Proxy; |
| 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 | |