@@ -108,9 +108,9 @@ |
||
| 108 | 108 | * Reset the Item |
| 109 | 109 | */ |
| 110 | 110 | $item->set(null) |
| 111 | - ->expiresAfter(abs((int) $this->getConfig()[ 'defaultTtl' ])) |
|
| 112 | - ->setHit(false) |
|
| 113 | - ->setTags([]); |
|
| 111 | + ->expiresAfter(abs((int) $this->getConfig()[ 'defaultTtl' ])) |
|
| 112 | + ->setHit(false) |
|
| 113 | + ->setTags([]); |
|
| 114 | 114 | if($this->config['itemDetailedDate']){ |
| 115 | 115 | |
| 116 | 116 | /** |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | public function getItem($key) |
| 62 | 62 | { |
| 63 | 63 | if (is_string($key)) { |
| 64 | - if (preg_match('~([' . preg_quote(self::$unsupportedKeyChars, '~') . ']+)~', $key, $matches)){ |
|
| 64 | + if (preg_match('~([' . preg_quote(self::$unsupportedKeyChars, '~') . ']+)~', $key, $matches)) { |
|
| 65 | 65 | throw new phpFastCacheInvalidArgumentException('Unsupported key character detected: "' . $matches[1] . '". Please check: https://github.com/PHPSocialNetwork/phpfastcache/wiki/%5BV6%5D-Unsupported-characters-in-key-identifiers'); |
| 66 | 66 | } |
| 67 | 67 | if (!array_key_exists($key, $this->itemInstances)) { |
@@ -76,13 +76,13 @@ discard block |
||
| 76 | 76 | $driverArray = $this->driverRead($item); |
| 77 | 77 | |
| 78 | 78 | if ($driverArray) { |
| 79 | - if(!is_array($driverArray)){ |
|
| 79 | + if (!is_array($driverArray)) { |
|
| 80 | 80 | throw new phpFastCacheCoreException(sprintf('The driverRead method returned an unexpected variable type: %s', gettype($driverArray))); |
| 81 | 81 | } |
| 82 | 82 | $item->set($this->driverUnwrapData($driverArray)); |
| 83 | 83 | $item->expiresAt($this->driverUnwrapEdate($driverArray)); |
| 84 | 84 | |
| 85 | - if($this->config['itemDetailedDate']){ |
|
| 85 | + if ($this->config['itemDetailedDate']) { |
|
| 86 | 86 | |
| 87 | 87 | /** |
| 88 | 88 | * If the itemDetailedDate has been |
@@ -108,10 +108,10 @@ discard block |
||
| 108 | 108 | * Reset the Item |
| 109 | 109 | */ |
| 110 | 110 | $item->set(null) |
| 111 | - ->expiresAfter(abs((int) $this->getConfig()[ 'defaultTtl' ])) |
|
| 111 | + ->expiresAfter(abs((int) $this->getConfig()['defaultTtl'])) |
|
| 112 | 112 | ->setHit(false) |
| 113 | 113 | ->setTags([]); |
| 114 | - if($this->config['itemDetailedDate']){ |
|
| 114 | + if ($this->config['itemDetailedDate']) { |
|
| 115 | 115 | |
| 116 | 116 | /** |
| 117 | 117 | * If the itemDetailedDate has been |
@@ -124,8 +124,8 @@ discard block |
||
| 124 | 124 | } else { |
| 125 | 125 | $item->setHit(true); |
| 126 | 126 | } |
| 127 | - }else{ |
|
| 128 | - $item->expiresAfter(abs((int) $this->getConfig()[ 'defaultTtl' ])); |
|
| 127 | + } else { |
|
| 128 | + $item->expiresAfter(abs((int) $this->getConfig()['defaultTtl'])); |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | } |
@@ -138,9 +138,9 @@ discard block |
||
| 138 | 138 | * @param $this ExtendedCacheItemPoolInterface |
| 139 | 139 | * @param $this ExtendedCacheItemInterface |
| 140 | 140 | */ |
| 141 | - $this->eventManager->dispatch('CacheGetItem', $this, $this->itemInstances[ $key ]); |
|
| 141 | + $this->eventManager->dispatch('CacheGetItem', $this, $this->itemInstances[$key]); |
|
| 142 | 142 | |
| 143 | - return $this->itemInstances[ $key ]; |
|
| 143 | + return $this->itemInstances[$key]; |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | /** |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | public function setItem(CacheItemInterface $item) |
| 152 | 152 | { |
| 153 | 153 | if ($this->getClassNamespace() . '\\Item' === get_class($item)) { |
| 154 | - $this->itemInstances[ $item->getKey() ] = $item; |
|
| 154 | + $this->itemInstances[$item->getKey()] = $item; |
|
| 155 | 155 | |
| 156 | 156 | return $this; |
| 157 | 157 | } else { |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | { |
| 169 | 169 | $collection = []; |
| 170 | 170 | foreach ($keys as $key) { |
| 171 | - $collection[ $key ] = $this->getItem($key); |
|
| 171 | + $collection[$key] = $this->getItem($key); |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | return $collection; |
@@ -265,8 +265,8 @@ discard block |
||
| 265 | 265 | * @var ExtendedCacheItemInterface $item |
| 266 | 266 | */ |
| 267 | 267 | if (!array_key_exists($item->getKey(), $this->itemInstances)) { |
| 268 | - $this->itemInstances[ $item->getKey() ] = $item; |
|
| 269 | - } else if(spl_object_hash($item) !== spl_object_hash($this->itemInstances[ $item->getKey() ])){ |
|
| 268 | + $this->itemInstances[$item->getKey()] = $item; |
|
| 269 | + } else if (spl_object_hash($item) !== spl_object_hash($this->itemInstances[$item->getKey()])) { |
|
| 270 | 270 | throw new \RuntimeException('Spl object hash mismatches ! You probably tried to save a detached item which has been already retrieved from cache.'); |
| 271 | 271 | } |
| 272 | 272 | |
@@ -296,8 +296,8 @@ discard block |
||
| 296 | 296 | public function saveDeferred(CacheItemInterface $item) |
| 297 | 297 | { |
| 298 | 298 | if (!array_key_exists($item->getKey(), $this->itemInstances)) { |
| 299 | - $this->itemInstances[ $item->getKey() ] = $item; |
|
| 300 | - }else if(spl_object_hash($item) !== spl_object_hash($this->itemInstances[ $item->getKey() ])){ |
|
| 299 | + $this->itemInstances[$item->getKey()] = $item; |
|
| 300 | + } else if (spl_object_hash($item) !== spl_object_hash($this->itemInstances[$item->getKey()])) { |
|
| 301 | 301 | throw new \RuntimeException('Spl object hash mismatches ! You probably tried to save a detached item which has been already retrieved from cache.'); |
| 302 | 302 | } |
| 303 | 303 | |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | */ |
| 309 | 309 | $this->eventManager->dispatch('CacheSaveDeferredItem', $this, $item); |
| 310 | 310 | |
| 311 | - return $this->deferredList[ $item->getKey() ] = $item; |
|
| 311 | + return $this->deferredList[$item->getKey()] = $item; |
|
| 312 | 312 | } |
| 313 | 313 | |
| 314 | 314 | /** |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | foreach ($this->deferredList as $key => $item) { |
| 329 | 329 | $result = $this->save($item); |
| 330 | 330 | if ($return !== false) { |
| 331 | - unset($this->deferredList[ $key ]); |
|
| 331 | + unset($this->deferredList[$key]); |
|
| 332 | 332 | $return = $result; |
| 333 | 333 | } |
| 334 | 334 | } |