@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | public function setItem(CacheItemInterface $item) |
67 | 67 | { |
68 | 68 | if ($this->getClassNamespace() . '\\Item' === \get_class($item)) { |
69 | - if(!$this->getConfig()->isUseStaticItemCaching()){ |
|
69 | + if (!$this->getConfig()->isUseStaticItemCaching()) { |
|
70 | 70 | throw new PhpfastcacheLogicException( |
71 | 71 | 'The static item caching option (useStaticItemCaching) is disabled so you cannot attach an item.' |
72 | 72 | ); |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | * Reset the Item |
209 | 209 | */ |
210 | 210 | $item->set(null) |
211 | - ->expiresAfter(abs((int)$this->getConfig()['defaultTtl'])) |
|
211 | + ->expiresAfter(abs((int) $this->getConfig()['defaultTtl'])) |
|
212 | 212 | ->setHit(false) |
213 | 213 | ->setTags([]); |
214 | 214 | if ($this->getConfig()->isItemDetailedDate()) { |
@@ -224,15 +224,15 @@ discard block |
||
224 | 224 | $item->setHit(true); |
225 | 225 | } |
226 | 226 | } else { |
227 | - $item->expiresAfter(abs((int)$this->getConfig()['defaultTtl'])); |
|
227 | + $item->expiresAfter(abs((int) $this->getConfig()['defaultTtl'])); |
|
228 | 228 | } |
229 | 229 | } |
230 | - }else{ |
|
230 | + } else { |
|
231 | 231 | $item = $this->itemInstances[$key]; |
232 | 232 | } |
233 | 233 | |
234 | 234 | |
235 | - if($item !== null){ |
|
235 | + if ($item !== null) { |
|
236 | 236 | /** |
237 | 237 | * @eventName CacheGetItem |
238 | 238 | * @param $this ExtendedCacheItemPoolInterface |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | } |
294 | 294 | } |
295 | 295 | |
296 | - return (bool)$return; |
|
296 | + return (bool) $return; |
|
297 | 297 | } |
298 | 298 | |
299 | 299 | /** |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | } |
382 | 382 | } |
383 | 383 | |
384 | - return (bool)$return; |
|
384 | + return (bool) $return; |
|
385 | 385 | } |
386 | 386 | |
387 | 387 | /** |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | * loop dispatching operations |
402 | 402 | */ |
403 | 403 | if (!isset($this->itemInstances[$item->getKey()])) { |
404 | - if($this->getConfig()->isUseStaticItemCaching()){ |
|
404 | + if ($this->getConfig()->isUseStaticItemCaching()) { |
|
405 | 405 | $this->itemInstances[$item->getKey()] = $item; |
406 | 406 | } |
407 | 407 | } else { |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | \implode( |
201 | 201 | ', ', |
202 | 202 | \array_map( |
203 | - static function (ExtendedCacheItemPoolInterface $pool) { |
|
203 | + static function(ExtendedCacheItemPoolInterface $pool) { |
|
204 | 204 | return \get_class($pool); |
205 | 205 | }, |
206 | 206 | $this->clusterPools |
@@ -210,9 +210,9 @@ discard block |
||
210 | 210 | ); |
211 | 211 | |
212 | 212 | $stats->setSize( |
213 | - (int)\array_sum( |
|
213 | + (int) \array_sum( |
|
214 | 214 | \array_map( |
215 | - static function (ExtendedCacheItemPoolInterface $pool) { |
|
215 | + static function(ExtendedCacheItemPoolInterface $pool) { |
|
216 | 216 | return $pool->getStats()->getSize(); |
217 | 217 | }, |
218 | 218 | $this->clusterPools |
@@ -221,8 +221,8 @@ discard block |
||
221 | 221 | ); |
222 | 222 | |
223 | 223 | $stats->setData( |
224 | - (int)\array_map( |
|
225 | - static function (ExtendedCacheItemPoolInterface $pool) { |
|
224 | + (int) \array_map( |
|
225 | + static function(ExtendedCacheItemPoolInterface $pool) { |
|
226 | 226 | return $pool->getStats()->getData(); |
227 | 227 | }, |
228 | 228 | $this->clusterPools |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | { |
60 | 60 | return $this->getStandardizedItem( |
61 | 61 | $this->makeOperation( |
62 | - static function (ExtendedCacheItemPoolInterface $pool) use ($key) { |
|
62 | + static function(ExtendedCacheItemPoolInterface $pool) use ($key) { |
|
63 | 63 | return $pool->getItem($key); |
64 | 64 | } |
65 | 65 | ) ?? new Item($this, $key), |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | public function hasItem($key) |
113 | 113 | { |
114 | 114 | return $this->makeOperation( |
115 | - static function (ExtendedCacheItemPoolInterface $pool) use ($key) { |
|
115 | + static function(ExtendedCacheItemPoolInterface $pool) use ($key) { |
|
116 | 116 | return $pool->hasItem($key); |
117 | 117 | } |
118 | 118 | ); |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | public function clear() |
125 | 125 | { |
126 | 126 | return $this->makeOperation( |
127 | - static function (ExtendedCacheItemPoolInterface $pool) { |
|
127 | + static function(ExtendedCacheItemPoolInterface $pool) { |
|
128 | 128 | return $pool->clear(); |
129 | 129 | } |
130 | 130 | ); |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | public function deleteItem($key) |
137 | 137 | { |
138 | 138 | return $this->makeOperation( |
139 | - static function (ExtendedCacheItemPoolInterface $pool) use ($key) { |
|
139 | + static function(ExtendedCacheItemPoolInterface $pool) use ($key) { |
|
140 | 140 | return $pool->deleteItem($key); |
141 | 141 | } |
142 | 142 | ); |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | public function save(CacheItemInterface $item) |
149 | 149 | { |
150 | 150 | return $this->makeOperation( |
151 | - function (ExtendedCacheItemPoolInterface $pool) use ($item) { |
|
151 | + function(ExtendedCacheItemPoolInterface $pool) use ($item) { |
|
152 | 152 | $item->setHit(true); |
153 | 153 | return $pool->save($this->getStandardizedItem($item, $pool)); |
154 | 154 | } |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | public function commit() |
163 | 163 | { |
164 | 164 | return $this->makeOperation( |
165 | - static function (ExtendedCacheItemPoolInterface $pool) { |
|
165 | + static function(ExtendedCacheItemPoolInterface $pool) { |
|
166 | 166 | return $pool->commit(); |
167 | 167 | } |
168 | 168 | ); |
@@ -98,7 +98,7 @@ |
||
98 | 98 | public function __construct(...$args) |
99 | 99 | { |
100 | 100 | parent::__construct(...$args); |
101 | - $array =& $this->getArray(); |
|
101 | + $array = & $this->getArray(); |
|
102 | 102 | |
103 | 103 | /** |
104 | 104 | * Detect unwanted keys and throw an exception. |
@@ -68,7 +68,7 @@ |
||
68 | 68 | public function setDatabase(string $database): Config |
69 | 69 | { |
70 | 70 | /** @see https://docs.couchdb.org/en/latest/api/database/common.html#put--db */ |
71 | - if(\preg_match('#^[a-z][a-z0-9_\-+\$()/]+$#', $database)){ |
|
71 | + if (\preg_match('#^[a-z][a-z0-9_\-+\$()/]+$#', $database)) { |
|
72 | 72 | $this->database = $database; |
73 | 73 | return $this; |
74 | 74 | } |
@@ -122,9 +122,9 @@ discard block |
||
122 | 122 | */ |
123 | 123 | protected function createDatabase() |
124 | 124 | { |
125 | - try{ |
|
125 | + try { |
|
126 | 126 | $this->instance->getDatabaseInfo($this->getDatabaseName()); |
127 | - } catch(HTTPException $e){ |
|
127 | + } catch (HTTPException $e) { |
|
128 | 128 | $this->instance->createDatabase($this->getDatabaseName()); |
129 | 129 | } |
130 | 130 | } |
@@ -279,14 +279,14 @@ discard block |
||
279 | 279 | new \DateTimeZone($value[ExtendedCacheItemPoolInterface::DRIVER_EDATE_WRAPPER_INDEX]['timezone']) |
280 | 280 | ); |
281 | 281 | |
282 | - if(isset($value[ExtendedCacheItemPoolInterface::DRIVER_CDATE_WRAPPER_INDEX])){ |
|
282 | + if (isset($value[ExtendedCacheItemPoolInterface::DRIVER_CDATE_WRAPPER_INDEX])) { |
|
283 | 283 | $value[ExtendedCacheItemPoolInterface::DRIVER_CDATE_WRAPPER_INDEX] = new \DateTime( |
284 | 284 | $value[ExtendedCacheItemPoolInterface::DRIVER_CDATE_WRAPPER_INDEX]['date'], |
285 | 285 | new \DateTimeZone($value[ExtendedCacheItemPoolInterface::DRIVER_CDATE_WRAPPER_INDEX]['timezone']) |
286 | 286 | ); |
287 | 287 | } |
288 | 288 | |
289 | - if(isset($value[ExtendedCacheItemPoolInterface::DRIVER_MDATE_WRAPPER_INDEX])){ |
|
289 | + if (isset($value[ExtendedCacheItemPoolInterface::DRIVER_MDATE_WRAPPER_INDEX])) { |
|
290 | 290 | $value[ExtendedCacheItemPoolInterface::DRIVER_MDATE_WRAPPER_INDEX] = new \DateTime( |
291 | 291 | $value[ExtendedCacheItemPoolInterface::DRIVER_MDATE_WRAPPER_INDEX]['date'], |
292 | 292 | new \DateTimeZone($value[ExtendedCacheItemPoolInterface::DRIVER_MDATE_WRAPPER_INDEX]['timezone']) |
@@ -76,9 +76,9 @@ |
||
76 | 76 | { |
77 | 77 | $file_path = $this->getFilePath($item->getKey(), true); |
78 | 78 | |
79 | - try{ |
|
79 | + try { |
|
80 | 80 | $content = $this->readFile($file_path); |
81 | - }catch (PhpfastcacheIOException $e){ |
|
81 | + } catch (PhpfastcacheIOException $e) { |
|
82 | 82 | return null; |
83 | 83 | } |
84 | 84 |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | * Check for Cross-Driver type confusion |
118 | 118 | */ |
119 | 119 | if ($item instanceof Item) { |
120 | - return (bool)$this->instance->setx($item->getEncodedKey(), $this->encode($this->driverPreWrap($item)), $item->getTtl()); |
|
120 | + return (bool) $this->instance->setx($item->getEncodedKey(), $this->encode($this->driverPreWrap($item)), $item->getTtl()); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | throw new PhpfastcacheInvalidArgumentException('Cross-Driver type confusion detected'); |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | * Check for Cross-Driver type confusion |
135 | 135 | */ |
136 | 136 | if ($item instanceof Item) { |
137 | - return (bool)$this->instance->del($item->getEncodedKey()); |
|
137 | + return (bool) $this->instance->del($item->getEncodedKey()); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | throw new PhpfastcacheInvalidArgumentException('Cross-Driver type confusion detected'); |
@@ -151,6 +151,6 @@ discard block |
||
151 | 151 | */ |
152 | 152 | protected function driverClear(): bool |
153 | 153 | { |
154 | - return (bool)$this->instance->flushdb('kv'); |
|
154 | + return (bool) $this->instance->flushdb('kv'); |
|
155 | 155 | } |
156 | 156 | } |
@@ -125,7 +125,7 @@ |
||
125 | 125 | * Check for Cross-Driver type confusion |
126 | 126 | */ |
127 | 127 | if ($item instanceof Item) { |
128 | - return (bool)zend_disk_cache_delete($item->getKey()); |
|
128 | + return (bool) zend_disk_cache_delete($item->getKey()); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | throw new PhpfastcacheInvalidArgumentException('Cross-Driver type confusion detected'); |