@@ -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\Ssdb; |
| 17 | 17 | |
@@ -57,9 +57,9 @@ discard block |
||
| 57 | 57 | try { |
| 58 | 58 | $clientConfig = $this->getConfig(); |
| 59 | 59 | |
| 60 | - $this->instance = new SimpleSSDB($clientConfig[ 'host' ], $clientConfig[ 'port' ], $clientConfig[ 'timeout' ]); |
|
| 61 | - if (!empty($clientConfig[ 'password' ])) { |
|
| 62 | - $this->instance->auth($clientConfig[ 'password' ]); |
|
| 60 | + $this->instance = new SimpleSSDB($clientConfig['host'], $clientConfig['port'], $clientConfig['timeout']); |
|
| 61 | + if (!empty($clientConfig['password'])) { |
|
| 62 | + $this->instance->auth($clientConfig['password']); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | if (!$this->instance) { |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | * Data returned by Ssdb are very poorly formatted |
| 147 | 147 | * using hardcoded offset of pair key-value :-( |
| 148 | 148 | */ |
| 149 | - $stat->setInfo(\sprintf("Ssdb-server v%s with a total of %s call(s).\n For more information see RawData.", $info[ 2 ], $info[ 6 ])) |
|
| 149 | + $stat->setInfo(\sprintf("Ssdb-server v%s with a total of %s call(s).\n For more information see RawData.", $info[2], $info[6])) |
|
| 150 | 150 | ->setRawData($info) |
| 151 | 151 | ->setData(\implode(', ', \array_keys($this->itemInstances))) |
| 152 | 152 | ->setSize($this->instance->dbsize()); |
@@ -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, PhpfastcacheDriverCheckException, PhpfastcacheDriverException |
|
| 21 | + PhpfastcacheInvalidArgumentException, PhpfastcacheDriverCheckException, PhpfastcacheDriverException |
|
| 22 | 22 | }; |
| 23 | 23 | use Phpfastcache\Util\ArrayObject; |
| 24 | 24 | use phpssdb\Core\{SimpleSSDB, SSDBException}; |
@@ -147,9 +147,9 @@ discard block |
||
| 147 | 147 | * using hardcoded offset of pair key-value :-( |
| 148 | 148 | */ |
| 149 | 149 | $stat->setInfo(\sprintf("Ssdb-server v%s with a total of %s call(s).\n For more information see RawData.", $info[ 2 ], $info[ 6 ])) |
| 150 | - ->setRawData($info) |
|
| 151 | - ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
| 152 | - ->setSize($this->instance->dbsize()); |
|
| 150 | + ->setRawData($info) |
|
| 151 | + ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
| 152 | + ->setSize($this->instance->dbsize()); |
|
| 153 | 153 | |
| 154 | 154 | return $stat; |
| 155 | 155 | } |
@@ -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\Memstatic; |
| 17 | 17 | |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | use Phpfastcache\Core\Pool\ExtendedCacheItemPoolInterface; |
| 20 | 20 | use Phpfastcache\Drivers\Memstatic\Driver as MemstaticDriver; |
| 21 | 21 | use Phpfastcache\Exceptions\{ |
| 22 | - PhpfastcacheInvalidArgumentException, PhpfastcacheInvalidArgumentTypeException |
|
| 22 | + PhpfastcacheInvalidArgumentException, PhpfastcacheInvalidArgumentTypeException |
|
| 23 | 23 | }; |
| 24 | 24 | |
| 25 | 25 | /** |
@@ -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\Memstatic; |
| 17 | 17 | |
@@ -60,8 +60,8 @@ discard block |
||
| 60 | 60 | protected function driverRead(CacheItemInterface $item) |
| 61 | 61 | { |
| 62 | 62 | $key = \md5($item->getKey()); |
| 63 | - if (isset($this->staticStack[ $key ])) { |
|
| 64 | - return $this->staticStack[ $key ]; |
|
| 63 | + if (isset($this->staticStack[$key])) { |
|
| 64 | + return $this->staticStack[$key]; |
|
| 65 | 65 | } |
| 66 | 66 | return null; |
| 67 | 67 | } |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | * Check for Cross-Driver type confusion |
| 78 | 78 | */ |
| 79 | 79 | if ($item instanceof Item) { |
| 80 | - $this->staticStack[ \md5($item->getKey()) ] = $this->driverPreWrap($item); |
|
| 80 | + $this->staticStack[\md5($item->getKey())] = $this->driverPreWrap($item); |
|
| 81 | 81 | return true; |
| 82 | 82 | } |
| 83 | 83 | |
@@ -96,8 +96,8 @@ discard block |
||
| 96 | 96 | */ |
| 97 | 97 | if ($item instanceof Item) { |
| 98 | 98 | $key = \md5($item->getKey()); |
| 99 | - if (isset($this->staticStack[ $key ])) { |
|
| 100 | - unset($this->staticStack[ $key ]); |
|
| 99 | + if (isset($this->staticStack[$key])) { |
|
| 100 | + unset($this->staticStack[$key]); |
|
| 101 | 101 | return true; |
| 102 | 102 | } |
| 103 | 103 | return false; |
@@ -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 | |
@@ -129,9 +129,9 @@ discard block |
||
| 129 | 129 | { |
| 130 | 130 | $stat = new DriverStatistic(); |
| 131 | 131 | $stat->setInfo('[Memstatic] A memory static driver') |
| 132 | - ->setSize(mb_strlen(\serialize($this->staticStack))) |
|
| 133 | - ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
| 134 | - ->setRawData($this->staticStack); |
|
| 132 | + ->setSize(mb_strlen(\serialize($this->staticStack))) |
|
| 133 | + ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
| 134 | + ->setRawData($this->staticStack); |
|
| 135 | 135 | |
| 136 | 136 | return $stat; |
| 137 | 137 | } |
@@ -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\Memcached; |
| 17 | 17 | |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | use Phpfastcache\Core\Pool\ExtendedCacheItemPoolInterface; |
| 20 | 20 | use Phpfastcache\Drivers\Memcached\Driver as MemcachedDriver; |
| 21 | 21 | use Phpfastcache\Exceptions\{ |
| 22 | - PhpfastcacheInvalidArgumentException, PhpfastcacheInvalidArgumentTypeException |
|
| 22 | + PhpfastcacheInvalidArgumentException, PhpfastcacheInvalidArgumentTypeException |
|
| 23 | 23 | }; |
| 24 | 24 | |
| 25 | 25 | /** |
@@ -152,7 +152,7 @@ |
||
| 152 | 152 | */ |
| 153 | 153 | if(!empty($server[ 'path' ]) && !$this->instance->addServer($server[ 'path' ], 0)){ |
| 154 | 154 | $this->fallback = true; |
| 155 | - }else if (!empty($server[ 'host' ]) && !$this->instance->addServer($server[ 'host' ], $server[ 'port' ])) { |
|
| 155 | + } else if (!empty($server[ 'host' ]) && !$this->instance->addServer($server[ 'host' ], $server[ 'port' ])) { |
|
| 156 | 156 | $this->fallback = true; |
| 157 | 157 | } |
| 158 | 158 | |
@@ -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\Memcached; |
| 17 | 17 | |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | 'path' => !empty($this->config->getOption('path')) ? $this->config->getOption('path') : false, |
| 75 | 75 | 'port' => !empty($this->config->getOption('port')) ? $this->config->getOption('port') : 11211, |
| 76 | 76 | 'saslUser' => !empty($this->config->getOption('saslUser')) ? $this->config->getOption('saslUser') : false, |
| 77 | - 'saslPassword' =>!empty($this->config->getOption('saslPassword')) ? $this->config->getOption('saslPassword'): false, |
|
| 77 | + 'saslPassword' =>!empty($this->config->getOption('saslPassword')) ? $this->config->getOption('saslPassword') : false, |
|
| 78 | 78 | ], |
| 79 | 79 | ]; |
| 80 | 80 | } |
@@ -84,14 +84,14 @@ discard block |
||
| 84 | 84 | /** |
| 85 | 85 | * If path is provided we consider it as an UNIX Socket |
| 86 | 86 | */ |
| 87 | - if(!empty($server[ 'path' ]) && !$this->instance->addServer($server[ 'path' ], 0)){ |
|
| 87 | + if (!empty($server['path']) && !$this->instance->addServer($server['path'], 0)) { |
|
| 88 | 88 | $this->fallback = true; |
| 89 | - }else if (!empty($server[ 'host' ]) && !$this->instance->addServer($server[ 'host' ], $server[ 'port' ])) { |
|
| 89 | + } else if (!empty($server['host']) && !$this->instance->addServer($server['host'], $server['port'])) { |
|
| 90 | 90 | $this->fallback = true; |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - if (!empty($server[ 'saslUser' ]) && !empty($server[ 'saslPassword' ])) { |
|
| 94 | - $this->instance->setSaslAuthData($server[ 'saslUser' ], $server[ 'saslPassword' ]); |
|
| 93 | + if (!empty($server['saslUser']) && !empty($server['saslPassword'])) { |
|
| 94 | + $this->instance->setSaslAuthData($server['saslUser'], $server['saslPassword']); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | } catch (\Exception $e) { |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | * any error if not connected ... |
| 105 | 105 | */ |
| 106 | 106 | $version = $this->instance->getVersion(); |
| 107 | - if(!$version || $this->instance->getResultCode() !== MemcachedSoftware::RES_SUCCESS){ |
|
| 107 | + if (!$version || $this->instance->getResultCode() !== MemcachedSoftware::RES_SUCCESS) { |
|
| 108 | 108 | throw new PhpfastcacheDriverException('Memcached seems to not be connected'); |
| 109 | 109 | } |
| 110 | 110 | return true; |
@@ -187,16 +187,16 @@ discard block |
||
| 187 | 187 | public function getStats(): DriverStatistic |
| 188 | 188 | { |
| 189 | 189 | $stats = current($this->instance->getStats()); |
| 190 | - $stats[ 'uptime' ] = (isset($stats[ 'uptime' ]) ? $stats[ 'uptime' ] : 0); |
|
| 191 | - $stats[ 'version' ] = (isset($stats[ 'version' ]) ? $stats[ 'version' ] : $this->instance->getVersion()); |
|
| 192 | - $stats[ 'bytes' ] = (isset($stats[ 'bytes' ]) ? $stats[ 'version' ] : 0); |
|
| 190 | + $stats['uptime'] = (isset($stats['uptime']) ? $stats['uptime'] : 0); |
|
| 191 | + $stats['version'] = (isset($stats['version']) ? $stats['version'] : $this->instance->getVersion()); |
|
| 192 | + $stats['bytes'] = (isset($stats['bytes']) ? $stats['version'] : 0); |
|
| 193 | 193 | |
| 194 | - $date = (new \DateTime())->setTimestamp(\time() - $stats[ 'uptime' ]); |
|
| 194 | + $date = (new \DateTime())->setTimestamp(\time() - $stats['uptime']); |
|
| 195 | 195 | |
| 196 | 196 | return (new DriverStatistic()) |
| 197 | 197 | ->setData(\implode(', ', \array_keys($this->itemInstances))) |
| 198 | - ->setInfo(\sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats[ 'version' ], $date->format(DATE_RFC2822))) |
|
| 198 | + ->setInfo(\sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats['version'], $date->format(DATE_RFC2822))) |
|
| 199 | 199 | ->setRawData($stats) |
| 200 | - ->setSize((int)$stats[ 'bytes' ]); |
|
| 200 | + ->setSize((int) $stats['bytes']); |
|
| 201 | 201 | } |
| 202 | 202 | } |
| 203 | 203 | \ No newline at end of file |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | use Phpfastcache\Core\Pool\{DriverBaseTrait, ExtendedCacheItemPoolInterface}; |
| 21 | 21 | use Phpfastcache\Entities\DriverStatistic; |
| 22 | 22 | use Phpfastcache\Exceptions\{ |
| 23 | - PhpfastcacheInvalidArgumentException, PhpfastcacheDriverException |
|
| 23 | + PhpfastcacheInvalidArgumentException, PhpfastcacheDriverException |
|
| 24 | 24 | }; |
| 25 | 25 | use Phpfastcache\Util\{ArrayObject, MemcacheDriverCollisionDetectorTrait}; |
| 26 | 26 | use Psr\Cache\CacheItemInterface; |
@@ -73,13 +73,13 @@ discard block |
||
| 73 | 73 | $servers = (!empty($this->config->getOption('servers')) && \is_array($this->config->getOption('servers')) ? $this->config->getOption('servers') : []); |
| 74 | 74 | if (\count($servers) < 1) { |
| 75 | 75 | $servers = [ |
| 76 | - [ |
|
| 76 | + [ |
|
| 77 | 77 | 'host' => !empty($this->config->getOption('host')) ? $this->config->getOption('host') : '127.0.0.1', |
| 78 | 78 | 'path' => !empty($this->config->getOption('path')) ? $this->config->getOption('path') : false, |
| 79 | 79 | 'port' => !empty($this->config->getOption('port')) ? $this->config->getOption('port') : 11211, |
| 80 | 80 | 'saslUser' => !empty($this->config->getOption('saslUser')) ? $this->config->getOption('saslUser') : false, |
| 81 | 81 | 'saslPassword' =>!empty($this->config->getOption('saslPassword')) ? $this->config->getOption('saslPassword'): false, |
| 82 | - ], |
|
| 82 | + ], |
|
| 83 | 83 | ]; |
| 84 | 84 | } |
| 85 | 85 | |
@@ -196,9 +196,9 @@ discard block |
||
| 196 | 196 | $date = (new \DateTime())->setTimestamp(\time() - $stats[ 'uptime' ]); |
| 197 | 197 | |
| 198 | 198 | return (new DriverStatistic()) |
| 199 | - ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
| 200 | - ->setInfo(\sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats[ 'version' ], $date->format(DATE_RFC2822))) |
|
| 201 | - ->setRawData($stats) |
|
| 202 | - ->setSize((int)$stats[ 'bytes' ]); |
|
| 199 | + ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
| 200 | + ->setInfo(\sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats[ 'version' ], $date->format(DATE_RFC2822))) |
|
| 201 | + ->setRawData($stats) |
|
| 202 | + ->setSize((int)$stats[ 'bytes' ]); |
|
| 203 | 203 | } |
| 204 | 204 | } |
| 205 | 205 | \ No newline at end of file |
@@ -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\Mongodb; |
| 17 | 17 | |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | use Phpfastcache\Core\Pool\ExtendedCacheItemPoolInterface; |
| 20 | 20 | use Phpfastcache\Drivers\Mongodb\Driver as MongodbDriver; |
| 21 | 21 | use Phpfastcache\Exceptions\{ |
| 22 | - PhpfastcacheInvalidArgumentException, PhpfastcacheInvalidArgumentTypeException |
|
| 22 | + PhpfastcacheInvalidArgumentException, PhpfastcacheInvalidArgumentTypeException |
|
| 23 | 23 | }; |
| 24 | 24 | |
| 25 | 25 | /** |
@@ -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 | |
@@ -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 @@ 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 |
@@ -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 |
@@ -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 | |
@@ -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 | /** |