@@ -68,9 +68,9 @@ discard block |
||
| 68 | 68 | * due to performance issue on huge |
| 69 | 69 | * loop dispatching operations |
| 70 | 70 | */ |
| 71 | - if (!isset($this->itemInstances[ $key ])) { |
|
| 71 | + if (!isset($this->itemInstances[$key])) { |
|
| 72 | 72 | if (preg_match('~([' . preg_quote(self::$unsupportedKeyChars, '~') . ']+)~', $key, $matches)) { |
| 73 | - throw new phpFastCacheInvalidArgumentException('Unsupported key character detected: "' . $matches[ 1 ] . '". Please check: https://github.com/PHPSocialNetwork/phpfastcache/wiki/%5BV6%CB%96%5D-Unsupported-characters-in-key-identifiers'); |
|
| 73 | + throw new phpFastCacheInvalidArgumentException('Unsupported key character detected: "' . $matches[1] . '". Please check: https://github.com/PHPSocialNetwork/phpfastcache/wiki/%5BV6%CB%96%5D-Unsupported-characters-in-key-identifiers'); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | /** |
@@ -93,9 +93,9 @@ discard block |
||
| 93 | 93 | } |
| 94 | 94 | $driverData = $this->driverUnwrapData($driverArray); |
| 95 | 95 | |
| 96 | - if ($this->getConfig()[ 'preventCacheSlams' ]) { |
|
| 96 | + if ($this->getConfig()['preventCacheSlams']) { |
|
| 97 | 97 | while ($driverData instanceof ItemBatch) { |
| 98 | - if ($driverData->getItemDate()->getTimestamp() + $this->getConfig()[ 'cacheSlamsTimeout' ] < time()) { |
|
| 98 | + if ($driverData->getItemDate()->getTimestamp() + $this->getConfig()['cacheSlamsTimeout'] < time()) { |
|
| 99 | 99 | /** |
| 100 | 100 | * The timeout has been reached |
| 101 | 101 | * Consider that the batch has |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | $item->set($driverData); |
| 128 | 128 | $item->expiresAt($this->driverUnwrapEdate($driverArray)); |
| 129 | 129 | |
| 130 | - if ($this->config[ 'itemDetailedDate' ]) { |
|
| 130 | + if ($this->config['itemDetailedDate']) { |
|
| 131 | 131 | |
| 132 | 132 | /** |
| 133 | 133 | * If the itemDetailedDate has been |
@@ -155,10 +155,10 @@ 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 | - if ($this->config[ 'itemDetailedDate' ]) { |
|
| 161 | + if ($this->config['itemDetailedDate']) { |
|
| 162 | 162 | |
| 163 | 163 | /** |
| 164 | 164 | * If the itemDetailedDate has been |
@@ -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 | } |
@@ -185,9 +185,9 @@ discard block |
||
| 185 | 185 | * @param $this ExtendedCacheItemPoolInterface |
| 186 | 186 | * @param $this ExtendedCacheItemInterface |
| 187 | 187 | */ |
| 188 | - $this->eventManager->dispatch('CacheGetItem', $this, $this->itemInstances[ $key ]); |
|
| 188 | + $this->eventManager->dispatch('CacheGetItem', $this, $this->itemInstances[$key]); |
|
| 189 | 189 | |
| 190 | - return $this->itemInstances[ $key ]; |
|
| 190 | + return $this->itemInstances[$key]; |
|
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | /** |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | public function setItem(CacheItemInterface $item) |
| 199 | 199 | { |
| 200 | 200 | if ($this->getClassNamespace() . '\\Item' === get_class($item)) { |
| 201 | - $this->itemInstances[ $item->getKey() ] = $item; |
|
| 201 | + $this->itemInstances[$item->getKey()] = $item; |
|
| 202 | 202 | |
| 203 | 203 | return $this; |
| 204 | 204 | } else { |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | { |
| 216 | 216 | $collection = []; |
| 217 | 217 | foreach ($keys as $key) { |
| 218 | - $collection[ $key ] = $this->getItem($key); |
|
| 218 | + $collection[$key] = $this->getItem($key); |
|
| 219 | 219 | } |
| 220 | 220 | |
| 221 | 221 | return $collection; |
@@ -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 | /** |
@@ -320,9 +320,9 @@ discard block |
||
| 320 | 320 | * due to performance issue on huge |
| 321 | 321 | * loop dispatching operations |
| 322 | 322 | */ |
| 323 | - if (!isset($this->itemInstances[ $item->getKey() ])) { |
|
| 324 | - $this->itemInstances[ $item->getKey() ] = $item; |
|
| 325 | - } else if (spl_object_hash($item) !== spl_object_hash($this->itemInstances[ $item->getKey() ])) { |
|
| 323 | + if (!isset($this->itemInstances[$item->getKey()])) { |
|
| 324 | + $this->itemInstances[$item->getKey()] = $item; |
|
| 325 | + } else if (spl_object_hash($item) !== spl_object_hash($this->itemInstances[$item->getKey()])) { |
|
| 326 | 326 | throw new \RuntimeException('Spl object hash mismatches ! You probably tried to save a detached item which has been already retrieved from cache.'); |
| 327 | 327 | } |
| 328 | 328 | |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | $this->eventManager->dispatch('CacheSaveItem', $this, $item); |
| 335 | 335 | |
| 336 | 336 | |
| 337 | - if ($this->getConfig()[ 'preventCacheSlams' ]) { |
|
| 337 | + if ($this->getConfig()['preventCacheSlams']) { |
|
| 338 | 338 | /** |
| 339 | 339 | * @var $itemBatch ExtendedCacheItemInterface |
| 340 | 340 | */ |
@@ -342,7 +342,7 @@ discard block |
||
| 342 | 342 | $itemBatch = $class->newInstanceArgs([$this, $item->getKey()]); |
| 343 | 343 | $itemBatch->setEventManager($this->eventManager) |
| 344 | 344 | ->set(new ItemBatch($item->getKey(), new \DateTime())) |
| 345 | - ->expiresAfter($this->getConfig()[ 'cacheSlamsTimeout' ]); |
|
| 345 | + ->expiresAfter($this->getConfig()['cacheSlamsTimeout']); |
|
| 346 | 346 | |
| 347 | 347 | /** |
| 348 | 348 | * To avoid SPL mismatches |
@@ -374,8 +374,8 @@ discard block |
||
| 374 | 374 | public function saveDeferred(CacheItemInterface $item) |
| 375 | 375 | { |
| 376 | 376 | if (!array_key_exists($item->getKey(), $this->itemInstances)) { |
| 377 | - $this->itemInstances[ $item->getKey() ] = $item; |
|
| 378 | - } else if (spl_object_hash($item) !== spl_object_hash($this->itemInstances[ $item->getKey() ])) { |
|
| 377 | + $this->itemInstances[$item->getKey()] = $item; |
|
| 378 | + } else if (spl_object_hash($item) !== spl_object_hash($this->itemInstances[$item->getKey()])) { |
|
| 379 | 379 | throw new \RuntimeException('Spl object hash mismatches ! You probably tried to save a detached item which has been already retrieved from cache.'); |
| 380 | 380 | } |
| 381 | 381 | |
@@ -386,7 +386,7 @@ discard block |
||
| 386 | 386 | */ |
| 387 | 387 | $this->eventManager->dispatch('CacheSaveDeferredItem', $this, $item); |
| 388 | 388 | |
| 389 | - return $this->deferredList[ $item->getKey() ] = $item; |
|
| 389 | + return $this->deferredList[$item->getKey()] = $item; |
|
| 390 | 390 | } |
| 391 | 391 | |
| 392 | 392 | /** |
@@ -406,11 +406,11 @@ discard block |
||
| 406 | 406 | foreach ($this->deferredList as $key => $item) { |
| 407 | 407 | $result = $this->save($item); |
| 408 | 408 | if ($return !== false) { |
| 409 | - unset($this->deferredList[ $key ]); |
|
| 409 | + unset($this->deferredList[$key]); |
|
| 410 | 410 | $return = $result; |
| 411 | 411 | } |
| 412 | 412 | } |
| 413 | 413 | |
| 414 | - return (bool)$return; |
|
| 414 | + return (bool) $return; |
|
| 415 | 415 | } |
| 416 | 416 | } |