@@ -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 @@ |
||
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\Helper; |
17 | 17 |
@@ -221,11 +221,11 @@ discard block |
||
221 | 221 | $this->printSkipText('A driver could not be initialized due to missing requirement: ' . $exception->getMessage()); |
222 | 222 | } else { |
223 | 223 | $this->printFailText(\sprintf( |
224 | - 'Uncaught exception "%s" in "%s" line %d with message: "%s"', |
|
225 | - \get_class($exception), |
|
226 | - $exception->getFile(), |
|
227 | - $exception->getLine(), |
|
228 | - $exception->getMessage() |
|
224 | + 'Uncaught exception "%s" in "%s" line %d with message: "%s"', |
|
225 | + \get_class($exception), |
|
226 | + $exception->getFile(), |
|
227 | + $exception->getLine(), |
|
228 | + $exception->getMessage() |
|
229 | 229 | )); |
230 | 230 | } |
231 | 231 | $this->terminateTest(); |
@@ -272,17 +272,17 @@ discard block |
||
272 | 272 | |
273 | 273 | if ($errorType === '[FATAL ERROR]') { |
274 | 274 | $this->printFailText(\sprintf( |
275 | - "A critical error has been caught: \"%s\" in %s line %d", |
|
276 | - "$errorType $errstr", |
|
277 | - $errfile, |
|
278 | - $errline |
|
275 | + "A critical error has been caught: \"%s\" in %s line %d", |
|
276 | + "$errorType $errstr", |
|
277 | + $errfile, |
|
278 | + $errline |
|
279 | 279 | )); |
280 | 280 | } else { |
281 | 281 | $this->printDebugText(\sprintf( |
282 | - "A non-critical error has been caught: \"%s\" in %s line %d", |
|
283 | - "$errorType $errstr", |
|
284 | - $errfile, |
|
285 | - $errline |
|
282 | + "A non-critical error has been caught: \"%s\" in %s line %d", |
|
283 | + "$errorType $errstr", |
|
284 | + $errfile, |
|
285 | + $errline |
|
286 | 286 | )); |
287 | 287 | } |
288 | 288 | } |
@@ -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 |
@@ -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; |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | if ($driverArray) { |
91 | 91 | if (!\is_array($driverArray)) { |
92 | 92 | throw new PhpfastcacheCoreException(\sprintf('The driverRead method returned an unexpected variable type: %s', |
93 | - \gettype($driverArray))); |
|
93 | + \gettype($driverArray))); |
|
94 | 94 | } |
95 | 95 | $driverData = $this->driverUnwrapData($driverArray); |
96 | 96 | |
@@ -155,9 +155,9 @@ discard block |
||
155 | 155 | * Reset the Item |
156 | 156 | */ |
157 | 157 | $item->set(null) |
158 | - ->expiresAfter(\abs((int)$this->getConfig()[ 'defaultTtl' ])) |
|
159 | - ->setHit(false) |
|
160 | - ->setTags([]); |
|
158 | + ->expiresAfter(\abs((int)$this->getConfig()[ 'defaultTtl' ])) |
|
159 | + ->setHit(false) |
|
160 | + ->setTags([]); |
|
161 | 161 | if ($this->getConfigOption( 'itemDetailedDate')) { |
162 | 162 | |
163 | 163 | /** |
@@ -341,8 +341,8 @@ discard block |
||
341 | 341 | $class = new \ReflectionClass((new \ReflectionObject($this))->getNamespaceName() . '\Item'); |
342 | 342 | $itemBatch = $class->newInstanceArgs([$this, $item->getKey()]); |
343 | 343 | $itemBatch->setEventManager($this->eventManager) |
344 | - ->set(new ItemBatch($item->getKey(), new \DateTime())) |
|
345 | - ->expiresAfter($this->getConfigOption('cacheSlamsTimeout')); |
|
344 | + ->set(new ItemBatch($item->getKey(), new \DateTime())) |
|
345 | + ->expiresAfter($this->getConfigOption('cacheSlamsTimeout')); |
|
346 | 346 | |
347 | 347 | /** |
348 | 348 | * 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 | |
@@ -71,9 +71,9 @@ discard block |
||
71 | 71 | * due to performance issue on huge |
72 | 72 | * loop dispatching operations |
73 | 73 | */ |
74 | - if (!isset($this->itemInstances[ $key ])) { |
|
74 | + if (!isset($this->itemInstances[$key])) { |
|
75 | 75 | if (\preg_match('~([' . \preg_quote(self::$unsupportedKeyChars, '~') . ']+)~', $key, $matches)) { |
76 | - 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 | + throw new PhpfastcacheInvalidArgumentException('Unsupported key character detected: "' . $matches[1] . '". Please check: https://github.com/PHPSocialNetwork/phpfastcache/wiki/%5BV6%5D-Unsupported-characters-in-key-identifiers'); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | CacheManager::$ReadHits++; |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | } |
95 | 95 | $driverData = $this->driverUnwrapData($driverArray); |
96 | 96 | |
97 | - if ($this->getConfig()[ 'preventCacheSlams' ]) { |
|
97 | + if ($this->getConfig()['preventCacheSlams']) { |
|
98 | 98 | while ($driverData instanceof ItemBatch) { |
99 | 99 | if ($driverData->getItemDate()->getTimestamp() + $this->getConfigOption('cacheSlamsTimeout') < \time()) { |
100 | 100 | /** |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | $item->set($driverData); |
129 | 129 | $item->expiresAt($this->driverUnwrapEdate($driverArray)); |
130 | 130 | |
131 | - if ($this->getConfigOption( 'itemDetailedDate')) { |
|
131 | + if ($this->getConfigOption('itemDetailedDate')) { |
|
132 | 132 | /** |
133 | 133 | * If the itemDetailedDate has been |
134 | 134 | * set after caching, we MUST inject |
@@ -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->getConfigOption( 'itemDetailedDate')) { |
|
161 | + if ($this->getConfigOption('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 | } |
@@ -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 | |
@@ -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 | } |
417 | 417 | \ 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\Util; |
17 | 17 | |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | } |
56 | 56 | $map = []; |
57 | 57 | |
58 | - if(\is_array($dir) || $dir instanceof \Traversable){ |
|
58 | + if (\is_array($dir) || $dir instanceof \Traversable) { |
|
59 | 59 | foreach ($dir as $file) { |
60 | 60 | if (!$file->isFile()) { |
61 | 61 | continue; |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | \gc_mem_caches(); |
71 | 71 | } |
72 | 72 | foreach ($classes as $class) { |
73 | - $map[ $class ] = $path; |
|
73 | + $map[$class] = $path; |
|
74 | 74 | } |
75 | 75 | } |
76 | 76 | } |
@@ -94,19 +94,19 @@ discard block |
||
94 | 94 | $tokens = \token_get_all($contents); |
95 | 95 | $classes = []; |
96 | 96 | $namespace = ''; |
97 | - for ($i = 0; isset($tokens[ $i ]); ++$i) { |
|
98 | - $token = $tokens[ $i ]; |
|
99 | - if (!isset($token[ 1 ])) { |
|
97 | + for ($i = 0; isset($tokens[$i]); ++$i) { |
|
98 | + $token = $tokens[$i]; |
|
99 | + if (!isset($token[1])) { |
|
100 | 100 | continue; |
101 | 101 | } |
102 | 102 | $class = ''; |
103 | - switch ($token[ 0 ]) { |
|
103 | + switch ($token[0]) { |
|
104 | 104 | case T_NAMESPACE: |
105 | 105 | $namespace = ''; |
106 | 106 | // If there is a namespace, extract it |
107 | - while (isset($tokens[ ++$i ][ 1 ])) { |
|
108 | - if (\in_array($tokens[ $i ][ 0 ], [T_STRING, T_NS_SEPARATOR])) { |
|
109 | - $namespace .= $tokens[ $i ][ 1 ]; |
|
107 | + while (isset($tokens[ ++$i][1])) { |
|
108 | + if (\in_array($tokens[$i][0], [T_STRING, T_NS_SEPARATOR])) { |
|
109 | + $namespace .= $tokens[$i][1]; |
|
110 | 110 | } |
111 | 111 | } |
112 | 112 | $namespace .= '\\'; |
@@ -117,13 +117,13 @@ discard block |
||
117 | 117 | // Skip usage of ::class constant |
118 | 118 | $isClassConstant = false; |
119 | 119 | for ($j = $i - 1; $j > 0; --$j) { |
120 | - if (!isset($tokens[ $j ][ 1 ])) { |
|
120 | + if (!isset($tokens[$j][1])) { |
|
121 | 121 | break; |
122 | 122 | } |
123 | - if (T_DOUBLE_COLON === $tokens[ $j ][ 0 ]) { |
|
123 | + if (T_DOUBLE_COLON === $tokens[$j][0]) { |
|
124 | 124 | $isClassConstant = true; |
125 | 125 | break; |
126 | - } elseif (!\in_array($tokens[ $j ][ 0 ], [T_WHITESPACE, T_DOC_COMMENT, T_COMMENT], false)) { |
|
126 | + } elseif (!\in_array($tokens[$j][0], [T_WHITESPACE, T_DOC_COMMENT, T_COMMENT], false)) { |
|
127 | 127 | break; |
128 | 128 | } |
129 | 129 | } |
@@ -131,11 +131,11 @@ discard block |
||
131 | 131 | break; |
132 | 132 | } |
133 | 133 | // Find the classname |
134 | - while (isset($tokens[ ++$i ][ 1 ])) { |
|
135 | - $t = $tokens[ $i ]; |
|
136 | - if (T_STRING === $t[ 0 ]) { |
|
137 | - $class .= $t[ 1 ]; |
|
138 | - } elseif ('' !== $class && T_WHITESPACE === $t[ 0 ]) { |
|
134 | + while (isset($tokens[ ++$i][1])) { |
|
135 | + $t = $tokens[$i]; |
|
136 | + if (T_STRING === $t[0]) { |
|
137 | + $class .= $t[1]; |
|
138 | + } elseif ('' !== $class && T_WHITESPACE === $t[0]) { |
|
139 | 139 | break; |
140 | 140 | } |
141 | 141 | } |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | use Phpfastcache\Core\Pool\{DriverBaseTrait, ExtendedCacheItemPoolInterface}; |
19 | 19 | use Phpfastcache\Entities\DriverStatistic; |
20 | 20 | use Phpfastcache\Exceptions\{ |
21 | - PhpfastcacheInvalidArgumentException |
|
21 | + PhpfastcacheInvalidArgumentException |
|
22 | 22 | }; |
23 | 23 | use Psr\Cache\CacheItemInterface; |
24 | 24 | |
@@ -121,9 +121,9 @@ discard block |
||
121 | 121 | $date = (new \DateTime())->setTimestamp(\time() - $info[ 'total_cache_uptime' ]); |
122 | 122 | |
123 | 123 | return (new DriverStatistic()) |
124 | - ->setInfo(\sprintf("The Wincache daemon is up since %s.\n For more information see RawData.", $date->format(DATE_RFC2822))) |
|
125 | - ->setSize($memInfo[ 'memory_free' ] - $memInfo[ 'memory_total' ]) |
|
126 | - ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
127 | - ->setRawData($memInfo); |
|
124 | + ->setInfo(\sprintf("The Wincache daemon is up since %s.\n For more information see RawData.", $date->format(DATE_RFC2822))) |
|
125 | + ->setSize($memInfo[ 'memory_free' ] - $memInfo[ 'memory_total' ]) |
|
126 | + ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
127 | + ->setRawData($memInfo); |
|
128 | 128 | } |
129 | 129 | } |
130 | 130 | \ 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\Drivers\Wincache; |
17 | 17 | |
@@ -118,11 +118,11 @@ discard block |
||
118 | 118 | { |
119 | 119 | $memInfo = wincache_ucache_meminfo(); |
120 | 120 | $info = wincache_ucache_info(); |
121 | - $date = (new \DateTime())->setTimestamp(\time() - $info[ 'total_cache_uptime' ]); |
|
121 | + $date = (new \DateTime())->setTimestamp(\time() - $info['total_cache_uptime']); |
|
122 | 122 | |
123 | 123 | return (new DriverStatistic()) |
124 | 124 | ->setInfo(\sprintf("The Wincache daemon is up since %s.\n For more information see RawData.", $date->format(DATE_RFC2822))) |
125 | - ->setSize($memInfo[ 'memory_free' ] - $memInfo[ 'memory_total' ]) |
|
125 | + ->setSize($memInfo['memory_free'] - $memInfo['memory_total']) |
|
126 | 126 | ->setData(\implode(', ', \array_keys($this->itemInstances))) |
127 | 127 | ->setRawData($memInfo); |
128 | 128 | } |
@@ -17,11 +17,11 @@ discard block |
||
17 | 17 | |
18 | 18 | use Phpfastcache\Config\ConfigurationOption; |
19 | 19 | use Phpfastcache\Core\Pool\{ |
20 | - DriverBaseTrait, ExtendedCacheItemPoolInterface |
|
20 | + DriverBaseTrait, ExtendedCacheItemPoolInterface |
|
21 | 21 | }; |
22 | 22 | use Phpfastcache\Entities\DriverStatistic; |
23 | 23 | use Phpfastcache\Exceptions\{ |
24 | - PhpfastcacheInvalidArgumentException, PhpfastcacheLogicException |
|
24 | + PhpfastcacheInvalidArgumentException, PhpfastcacheLogicException |
|
25 | 25 | }; |
26 | 26 | use Phpfastcache\Util\ArrayObject; |
27 | 27 | use Psr\Cache\CacheItemInterface; |
@@ -162,10 +162,10 @@ discard block |
||
162 | 162 | $date = (new \DateTime())->setTimestamp(\time() - $info[ 'uptime_in_seconds' ]); |
163 | 163 | |
164 | 164 | return (new DriverStatistic()) |
165 | - ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
166 | - ->setRawData($info) |
|
167 | - ->setSize((int)$info[ 'used_memory' ]) |
|
168 | - ->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.", |
|
165 | + ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
166 | + ->setRawData($info) |
|
167 | + ->setSize((int)$info[ 'used_memory' ]) |
|
168 | + ->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.", |
|
169 | 169 | $info[ 'redis_version' ], $date->format(DATE_RFC2822))); |
170 | 170 | } |
171 | 171 | } |
172 | 172 | \ 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\Drivers\Redis; |
17 | 17 | |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | if ($this->config->getOption('path')) { |
64 | 64 | $isConnected = $this->instance->connect($this->config->getOption('path')); |
65 | 65 | } else { |
66 | - $isConnected = $this->instance->connect($this->config->getOption('host'), $this->config->getOption('port'), (int)$this->config->getOption('timeout')); |
|
66 | + $isConnected = $this->instance->connect($this->config->getOption('host'), $this->config->getOption('port'), (int) $this->config->getOption('timeout')); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | if (!$isConnected && $this->config->getOption('path')) { |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | * Check for Cross-Driver type confusion |
133 | 133 | */ |
134 | 134 | if ($item instanceof Item) { |
135 | - return (bool)$this->instance->del($item->getKey()); |
|
135 | + return (bool) $this->instance->del($item->getKey()); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | throw new PhpfastcacheInvalidArgumentException('Cross-Driver type confusion detected'); |
@@ -159,13 +159,13 @@ discard block |
||
159 | 159 | { |
160 | 160 | // used_memory |
161 | 161 | $info = $this->instance->info(); |
162 | - $date = (new \DateTime())->setTimestamp(\time() - $info[ 'uptime_in_seconds' ]); |
|
162 | + $date = (new \DateTime())->setTimestamp(\time() - $info['uptime_in_seconds']); |
|
163 | 163 | |
164 | 164 | return (new DriverStatistic()) |
165 | 165 | ->setData(\implode(', ', \array_keys($this->itemInstances))) |
166 | 166 | ->setRawData($info) |
167 | - ->setSize((int)$info[ 'used_memory' ]) |
|
167 | + ->setSize((int) $info['used_memory']) |
|
168 | 168 | ->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.", |
169 | - $info[ 'redis_version' ], $date->format(DATE_RFC2822))); |
|
169 | + $info['redis_version'], $date->format(DATE_RFC2822))); |
|
170 | 170 | } |
171 | 171 | } |
172 | 172 | \ 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 @@ 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.'); |