@@ -204,6 +204,6 @@ |
||
204 | 204 | ->setData(\implode(', ', \array_keys($this->itemInstances))) |
205 | 205 | ->setInfo(\sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats['version'], $date->format(\DATE_RFC2822))) |
206 | 206 | ->setRawData($stats) |
207 | - ->setSize((int)$stats['bytes']); |
|
207 | + ->setSize((int) $stats['bytes']); |
|
208 | 208 | } |
209 | 209 | } |
210 | 210 | \ No newline at end of file |
@@ -156,7 +156,7 @@ 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 | 162 | if ($this->getConfig()->isItemDetailedDate()) { |
@@ -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 | } |
@@ -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 | /** |
@@ -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 | } |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | */ |
113 | 113 | public function getItemsByTagsAsJsonString(array $tagNames, $option = 0, $depth = 512): string |
114 | 114 | { |
115 | - $callback = function (CacheItemInterface $item) { |
|
115 | + $callback = function(CacheItemInterface $item) { |
|
116 | 116 | return $item->get(); |
117 | 117 | }; |
118 | 118 |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | |
76 | 76 | $options = []; |
77 | 77 | |
78 | - if($this->getConfig()->getOptPrefix()){ |
|
78 | + if ($this->getConfig()->getOptPrefix()) { |
|
79 | 79 | $options['prefix'] = $this->getConfig()->getOptPrefix(); |
80 | 80 | } |
81 | 81 | |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | * @see https://redis.io/commands/expire |
132 | 132 | */ |
133 | 133 | if ($ttl <= 0) { |
134 | - return (bool)$this->instance->expire($item->getKey(), 0); |
|
134 | + return (bool) $this->instance->expire($item->getKey(), 0); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | return $this->instance->setex($item->getKey(), $ttl, $this->encode($this->driverPreWrap($item)))->getPayload() === 'OK'; |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | * Check for Cross-Driver type confusion |
152 | 152 | */ |
153 | 153 | if ($item instanceof Item) { |
154 | - return (bool)$this->instance->del([$item->getKey()]); |
|
154 | + return (bool) $this->instance->del([$item->getKey()]); |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | throw new PhpfastcacheInvalidArgumentException('Cross-Driver type confusion detected'); |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | return (new DriverStatistic()) |
199 | 199 | ->setData(\implode(', ', \array_keys($this->itemInstances))) |
200 | 200 | ->setRawData($info) |
201 | - ->setSize((int)$size) |
|
201 | + ->setSize((int) $size) |
|
202 | 202 | ->setInfo(\sprintf("The Redis daemon v%s is up since %s.\n For more information see RawData. \n Driver size includes the memory allocation size.", |
203 | 203 | $version, $date->format(\DATE_RFC2822))); |
204 | 204 | } |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | return false; |
82 | 82 | } |
83 | 83 | |
84 | - if($this->getConfig()->getOptPrefix()){ |
|
84 | + if ($this->getConfig()->getOptPrefix()) { |
|
85 | 85 | $this->instance->setOption(RedisClient::OPT_PREFIX, $this->getConfig()->getOptPrefix()); |
86 | 86 | } |
87 | 87 | |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | * Check for Cross-Driver type confusion |
150 | 150 | */ |
151 | 151 | if ($item instanceof Item) { |
152 | - return (bool)$this->instance->del($item->getKey()); |
|
152 | + return (bool) $this->instance->del($item->getKey()); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | throw new PhpfastcacheInvalidArgumentException('Cross-Driver type confusion detected'); |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | return (new DriverStatistic()) |
182 | 182 | ->setData(\implode(', ', \array_keys($this->itemInstances))) |
183 | 183 | ->setRawData($info) |
184 | - ->setSize((int)$info['used_memory']) |
|
184 | + ->setSize((int) $info['used_memory']) |
|
185 | 185 | ->setInfo(\sprintf("The Redis daemon v%s is up since %s.\n For more information see RawData. \n Driver size includes the memory allocation size.", |
186 | 186 | $info['redis_version'], $date->format(\DATE_RFC2822))); |
187 | 187 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | if ($item instanceof Item) { |
64 | 64 | $ttl = $item->getExpirationDate()->getTimestamp() - \time(); |
65 | 65 | |
66 | - return (bool)apcu_store($item->getKey(), $this->driverPreWrap($item), ($ttl > 0 ? $ttl : 0)); |
|
66 | + return (bool) apcu_store($item->getKey(), $this->driverPreWrap($item), ($ttl > 0 ? $ttl : 0)); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | throw new PhpfastcacheInvalidArgumentException('Cross-Driver type confusion detected'); |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | * Check for Cross-Driver type confusion |
95 | 95 | */ |
96 | 96 | if ($item instanceof Item) { |
97 | - return (bool)apcu_delete($item->getKey()); |
|
97 | + return (bool) apcu_delete($item->getKey()); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | throw new PhpfastcacheInvalidArgumentException('Cross-Driver type confusion detected'); |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | */ |
120 | 120 | public function getStats(): DriverStatistic |
121 | 121 | { |
122 | - $stats = (array)apcu_cache_info(); |
|
122 | + $stats = (array) apcu_cache_info(); |
|
123 | 123 | $date = (new \DateTime())->setTimestamp($stats['start_time']); |
124 | 124 | |
125 | 125 | return (new DriverStatistic()) |
@@ -127,6 +127,6 @@ discard block |
||
127 | 127 | ->setInfo(\sprintf("The APCU cache is up since %s, and have %d item(s) in cache.\n For more information see RawData.", $date->format(\DATE_RFC2822), |
128 | 128 | $stats['num_entries'])) |
129 | 129 | ->setRawData($stats) |
130 | - ->setSize((int)$stats['mem_size']); |
|
130 | + ->setSize((int) $stats['mem_size']); |
|
131 | 131 | } |
132 | 132 | } |
@@ -70,9 +70,9 @@ discard block |
||
70 | 70 | throw new PhpfastcacheDriverCheckException(\sprintf(self::DRIVER_CHECK_FAILURE, $this->getDriverName())); |
71 | 71 | } |
72 | 72 | |
73 | - try{ |
|
73 | + try { |
|
74 | 74 | $this->driverConnect(); |
75 | - }catch(\Exception $e){ |
|
75 | + } catch (\Exception $e) { |
|
76 | 76 | throw new PhpfastcacheDriverConnectException(\sprintf( |
77 | 77 | self::DRIVER_CONNECT_FAILURE, |
78 | 78 | $this->getDriverName(), |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | */ |
142 | 142 | protected function decode($value) |
143 | 143 | { |
144 | - return \unserialize((string)$value); |
|
144 | + return \unserialize((string) $value); |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | /** |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | * that has slow performances |
282 | 282 | */ |
283 | 283 | |
284 | - $tagsItem->set(\array_merge((array)$data, [$item->getKey() => $expTimestamp])); |
|
284 | + $tagsItem->set(\array_merge((array) $data, [$item->getKey() => $expTimestamp])); |
|
285 | 285 | |
286 | 286 | /** |
287 | 287 | * Set the expiration date |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | $tagsItems = $this->getItems($this->getTagKeys($item->getRemovedTags())); |
304 | 304 | |
305 | 305 | foreach ($tagsItems as $tagsItem) { |
306 | - $data = (array)$tagsItem->get(); |
|
306 | + $data = (array) $tagsItem->get(); |
|
307 | 307 | |
308 | 308 | unset($data[$item->getKey()]); |
309 | 309 | $tagsItem->set($data); |
@@ -72,7 +72,7 @@ |
||
72 | 72 | |
73 | 73 | try{ |
74 | 74 | $this->driverConnect(); |
75 | - }catch(\Exception $e){ |
|
75 | + } catch(\Exception $e){ |
|
76 | 76 | throw new PhpfastcacheDriverConnectException(\sprintf( |
77 | 77 | self::DRIVER_CONNECT_FAILURE, |
78 | 78 | $this->getDriverName(), |
@@ -28,7 +28,7 @@ |
||
28 | 28 | /** |
29 | 29 | * @var int |
30 | 30 | */ |
31 | - protected $port = 8091;// SSL: 18091 |
|
31 | + protected $port = 8091; // SSL: 18091 |
|
32 | 32 | |
33 | 33 | /** |
34 | 34 | * @var string |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | $fallback = $config->getFallback(); |
166 | 166 | $config->setFallback(''); |
167 | 167 | \trigger_error(\sprintf('The "%s" driver is unavailable at the moment, the fallback driver "%s" has been used instead.', $driver, |
168 | - $fallback), \E_USER_WARNING); |
|
168 | + $fallback), \E_USER_WARNING); |
|
169 | 169 | return self::getInstance($fallback, $config->getFallbackConfig()); |
170 | 170 | } catch (PhpfastcacheInvalidArgumentException $e) { |
171 | 171 | throw new PhpfastcacheInvalidConfigurationException('Invalid fallback driver configuration', 0, $e); |
@@ -283,8 +283,8 @@ discard block |
||
283 | 283 | public static function clearInstance(ExtendedCacheItemPoolInterface $cachePoolInstance): bool |
284 | 284 | { |
285 | 285 | $found = false; |
286 | - self::$instances = \array_filter(\array_map(function (ExtendedCacheItemPoolInterface $cachePool) use ($cachePoolInstance, &$found){ |
|
287 | - if(\spl_object_hash($cachePool) === \spl_object_hash($cachePoolInstance)){ |
|
286 | + self::$instances = \array_filter(\array_map(function(ExtendedCacheItemPoolInterface $cachePool) use ($cachePoolInstance, &$found){ |
|
287 | + if (\spl_object_hash($cachePool) === \spl_object_hash($cachePoolInstance)) { |
|
288 | 288 | $found = true; |
289 | 289 | return null; |
290 | 290 | } |