@@ -18,7 +18,7 @@ |
||
18 | 18 | use Phpfastcache\Core\Pool\ExtendedCacheItemPoolInterface; |
19 | 19 | use Phpfastcache\Drivers\Zendshm\Driver as ZendSHMDriver; |
20 | 20 | use Phpfastcache\Exceptions\{ |
21 | - phpFastCacheInvalidArgumentException, phpFastCacheInvalidArgumentTypeException |
|
21 | + phpFastCacheInvalidArgumentException, phpFastCacheInvalidArgumentTypeException |
|
22 | 22 | }; |
23 | 23 | |
24 | 24 | /** |
@@ -10,7 +10,7 @@ |
||
10 | 10 | * @author Lucas Brucksch <[email protected]> |
11 | 11 | * |
12 | 12 | */ |
13 | -declare(strict_types=1); |
|
13 | +declare(strict_types = 1); |
|
14 | 14 | |
15 | 15 | namespace Phpfastcache\Drivers\Zendshm; |
16 | 16 |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | use Phpfastcache\Core\Pool\{DriverBaseTrait, ExtendedCacheItemPoolInterface}; |
18 | 18 | use Phpfastcache\Entities\DriverStatistic; |
19 | 19 | use Phpfastcache\Exceptions\{ |
20 | - phpFastCacheInvalidArgumentException |
|
20 | + phpFastCacheInvalidArgumentException |
|
21 | 21 | }; |
22 | 22 | use Psr\Cache\CacheItemInterface; |
23 | 23 | |
@@ -131,9 +131,9 @@ discard block |
||
131 | 131 | { |
132 | 132 | $stats = (array)zend_shm_cache_info(); |
133 | 133 | return (new DriverStatistic()) |
134 | - ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
135 | - ->setInfo(\sprintf("The Zend memory have %d item(s) in cache.\n For more information see RawData.", $stats[ 'items_total' ])) |
|
136 | - ->setRawData($stats) |
|
137 | - ->setSize($stats[ 'memory_total' ]); |
|
134 | + ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
135 | + ->setInfo(\sprintf("The Zend memory have %d item(s) in cache.\n For more information see RawData.", $stats[ 'items_total' ])) |
|
136 | + ->setRawData($stats) |
|
137 | + ->setSize($stats[ 'memory_total' ]); |
|
138 | 138 | } |
139 | 139 | } |
140 | 140 | \ No newline at end of file |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | * @author Lucas Brucksch <[email protected]> |
11 | 11 | * |
12 | 12 | */ |
13 | -declare(strict_types=1); |
|
13 | +declare(strict_types = 1); |
|
14 | 14 | |
15 | 15 | namespace Phpfastcache\Drivers\Zendshm; |
16 | 16 | |
@@ -129,11 +129,11 @@ discard block |
||
129 | 129 | */ |
130 | 130 | public function getStats(): DriverStatistic |
131 | 131 | { |
132 | - $stats = (array)zend_shm_cache_info(); |
|
132 | + $stats = (array) zend_shm_cache_info(); |
|
133 | 133 | return (new DriverStatistic()) |
134 | 134 | ->setData(\implode(', ', \array_keys($this->itemInstances))) |
135 | - ->setInfo(\sprintf("The Zend memory have %d item(s) in cache.\n For more information see RawData.", $stats[ 'items_total' ])) |
|
135 | + ->setInfo(\sprintf("The Zend memory have %d item(s) in cache.\n For more information see RawData.", $stats['items_total'])) |
|
136 | 136 | ->setRawData($stats) |
137 | - ->setSize($stats[ 'memory_total' ]); |
|
137 | + ->setSize($stats['memory_total']); |
|
138 | 138 | } |
139 | 139 | } |
140 | 140 | \ No newline at end of file |
@@ -19,7 +19,7 @@ |
||
19 | 19 | use Phpfastcache\Core\Pool\ExtendedCacheItemPoolInterface; |
20 | 20 | use Phpfastcache\Drivers\Leveldb\Driver as LeveldbDriver; |
21 | 21 | use Phpfastcache\Exceptions\{ |
22 | - phpFastCacheInvalidArgumentException, phpFastCacheInvalidArgumentTypeException |
|
22 | + phpFastCacheInvalidArgumentException, phpFastCacheInvalidArgumentTypeException |
|
23 | 23 | }; |
24 | 24 | |
25 | 25 | /** |
@@ -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\Drivers\Leveldb; |
17 | 17 |
@@ -18,7 +18,7 @@ |
||
18 | 18 | use LevelDB as LeveldbClient; |
19 | 19 | use Phpfastcache\Core\Pool\{DriverBaseTrait, ExtendedCacheItemPoolInterface, IO\IOHelperTrait}; |
20 | 20 | use Phpfastcache\Exceptions\{ |
21 | - phpFastCacheInvalidArgumentException, phpFastCacheLogicException |
|
21 | + phpFastCacheInvalidArgumentException, phpFastCacheLogicException |
|
22 | 22 | }; |
23 | 23 | use Psr\Cache\CacheItemInterface; |
24 | 24 |
@@ -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\Leveldb; |
17 | 17 | |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | * Check for Cross-Driver type confusion |
85 | 85 | */ |
86 | 86 | if ($item instanceof Item) { |
87 | - return (bool)$this->instance->set($item->getKey(), $this->encode($this->driverPreWrap($item))); |
|
87 | + return (bool) $this->instance->set($item->getKey(), $this->encode($this->driverPreWrap($item))); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | throw new phpFastCacheInvalidArgumentException('Cross-Driver type confusion detected'); |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | $this->instance->close(); |
117 | 117 | $this->instance = null; |
118 | 118 | } |
119 | - $result = (bool)LeveldbClient::destroy($this->getLeveldbFile()); |
|
119 | + $result = (bool) LeveldbClient::destroy($this->getLeveldbFile()); |
|
120 | 120 | $this->driverConnect(); |
121 | 121 | |
122 | 122 | return $result; |
@@ -14,4 +14,4 @@ |
||
14 | 14 | * @package phpFastCache\Config |
15 | 15 | * @see ConfigurationOption |
16 | 16 | */ |
17 | -class Config extends ConfigurationOption{} |
|
18 | 17 | \ No newline at end of file |
18 | +class Config extends ConfigurationOption {} |
|
19 | 19 | \ No newline at end of file |
@@ -94,9 +94,9 @@ discard block |
||
94 | 94 | */ |
95 | 95 | if(array_diff_key($array, get_object_vars($this))){ |
96 | 96 | throw new phpFastCacheInvalidConfigurationException(sprintf( |
97 | - 'Invalid option(s) for the config %s: %s', |
|
98 | - static::class, |
|
99 | - implode(', ', array_keys(array_diff_key($array, get_object_vars($this)))) |
|
97 | + 'Invalid option(s) for the config %s: %s', |
|
98 | + static::class, |
|
99 | + implode(', ', array_keys(array_diff_key($array, get_object_vars($this)))) |
|
100 | 100 | )); |
101 | 101 | } |
102 | 102 | |
@@ -128,10 +128,10 @@ discard block |
||
128 | 128 | $typeHintExpected = ($parameter instanceof \ReflectionParameter ? ($parameter->getType() === 'object' ? $parameter->getClass() : $parameter->getType()) : 'Unknown type'); |
129 | 129 | |
130 | 130 | throw new phpFastCacheInvalidConfigurationException(sprintf( |
131 | - 'Invalid type hint found for "%s", expected "%s" got "%s"', |
|
132 | - lcfirst(substr($method, 3)), |
|
133 | - $typeHintExpected, |
|
134 | - $typeHintGot |
|
131 | + 'Invalid type hint found for "%s", expected "%s" got "%s"', |
|
132 | + lcfirst(substr($method, 3)), |
|
133 | + $typeHintExpected, |
|
134 | + $typeHintGot |
|
135 | 135 | )); |
136 | 136 | } |
137 | 137 | } |
@@ -396,10 +396,10 @@ discard block |
||
396 | 396 | * by opening a pull request :) |
397 | 397 | */ |
398 | 398 | static $safeFileExtensions = [ |
399 | - 'txt', |
|
400 | - 'cache', |
|
401 | - 'db', |
|
402 | - 'pfc', |
|
399 | + 'txt', |
|
400 | + 'cache', |
|
401 | + 'db', |
|
402 | + 'pfc', |
|
403 | 403 | ]; |
404 | 404 | |
405 | 405 | if (\strpos($cacheFileExtension, '.') !== false) { |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | } |
408 | 408 | if (!\in_array($cacheFileExtension, $safeFileExtensions, true)) { |
409 | 409 | throw new phpFastCacheInvalidConfigurationException( |
410 | - "{$cacheFileExtension} is not a safe extension, currently allowed extension: " . \implode(', ', $safeFileExtensions) |
|
410 | + "{$cacheFileExtension} is not a safe extension, currently allowed extension: " . \implode(', ', $safeFileExtensions) |
|
411 | 411 | ); |
412 | 412 | } |
413 | 413 |
@@ -86,33 +86,33 @@ discard block |
||
86 | 86 | public function __construct(...$args) |
87 | 87 | { |
88 | 88 | parent::__construct(...$args); |
89 | - $array =& $this->getArray(); |
|
89 | + $array = & $this->getArray(); |
|
90 | 90 | |
91 | 91 | /** |
92 | 92 | * Detect unwanted keys and throw an exception. |
93 | 93 | * No more kidding now, it's 21th century. |
94 | 94 | */ |
95 | - if(array_diff_key($array, get_object_vars($this))){ |
|
95 | + if (array_diff_key($array, get_object_vars($this))) { |
|
96 | 96 | throw new phpFastCacheInvalidConfigurationException(sprintf( |
97 | 97 | 'Invalid option(s) for the config %s: %s', |
98 | 98 | static::class, |
99 | - implode(', ', array_keys(array_diff_key($array, get_object_vars($this)))) |
|
99 | + implode(', ', array_keys(array_diff_key($array, get_object_vars($this)))) |
|
100 | 100 | )); |
101 | 101 | } |
102 | 102 | |
103 | 103 | foreach (get_object_vars($this) as $property => $value) { |
104 | 104 | |
105 | - if(array_key_exists($property, $array)){ |
|
106 | - $this->$property = &$array[ $property ]; |
|
107 | - }else{ |
|
108 | - $array[ $property ] = &$this->$property; |
|
105 | + if (array_key_exists($property, $array)) { |
|
106 | + $this->$property = &$array[$property]; |
|
107 | + } else { |
|
108 | + $array[$property] = &$this->$property; |
|
109 | 109 | } |
110 | 110 | } |
111 | 111 | |
112 | 112 | foreach (get_class_methods($this) as $method) { |
113 | - if(strpos($method, 'set') === 0){ |
|
113 | + if (strpos($method, 'set') === 0) { |
|
114 | 114 | $value = null; |
115 | - try{ |
|
115 | + try { |
|
116 | 116 | /** |
117 | 117 | * We use property instead of getter |
118 | 118 | * because of is/get conditions and |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | */ |
122 | 122 | $value = $this->{lcfirst(substr($method, 3))}; |
123 | 123 | $this->{$method}($value); |
124 | - }catch(\TypeError $e){ |
|
124 | + } catch (\TypeError $e) { |
|
125 | 125 | $typeHintGot = \is_object($value) ? \get_class($value) : \gettype($value); |
126 | 126 | $reflectionMethod = new \ReflectionMethod($this, $method); |
127 | 127 | $parameter = $reflectionMethod->getParameters()[0] ?? null; |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | |
105 | 105 | if(array_key_exists($property, $array)){ |
106 | 106 | $this->$property = &$array[ $property ]; |
107 | - }else{ |
|
107 | + } else{ |
|
108 | 108 | $array[ $property ] = &$this->$property; |
109 | 109 | } |
110 | 110 | } |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | */ |
122 | 122 | $value = $this->{lcfirst(substr($method, 3))}; |
123 | 123 | $this->{$method}($value); |
124 | - }catch(\TypeError $e){ |
|
124 | + } catch(\TypeError $e){ |
|
125 | 125 | $typeHintGot = \is_object($value) ? \get_class($value) : \gettype($value); |
126 | 126 | $reflectionMethod = new \ReflectionMethod($this, $method); |
127 | 127 | $parameter = $reflectionMethod->getParameters()[0] ?? null; |
@@ -188,11 +188,11 @@ |
||
188 | 188 | $this->printSkipText('A driver could not be initialized due to missing requirement: ' . $exception->getMessage()); |
189 | 189 | }else{ |
190 | 190 | $this->printFailText(sprintf( |
191 | - 'Uncaught exception "%s" in "%s" line %d with message: "%s"', |
|
192 | - \get_class($exception), |
|
193 | - $exception->getFile(), |
|
194 | - $exception->getLine(), |
|
195 | - $exception->getMessage() |
|
191 | + 'Uncaught exception "%s" in "%s" line %d with message: "%s"', |
|
192 | + \get_class($exception), |
|
193 | + $exception->getFile(), |
|
194 | + $exception->getLine(), |
|
195 | + $exception->getMessage() |
|
196 | 196 | )); |
197 | 197 | } |
198 | 198 | $this->terminateTest(); |
@@ -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\Helper; |
17 | 17 | |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | */ |
36 | 36 | public function __construct($testName) |
37 | 37 | { |
38 | - $this->printText('[PhpFastCache CORE v' . Api::getPhpFastCacheVersion() . Api::getPhpFastCacheGitHeadHash() . ']', true); |
|
38 | + $this->printText('[PhpFastCache CORE v' . Api::getPhpFastCacheVersion() . Api::getPhpFastCacheGitHeadHash() . ']', true); |
|
39 | 39 | $this->printText('[PhpFastCache API v' . Api::getVersion() . ']', true); |
40 | 40 | $this->printText('[PHP v' . PHP_VERSION . ']', true); |
41 | 41 | $this->printText("[Begin Test: '{$testName}']"); |
@@ -184,9 +184,9 @@ discard block |
||
184 | 184 | * @param \Throwable $exception |
185 | 185 | */ |
186 | 186 | public function exceptionHandler(\Throwable $exception) { |
187 | - if($exception instanceof phpFastCacheDriverCheckException){ |
|
187 | + if ($exception instanceof phpFastCacheDriverCheckException) { |
|
188 | 188 | $this->printSkipText('A driver could not be initialized due to missing requirement: ' . $exception->getMessage()); |
189 | - }else{ |
|
189 | + } else { |
|
190 | 190 | $this->printFailText(sprintf( |
191 | 191 | 'Uncaught exception "%s" in "%s" line %d with message: "%s"', |
192 | 192 | \get_class($exception), |
@@ -186,7 +186,7 @@ |
||
186 | 186 | public function exceptionHandler(\Throwable $exception) { |
187 | 187 | if($exception instanceof phpFastCacheDriverCheckException){ |
188 | 188 | $this->printSkipText('A driver could not be initialized due to missing requirement: ' . $exception->getMessage()); |
189 | - }else{ |
|
189 | + } else{ |
|
190 | 190 | $this->printFailText(sprintf( |
191 | 191 | 'Uncaught exception "%s" in "%s" line %d with message: "%s"', |
192 | 192 | \get_class($exception), |
@@ -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\Helper; |
17 | 17 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | if (!$cacheItem->isHit()) { |
51 | 51 | $cacheItem->set($callback()); |
52 | - if($expiresAfter){ |
|
52 | + if ($expiresAfter) { |
|
53 | 53 | $cacheItem->expiresAfter($expiresAfter); |
54 | 54 | } |
55 | 55 | $this->cacheInstance->save($cacheItem); |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | use Phpfastcache\Core\Item\ExtendedCacheItemInterface; |
20 | 20 | use Phpfastcache\Core\Pool\ExtendedCacheItemPoolInterface; |
21 | 21 | use Phpfastcache\Exceptions\{ |
22 | - phpFastCacheDriverCheckException, phpFastCacheInvalidArgumentException, phpFastCacheRootException, phpFastCacheSimpleCacheException |
|
22 | + phpFastCacheDriverCheckException, phpFastCacheInvalidArgumentException, phpFastCacheRootException, phpFastCacheSimpleCacheException |
|
23 | 23 | }; |
24 | 24 | use Psr\SimpleCache\CacheInterface; |
25 | 25 | |
@@ -76,8 +76,8 @@ discard block |
||
76 | 76 | { |
77 | 77 | try { |
78 | 78 | $cacheItem = $this->internalCacheInstance |
79 | - ->getItem($key) |
|
80 | - ->set($value); |
|
79 | + ->getItem($key) |
|
80 | + ->set($value); |
|
81 | 81 | if (\is_int($ttl) && $ttl <= 0) { |
82 | 82 | $cacheItem->expiresAt((new \DateTime('@0'))); |
83 | 83 | } elseif (\is_int($ttl) || $ttl instanceof \DateInterval) { |
@@ -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\Helper; |
17 | 17 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | public function getMultiple($keys, $default = null) |
126 | 126 | { |
127 | 127 | try { |
128 | - return array_map(function (ExtendedCacheItemInterface $item) { |
|
128 | + return array_map(function(ExtendedCacheItemInterface $item) { |
|
129 | 129 | return $item->get(); |
130 | 130 | }, $this->internalCacheInstance->getItems($keys)); |
131 | 131 | } catch (phpFastCacheInvalidArgumentException $e) { |