@@ -135,10 +135,10 @@ |
||
| 135 | 135 | public function getPublicDesc(): array |
| 136 | 136 | { |
| 137 | 137 | return [ |
| 138 | - 'Info' => 'Cache Information', |
|
| 139 | - 'Size' => 'Cache Size', |
|
| 140 | - 'Data' => 'Cache items keys', |
|
| 141 | - 'RawData' => 'Cache raw data', |
|
| 138 | + 'Info' => 'Cache Information', |
|
| 139 | + 'Size' => 'Cache Size', |
|
| 140 | + 'Data' => 'Cache items keys', |
|
| 141 | + 'RawData' => 'Cache raw data', |
|
| 142 | 142 | ]; |
| 143 | 143 | } |
| 144 | 144 | } |
| 145 | 145 | \ No newline at end of file |
@@ -16,12 +16,12 @@ |
||
| 16 | 16 | * @var array |
| 17 | 17 | */ |
| 18 | 18 | protected $servers = [ |
| 19 | - [ |
|
| 19 | + [ |
|
| 20 | 20 | 'host' => '127.0.0.1', |
| 21 | 21 | 'port' => 11211, |
| 22 | 22 | 'saslUser' => false, |
| 23 | 23 | 'saslPassword' => false, |
| 24 | - ], |
|
| 24 | + ], |
|
| 25 | 25 | ]; |
| 26 | 26 | |
| 27 | 27 | /** |
@@ -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 | |
@@ -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; |
@@ -74,13 +74,13 @@ discard block |
||
| 74 | 74 | |
| 75 | 75 | if (\count($servers) < 1) { |
| 76 | 76 | $servers = [ |
| 77 | - [ |
|
| 77 | + [ |
|
| 78 | 78 | 'host' => $this->getConfig()->getHost(), |
| 79 | 79 | 'path' => $this->getConfig()->getPath(), |
| 80 | 80 | 'port' => $this->getConfig()->getPort(), |
| 81 | 81 | 'saslUser' => $this->getConfig()->getSaslUser() ?: false, |
| 82 | 82 | 'saslPassword' => $this->getConfig()->getSaslPassword() ?: false, |
| 83 | - ], |
|
| 83 | + ], |
|
| 84 | 84 | ]; |
| 85 | 85 | } |
| 86 | 86 | |
@@ -197,9 +197,9 @@ discard block |
||
| 197 | 197 | $date = (new \DateTime())->setTimestamp(\time() - $stats[ 'uptime' ]); |
| 198 | 198 | |
| 199 | 199 | return (new DriverStatistic()) |
| 200 | - ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
| 201 | - ->setInfo(\sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats[ 'version' ], $date->format(DATE_RFC2822))) |
|
| 202 | - ->setRawData($stats) |
|
| 203 | - ->setSize((int)$stats[ 'bytes' ]); |
|
| 200 | + ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
| 201 | + ->setInfo(\sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats[ 'version' ], $date->format(DATE_RFC2822))) |
|
| 202 | + ->setRawData($stats) |
|
| 203 | + ->setSize((int)$stats[ 'bytes' ]); |
|
| 204 | 204 | } |
| 205 | 205 | } |
| 206 | 206 | \ No newline at end of file |
@@ -89,13 +89,13 @@ discard block |
||
| 89 | 89 | /** |
| 90 | 90 | * If path is provided we consider it as an UNIX Socket |
| 91 | 91 | */ |
| 92 | - if(!empty($server[ 'path' ]) && !$this->instance->addServer($server[ 'path' ], 0)){ |
|
| 92 | + if (!empty($server['path']) && !$this->instance->addServer($server['path'], 0)) { |
|
| 93 | 93 | $this->fallback = true; |
| 94 | - }else if (!empty($server[ 'host' ]) && !$this->instance->addServer($server[ 'host' ], $server[ 'port' ])) { |
|
| 94 | + } else if (!empty($server['host']) && !$this->instance->addServer($server['host'], $server['port'])) { |
|
| 95 | 95 | $this->fallback = true; |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - if (!empty($server[ 'saslUser' ]) && !empty($server[ 'saslPassword' ])) { |
|
| 98 | + if (!empty($server['saslUser']) && !empty($server['saslPassword'])) { |
|
| 99 | 99 | throw new PhpfastcacheDriverException('Unlike Memcached, Memcache does not support SASL authentication'); |
| 100 | 100 | } |
| 101 | 101 | } catch (\Exception $e) { |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | * Since Memcached does not throw |
| 107 | 107 | * any error if not connected ... |
| 108 | 108 | */ |
| 109 | - if(!$this->instance->getServerStatus(!empty($server[ 'path' ]) ? $server[ 'path' ] : $server[ 'host' ], !empty($server[ 'port' ]) ? $server[ 'port' ] : 0)){ |
|
| 109 | + if (!$this->instance->getServerStatus(!empty($server['path']) ? $server['path'] : $server['host'], !empty($server['port']) ? $server['port'] : 0)) { |
|
| 110 | 110 | throw new PhpfastcacheDriverException('Memcache seems to not be connected'); |
| 111 | 111 | } |
| 112 | 112 | } |
@@ -189,17 +189,17 @@ discard block |
||
| 189 | 189 | */ |
| 190 | 190 | public function getStats(): DriverStatistic |
| 191 | 191 | { |
| 192 | - $stats = (array)$this->instance->getstats(); |
|
| 193 | - $stats[ 'uptime' ] = (isset($stats[ 'uptime' ]) ? $stats[ 'uptime' ] : 0); |
|
| 194 | - $stats[ 'version' ] = (isset($stats[ 'version' ]) ? $stats[ 'version' ] : 'UnknownVersion'); |
|
| 195 | - $stats[ 'bytes' ] = (isset($stats[ 'bytes' ]) ? $stats[ 'version' ] : 0); |
|
| 192 | + $stats = (array) $this->instance->getstats(); |
|
| 193 | + $stats['uptime'] = (isset($stats['uptime']) ? $stats['uptime'] : 0); |
|
| 194 | + $stats['version'] = (isset($stats['version']) ? $stats['version'] : 'UnknownVersion'); |
|
| 195 | + $stats['bytes'] = (isset($stats['bytes']) ? $stats['version'] : 0); |
|
| 196 | 196 | |
| 197 | - $date = (new \DateTime())->setTimestamp(\time() - $stats[ 'uptime' ]); |
|
| 197 | + $date = (new \DateTime())->setTimestamp(\time() - $stats['uptime']); |
|
| 198 | 198 | |
| 199 | 199 | return (new DriverStatistic()) |
| 200 | 200 | ->setData(\implode(', ', \array_keys($this->itemInstances))) |
| 201 | - ->setInfo(\sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats[ 'version' ], $date->format(DATE_RFC2822))) |
|
| 201 | + ->setInfo(\sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats['version'], $date->format(DATE_RFC2822))) |
|
| 202 | 202 | ->setRawData($stats) |
| 203 | - ->setSize((int)$stats[ 'bytes' ]); |
|
| 203 | + ->setSize((int) $stats['bytes']); |
|
| 204 | 204 | } |
| 205 | 205 | } |
| 206 | 206 | \ No newline at end of file |
@@ -110,10 +110,10 @@ |
||
| 110 | 110 | public function getPredisConfigArray(): array |
| 111 | 111 | { |
| 112 | 112 | return [ |
| 113 | - 'host' => $this->getHost(), |
|
| 114 | - 'port' => $this->getPort(), |
|
| 115 | - 'password' => $this->getPassword() ?: null, |
|
| 116 | - 'database' => $this->getDatabase(), |
|
| 113 | + 'host' => $this->getHost(), |
|
| 114 | + 'port' => $this->getPort(), |
|
| 115 | + 'password' => $this->getPassword() ?: null, |
|
| 116 | + 'database' => $this->getDatabase(), |
|
| 117 | 117 | ]; |
| 118 | 118 | } |
| 119 | 119 | } |
| 120 | 120 | \ No newline at end of file |
@@ -32,10 +32,10 @@ |
||
| 32 | 32 | * @var array |
| 33 | 33 | */ |
| 34 | 34 | protected $buckets = [ |
| 35 | - [ |
|
| 35 | + [ |
|
| 36 | 36 | 'bucket' => 'default', |
| 37 | 37 | 'password' => '', |
| 38 | - ], |
|
| 38 | + ], |
|
| 39 | 39 | ]; |
| 40 | 40 | |
| 41 | 41 | /** |
@@ -134,7 +134,7 @@ |
||
| 134 | 134 | if ($item instanceof Item) { |
| 135 | 135 | try{ |
| 136 | 136 | return (bool)$this->getBucket()->remove($item->getEncodedKey()); |
| 137 | - }catch (\Couchbase\Exception $e){ |
|
| 137 | + } catch (\Couchbase\Exception $e){ |
|
| 138 | 138 | return $e->getCode() === COUCHBASE_KEY_ENOENT; |
| 139 | 139 | } |
| 140 | 140 | } |
@@ -17,11 +17,11 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | use CouchbaseCluster as CouchbaseClient; |
| 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; |
@@ -187,10 +187,10 @@ discard block |
||
| 187 | 187 | $info = $this->getBucket()->manager()->info(); |
| 188 | 188 | |
| 189 | 189 | return (new DriverStatistic()) |
| 190 | - ->setSize($info[ 'basicStats' ][ 'diskUsed' ]) |
|
| 191 | - ->setRawData($info) |
|
| 192 | - ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
| 193 | - ->setInfo('CouchBase version ' . $info[ 'nodes' ][ 0 ][ 'version' ] . ', Uptime (in days): ' . round($info[ 'nodes' ][ 0 ][ 'uptime' ] / 86400, |
|
| 194 | - 1) . "\n For more information see RawData."); |
|
| 190 | + ->setSize($info[ 'basicStats' ][ 'diskUsed' ]) |
|
| 191 | + ->setRawData($info) |
|
| 192 | + ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
| 193 | + ->setInfo('CouchBase version ' . $info[ 'nodes' ][ 0 ][ 'version' ] . ', Uptime (in days): ' . round($info[ 'nodes' ][ 0 ][ 'uptime' ] / 86400, |
|
| 194 | + 1) . "\n For more information see RawData."); |
|
| 195 | 195 | } |
| 196 | 196 | } |
| 197 | 197 | \ No newline at end of file |
@@ -77,8 +77,8 @@ discard block |
||
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | foreach ($clientConfig->getBuckets() as $bucket) { |
| 80 | - $this->bucketCurrent = $this->bucketCurrent ?: $bucket[ 'bucket' ]; |
|
| 81 | - $this->setBucket($bucket[ 'bucket' ], $this->instance->openBucket($bucket[ 'bucket' ], $bucket[ 'password' ])); |
|
| 80 | + $this->bucketCurrent = $this->bucketCurrent ?: $bucket['bucket']; |
|
| 81 | + $this->setBucket($bucket['bucket'], $this->instance->openBucket($bucket['bucket'], $bucket['password'])); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | return true; |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | */ |
| 113 | 113 | if ($item instanceof Item) { |
| 114 | 114 | try { |
| 115 | - return (bool)$this->getBucket()->upsert($item->getEncodedKey(), $this->encode($this->driverPreWrap($item)), ['expiry' => $item->getTtl()]); |
|
| 115 | + return (bool) $this->getBucket()->upsert($item->getEncodedKey(), $this->encode($this->driverPreWrap($item)), ['expiry' => $item->getTtl()]); |
|
| 116 | 116 | } catch (\CouchbaseException $e) { |
| 117 | 117 | return false; |
| 118 | 118 | } |
@@ -132,9 +132,9 @@ discard block |
||
| 132 | 132 | * Check for Cross-Driver type confusion |
| 133 | 133 | */ |
| 134 | 134 | if ($item instanceof Item) { |
| 135 | - try{ |
|
| 136 | - return (bool)$this->getBucket()->remove($item->getEncodedKey()); |
|
| 137 | - }catch (\Couchbase\Exception $e){ |
|
| 135 | + try { |
|
| 136 | + return (bool) $this->getBucket()->remove($item->getEncodedKey()); |
|
| 137 | + } catch (\Couchbase\Exception $e) { |
|
| 138 | 138 | return $e->getCode() === COUCHBASE_KEY_ENOENT; |
| 139 | 139 | } |
| 140 | 140 | } |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | */ |
| 157 | 157 | protected function getBucket(): \CouchbaseBucket |
| 158 | 158 | { |
| 159 | - return $this->bucketInstances[ $this->bucketCurrent ]; |
|
| 159 | + return $this->bucketInstances[$this->bucketCurrent]; |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | /** |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | protected function setBucket($bucketName, \CouchbaseBucket $CouchbaseBucket) |
| 168 | 168 | { |
| 169 | 169 | if (!\array_key_exists($bucketName, $this->bucketInstances)) { |
| 170 | - $this->bucketInstances[ $bucketName ] = $CouchbaseBucket; |
|
| 170 | + $this->bucketInstances[$bucketName] = $CouchbaseBucket; |
|
| 171 | 171 | } else { |
| 172 | 172 | throw new PhpfastcacheLogicException('A bucket instance with this name already exists.'); |
| 173 | 173 | } |
@@ -187,10 +187,10 @@ discard block |
||
| 187 | 187 | $info = $this->getBucket()->manager()->info(); |
| 188 | 188 | |
| 189 | 189 | return (new DriverStatistic()) |
| 190 | - ->setSize($info[ 'basicStats' ][ 'diskUsed' ]) |
|
| 190 | + ->setSize($info['basicStats']['diskUsed']) |
|
| 191 | 191 | ->setRawData($info) |
| 192 | 192 | ->setData(\implode(', ', \array_keys($this->itemInstances))) |
| 193 | - ->setInfo('CouchBase version ' . $info[ 'nodes' ][ 0 ][ 'version' ] . ', Uptime (in days): ' . round($info[ 'nodes' ][ 0 ][ 'uptime' ] / 86400, |
|
| 193 | + ->setInfo('CouchBase version ' . $info['nodes'][0]['version'] . ', Uptime (in days): ' . round($info['nodes'][0]['uptime'] / 86400, |
|
| 194 | 194 | 1) . "\n For more information see RawData."); |
| 195 | 195 | } |
| 196 | 196 | } |
| 197 | 197 | \ No newline at end of file |
@@ -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 | |
@@ -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; |
@@ -74,13 +74,13 @@ discard block |
||
| 74 | 74 | |
| 75 | 75 | if (\count($servers) < 1) { |
| 76 | 76 | $servers = [ |
| 77 | - [ |
|
| 77 | + [ |
|
| 78 | 78 | 'host' => $this->getConfig()->getHost(), |
| 79 | 79 | 'path' => $this->getConfig()->getPath(), |
| 80 | 80 | 'port' => $this->getConfig()->getPort(), |
| 81 | 81 | 'saslUser' => $this->getConfig()->getSaslUser() ?: false, |
| 82 | 82 | 'saslPassword' => $this->getConfig()->getSaslPassword() ?: false, |
| 83 | - ], |
|
| 83 | + ], |
|
| 84 | 84 | ]; |
| 85 | 85 | } |
| 86 | 86 | |
@@ -197,9 +197,9 @@ discard block |
||
| 197 | 197 | $date = (new \DateTime())->setTimestamp(\time() - $stats[ 'uptime' ]); |
| 198 | 198 | |
| 199 | 199 | return (new DriverStatistic()) |
| 200 | - ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
| 201 | - ->setInfo(\sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats[ 'version' ], $date->format(DATE_RFC2822))) |
|
| 202 | - ->setRawData($stats) |
|
| 203 | - ->setSize((int)$stats[ 'bytes' ]); |
|
| 200 | + ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
| 201 | + ->setInfo(\sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats[ 'version' ], $date->format(DATE_RFC2822))) |
|
| 202 | + ->setRawData($stats) |
|
| 203 | + ->setSize((int)$stats[ 'bytes' ]); |
|
| 204 | 204 | } |
| 205 | 205 | } |
| 206 | 206 | \ No newline at end of file |
@@ -85,14 +85,14 @@ discard block |
||
| 85 | 85 | /** |
| 86 | 86 | * If path is provided we consider it as an UNIX Socket |
| 87 | 87 | */ |
| 88 | - if(!empty($server[ 'path' ]) && !$this->instance->addServer($server[ 'path' ], 0)){ |
|
| 88 | + if (!empty($server['path']) && !$this->instance->addServer($server['path'], 0)) { |
|
| 89 | 89 | $this->fallback = true; |
| 90 | - }else if (!empty($server[ 'host' ]) && !$this->instance->addServer($server[ 'host' ], $server[ 'port' ])) { |
|
| 90 | + } else if (!empty($server['host']) && !$this->instance->addServer($server['host'], $server['port'])) { |
|
| 91 | 91 | $this->fallback = true; |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - if (!empty($server[ 'saslUser' ]) && !empty($server[ 'saslPassword' ])) { |
|
| 95 | - $this->instance->setSaslAuthData($server[ 'saslUser' ], $server[ 'saslPassword' ]); |
|
| 94 | + if (!empty($server['saslUser']) && !empty($server['saslPassword'])) { |
|
| 95 | + $this->instance->setSaslAuthData($server['saslUser'], $server['saslPassword']); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | } catch (\Exception $e) { |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | * any error if not connected ... |
| 106 | 106 | */ |
| 107 | 107 | $version = $this->instance->getVersion(); |
| 108 | - if(!$version || $this->instance->getResultCode() !== MemcachedSoftware::RES_SUCCESS){ |
|
| 108 | + if (!$version || $this->instance->getResultCode() !== MemcachedSoftware::RES_SUCCESS) { |
|
| 109 | 109 | throw new PhpfastcacheDriverException('Memcached seems to not be connected'); |
| 110 | 110 | } |
| 111 | 111 | return true; |
@@ -188,16 +188,16 @@ discard block |
||
| 188 | 188 | public function getStats(): DriverStatistic |
| 189 | 189 | { |
| 190 | 190 | $stats = current($this->instance->getStats()); |
| 191 | - $stats[ 'uptime' ] = (isset($stats[ 'uptime' ]) ? $stats[ 'uptime' ] : 0); |
|
| 192 | - $stats[ 'version' ] = (isset($stats[ 'version' ]) ? $stats[ 'version' ] : $this->instance->getVersion()); |
|
| 193 | - $stats[ 'bytes' ] = (isset($stats[ 'bytes' ]) ? $stats[ 'version' ] : 0); |
|
| 191 | + $stats['uptime'] = (isset($stats['uptime']) ? $stats['uptime'] : 0); |
|
| 192 | + $stats['version'] = (isset($stats['version']) ? $stats['version'] : $this->instance->getVersion()); |
|
| 193 | + $stats['bytes'] = (isset($stats['bytes']) ? $stats['version'] : 0); |
|
| 194 | 194 | |
| 195 | - $date = (new \DateTime())->setTimestamp(\time() - $stats[ 'uptime' ]); |
|
| 195 | + $date = (new \DateTime())->setTimestamp(\time() - $stats['uptime']); |
|
| 196 | 196 | |
| 197 | 197 | return (new DriverStatistic()) |
| 198 | 198 | ->setData(\implode(', ', \array_keys($this->itemInstances))) |
| 199 | - ->setInfo(\sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats[ 'version' ], $date->format(DATE_RFC2822))) |
|
| 199 | + ->setInfo(\sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats['version'], $date->format(DATE_RFC2822))) |
|
| 200 | 200 | ->setRawData($stats) |
| 201 | - ->setSize((int)$stats[ 'bytes' ]); |
|
| 201 | + ->setSize((int) $stats['bytes']); |
|
| 202 | 202 | } |
| 203 | 203 | } |
| 204 | 204 | \ No newline at end of file |
@@ -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 |
@@ -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; |
@@ -100,9 +100,9 @@ discard block |
||
| 100 | 100 | */ |
| 101 | 101 | if(array_diff_key($array, get_object_vars($this))){ |
| 102 | 102 | throw new PhpfastcacheInvalidConfigurationException(\sprintf( |
| 103 | - 'Invalid option(s) for the config %s: %s', |
|
| 104 | - static::class, |
|
| 105 | - implode(', ', array_keys(array_diff_key($array, get_object_vars($this)))) |
|
| 103 | + 'Invalid option(s) for the config %s: %s', |
|
| 104 | + static::class, |
|
| 105 | + implode(', ', array_keys(array_diff_key($array, get_object_vars($this)))) |
|
| 106 | 106 | )); |
| 107 | 107 | } |
| 108 | 108 | |
@@ -134,10 +134,10 @@ discard block |
||
| 134 | 134 | $typeHintExpected = ($parameter instanceof \ReflectionParameter ? ($parameter->getType() === 'object' ? $parameter->getClass() : $parameter->getType()) : 'Unknown type'); |
| 135 | 135 | |
| 136 | 136 | throw new PhpfastcacheInvalidConfigurationException(\sprintf( |
| 137 | - 'Invalid type hint found for "%s", expected "%s" got "%s"', |
|
| 138 | - lcfirst(substr($method, 3)), |
|
| 139 | - $typeHintExpected, |
|
| 140 | - $typeHintGot |
|
| 137 | + 'Invalid type hint found for "%s", expected "%s" got "%s"', |
|
| 138 | + lcfirst(substr($method, 3)), |
|
| 139 | + $typeHintExpected, |
|
| 140 | + $typeHintGot |
|
| 141 | 141 | )); |
| 142 | 142 | } |
| 143 | 143 | } |
@@ -331,9 +331,9 @@ discard block |
||
| 331 | 331 | { |
| 332 | 332 | if($fallbackConfig !== null && !($fallbackConfig instanceof self)){ |
| 333 | 333 | throw new PhpfastcacheInvalidArgumentException(\sprintf( |
| 334 | - 'Invalid argument "%s" for %s', |
|
| 335 | - gettype($fallbackConfig) === 'object' ? get_class($fallbackConfig) : gettype($fallbackConfig), |
|
| 336 | - __METHOD__ |
|
| 334 | + 'Invalid argument "%s" for %s', |
|
| 335 | + gettype($fallbackConfig) === 'object' ? get_class($fallbackConfig) : gettype($fallbackConfig), |
|
| 336 | + __METHOD__ |
|
| 337 | 337 | )); |
| 338 | 338 | } |
| 339 | 339 | $this->fallbackConfig = $fallbackConfig; |
@@ -432,10 +432,10 @@ discard block |
||
| 432 | 432 | * by opening a pull request :) |
| 433 | 433 | */ |
| 434 | 434 | static $safeFileExtensions = [ |
| 435 | - 'txt', |
|
| 436 | - 'cache', |
|
| 437 | - 'db', |
|
| 438 | - 'pfc', |
|
| 435 | + 'txt', |
|
| 436 | + 'cache', |
|
| 437 | + 'db', |
|
| 438 | + 'pfc', |
|
| 439 | 439 | ]; |
| 440 | 440 | |
| 441 | 441 | if (\strpos($cacheFileExtension, '.') !== false) { |
@@ -443,7 +443,7 @@ discard block |
||
| 443 | 443 | } |
| 444 | 444 | if (!\in_array($cacheFileExtension, $safeFileExtensions, true)) { |
| 445 | 445 | throw new PhpfastcacheInvalidConfigurationException( |
| 446 | - "{$cacheFileExtension} is not a safe extension, currently allowed extension: " . \implode(', ', $safeFileExtensions) |
|
| 446 | + "{$cacheFileExtension} is not a safe extension, currently allowed extension: " . \implode(', ', $safeFileExtensions) |
|
| 447 | 447 | ); |
| 448 | 448 | } |
| 449 | 449 | |
@@ -92,33 +92,33 @@ discard block |
||
| 92 | 92 | public function __construct(...$args) |
| 93 | 93 | { |
| 94 | 94 | parent::__construct(...$args); |
| 95 | - $array =& $this->getArray(); |
|
| 95 | + $array = & $this->getArray(); |
|
| 96 | 96 | |
| 97 | 97 | /** |
| 98 | 98 | * Detect unwanted keys and throw an exception. |
| 99 | 99 | * No more kidding now, it's 21th century. |
| 100 | 100 | */ |
| 101 | - if(array_diff_key($array, get_object_vars($this))){ |
|
| 101 | + if (array_diff_key($array, get_object_vars($this))) { |
|
| 102 | 102 | throw new PhpfastcacheInvalidConfigurationException(\sprintf( |
| 103 | 103 | 'Invalid option(s) for the config %s: %s', |
| 104 | 104 | static::class, |
| 105 | - implode(', ', array_keys(array_diff_key($array, get_object_vars($this)))) |
|
| 105 | + implode(', ', array_keys(array_diff_key($array, get_object_vars($this)))) |
|
| 106 | 106 | )); |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | foreach (get_object_vars($this) as $property => $value) { |
| 110 | 110 | |
| 111 | - if(array_key_exists($property, $array)){ |
|
| 112 | - $this->$property = &$array[ $property ]; |
|
| 113 | - }else{ |
|
| 114 | - $array[ $property ] = &$this->$property; |
|
| 111 | + if (array_key_exists($property, $array)) { |
|
| 112 | + $this->$property = &$array[$property]; |
|
| 113 | + } else { |
|
| 114 | + $array[$property] = &$this->$property; |
|
| 115 | 115 | } |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | foreach (get_class_methods($this) as $method) { |
| 119 | - if(strpos($method, 'set') === 0){ |
|
| 119 | + if (strpos($method, 'set') === 0) { |
|
| 120 | 120 | $value = null; |
| 121 | - try{ |
|
| 121 | + try { |
|
| 122 | 122 | /** |
| 123 | 123 | * We use property instead of getter |
| 124 | 124 | * because of is/get conditions and |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | */ |
| 128 | 128 | $value = $this->{lcfirst(substr($method, 3))}; |
| 129 | 129 | $this->{$method}($value); |
| 130 | - }catch(\TypeError $e){ |
|
| 130 | + } catch (\TypeError $e) { |
|
| 131 | 131 | $typeHintGot = \is_object($value) ? \get_class($value) : \gettype($value); |
| 132 | 132 | $reflectionMethod = new \ReflectionMethod($this, $method); |
| 133 | 133 | $parameter = $reflectionMethod->getParameters()[0] ?? null; |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | */ |
| 217 | 217 | public function setIgnoreSymfonyNotice(bool $ignoreSymfonyNotice): self |
| 218 | 218 | { |
| 219 | - if($ignoreSymfonyNotice){ |
|
| 219 | + if ($ignoreSymfonyNotice) { |
|
| 220 | 220 | \trigger_error('Configuration option "ignoreSymfonyNotice" is deprecated as of the V7', E_USER_DEPRECATED); |
| 221 | 221 | } |
| 222 | 222 | $this->ignoreSymfonyNotice = $ignoreSymfonyNotice; |
@@ -331,7 +331,7 @@ discard block |
||
| 331 | 331 | */ |
| 332 | 332 | public function setFallbackConfig($fallbackConfig): self |
| 333 | 333 | { |
| 334 | - if($fallbackConfig !== null && !($fallbackConfig instanceof self)){ |
|
| 334 | + if ($fallbackConfig !== null && !($fallbackConfig instanceof self)) { |
|
| 335 | 335 | throw new PhpfastcacheInvalidArgumentException(\sprintf( |
| 336 | 336 | 'Invalid argument "%s" for %s', |
| 337 | 337 | gettype($fallbackConfig) === 'object' ? get_class($fallbackConfig) : gettype($fallbackConfig), |