@@ -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 @@ 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\Memcache; |
| 17 | 17 | |
@@ -78,7 +78,7 @@ discard block |
||
| 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 | - 'saslPassword' =>!empty($this->config->getOption('saslPassword')) ? $this->config->getOption('saslPassword'): false, |
|
| 81 | + 'saslPassword' =>!empty($this->config->getOption('saslPassword')) ? $this->config->getOption('saslPassword') : false, |
|
| 82 | 82 | ], |
| 83 | 83 | ]; |
| 84 | 84 | } |
@@ -88,13 +88,13 @@ discard block |
||
| 88 | 88 | /** |
| 89 | 89 | * If path is provided we consider it as an UNIX Socket |
| 90 | 90 | */ |
| 91 | - if(!empty($server[ 'path' ]) && !$this->instance->addServer($server[ 'path' ], 0)){ |
|
| 91 | + if (!empty($server['path']) && !$this->instance->addServer($server['path'], 0)) { |
|
| 92 | 92 | $this->fallback = true; |
| 93 | - }else if (!empty($server[ 'host' ]) && !$this->instance->addServer($server[ 'host' ], $server[ 'port' ])) { |
|
| 93 | + } else if (!empty($server['host']) && !$this->instance->addServer($server['host'], $server['port'])) { |
|
| 94 | 94 | $this->fallback = true; |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | - if (!empty($server[ 'saslUser' ]) && !empty($server[ 'saslPassword' ])) { |
|
| 97 | + if (!empty($server['saslUser']) && !empty($server['saslPassword'])) { |
|
| 98 | 98 | throw new phpFastCacheDriverException('Unlike Memcached, Memcache does not support SASL authentication'); |
| 99 | 99 | } |
| 100 | 100 | } catch (\Exception $e) { |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | * Since Memcached does not throw |
| 106 | 106 | * any error if not connected ... |
| 107 | 107 | */ |
| 108 | - if(!$this->instance->getServerStatus(!empty($server[ 'path' ]) ? $server[ 'path' ] : $server[ 'host' ], !empty($server[ 'port' ]) ? $server[ 'port' ] : 0)){ |
|
| 108 | + if (!$this->instance->getServerStatus(!empty($server['path']) ? $server['path'] : $server['host'], !empty($server['port']) ? $server['port'] : 0)) { |
|
| 109 | 109 | throw new phpFastCacheDriverException('Memcache seems to not be connected'); |
| 110 | 110 | } |
| 111 | 111 | } |
@@ -188,17 +188,17 @@ discard block |
||
| 188 | 188 | */ |
| 189 | 189 | public function getStats(): DriverStatistic |
| 190 | 190 | { |
| 191 | - $stats = (array)$this->instance->getstats(); |
|
| 192 | - $stats[ 'uptime' ] = (isset($stats[ 'uptime' ]) ? $stats[ 'uptime' ] : 0); |
|
| 193 | - $stats[ 'version' ] = (isset($stats[ 'version' ]) ? $stats[ 'version' ] : 'UnknownVersion'); |
|
| 194 | - $stats[ 'bytes' ] = (isset($stats[ 'bytes' ]) ? $stats[ 'version' ] : 0); |
|
| 191 | + $stats = (array) $this->instance->getstats(); |
|
| 192 | + $stats['uptime'] = (isset($stats['uptime']) ? $stats['uptime'] : 0); |
|
| 193 | + $stats['version'] = (isset($stats['version']) ? $stats['version'] : 'UnknownVersion'); |
|
| 194 | + $stats['bytes'] = (isset($stats['bytes']) ? $stats['version'] : 0); |
|
| 195 | 195 | |
| 196 | - $date = (new \DateTime())->setTimestamp(time() - $stats[ 'uptime' ]); |
|
| 196 | + $date = (new \DateTime())->setTimestamp(time() - $stats['uptime']); |
|
| 197 | 197 | |
| 198 | 198 | return (new DriverStatistic()) |
| 199 | 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))) |
|
| 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 | 201 | ->setRawData($stats) |
| 202 | - ->setSize((int)$stats[ 'bytes' ]); |
|
| 202 | + ->setSize((int) $stats['bytes']); |
|
| 203 | 203 | } |
| 204 | 204 | } |
| 205 | 205 | \ 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 | |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | use Phpfastcache\Core\Pool\ExtendedCacheItemPoolInterface; |
| 20 | 20 | use Phpfastcache\Drivers\Xcache\Driver as XcacheDriver; |
| 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\Xcache; |
| 17 | 17 | |
@@ -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 | |
@@ -125,10 +125,10 @@ discard block |
||
| 125 | 125 | $info = xcache_info(XC_TYPE_VAR, 0); |
| 126 | 126 | |
| 127 | 127 | return (new DriverStatistic()) |
| 128 | - ->setSize(abs($info[ 'size' ] - $info[ 'avail' ])) |
|
| 129 | - ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
| 130 | - ->setInfo(\sprintf("Xcache v%s with following modules loaded:\n %s", XCACHE_VERSION, \str_replace(' ', ', ', XCACHE_MODULES))) |
|
| 131 | - ->setRawData($info); |
|
| 128 | + ->setSize(abs($info[ 'size' ] - $info[ 'avail' ])) |
|
| 129 | + ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
| 130 | + ->setInfo(\sprintf("Xcache v%s with following modules loaded:\n %s", XCACHE_VERSION, \str_replace(' ', ', ', XCACHE_MODULES))) |
|
| 131 | + ->setRawData($info); |
|
| 132 | 132 | } |
| 133 | 133 | throw new \RuntimeException("PhpFastCache is not able to read Xcache configuration. Please put this to your php.ini:\n |
| 134 | 134 | [xcache.admin] |
@@ -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\Xcache; |
| 17 | 17 | |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | $info = xcache_info(XC_TYPE_VAR, 0); |
| 126 | 126 | |
| 127 | 127 | return (new DriverStatistic()) |
| 128 | - ->setSize(abs($info[ 'size' ] - $info[ 'avail' ])) |
|
| 128 | + ->setSize(abs($info['size'] - $info['avail'])) |
|
| 129 | 129 | ->setData(\implode(', ', \array_keys($this->itemInstances))) |
| 130 | 130 | ->setInfo(\sprintf("Xcache v%s with following modules loaded:\n %s", XCACHE_VERSION, \str_replace(' ', ', ', XCACHE_MODULES))) |
| 131 | 131 | ->setRawData($info); |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | use Phpfastcache\Core\Pool\ExtendedCacheItemPoolInterface; |
| 21 | 21 | use Phpfastcache\Drivers\Cassandra\Driver as CassandraDriver; |
| 22 | 22 | use Phpfastcache\Exceptions\{ |
| 23 | - phpFastCacheInvalidArgumentException, phpFastCacheInvalidArgumentTypeException |
|
| 23 | + phpFastCacheInvalidArgumentException, phpFastCacheInvalidArgumentTypeException |
|
| 24 | 24 | }; |
| 25 | 25 | |
| 26 | 26 | /** |
@@ -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\Cassandra; |
| 17 | 17 | |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | use Phpfastcache\Core\Pool\ExtendedCacheItemPoolInterface; |
| 20 | 20 | use Phpfastcache\Drivers\Cookie\Driver as CookieDriver; |
| 21 | 21 | use Phpfastcache\Exceptions\{ |
| 22 | - phpFastCacheInvalidArgumentException |
|
| 22 | + phpFastCacheInvalidArgumentException |
|
| 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\Cookie; |
| 17 | 17 | |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | use Phpfastcache\Core\Pool\{DriverBaseTrait, ExtendedCacheItemPoolInterface}; |
| 19 | 19 | use Phpfastcache\Entities\DriverStatistic; |
| 20 | 20 | use Phpfastcache\Exceptions\{ |
| 21 | - phpFastCacheInvalidArgumentException, phpFastCacheDriverException |
|
| 21 | + phpFastCacheInvalidArgumentException, phpFastCacheDriverException |
|
| 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\Cookie; |
| 17 | 17 | |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | { |
| 60 | 60 | $this->driverConnect(); |
| 61 | 61 | $keyword = self::PREFIX . $item->getKey(); |
| 62 | - $x = isset($_COOKIE[ $keyword ]) ? \json_decode($_COOKIE[ $keyword ], true) : false; |
|
| 62 | + $x = isset($_COOKIE[$keyword]) ? \json_decode($_COOKIE[$keyword], true) : false; |
|
| 63 | 63 | |
| 64 | 64 | if ($x == false) { |
| 65 | 65 | return null; |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | { |
| 105 | 105 | $this->driverConnect(); |
| 106 | 106 | $keyword = self::PREFIX . $key; |
| 107 | - $x = isset($_COOKIE[ $keyword ]) ? $this->decode(\json_decode($_COOKIE[ $keyword ])->t) : 0; |
|
| 107 | + $x = isset($_COOKIE[$keyword]) ? $this->decode(\json_decode($_COOKIE[$keyword])->t) : 0; |
|
| 108 | 108 | |
| 109 | 109 | return $x ? $x - time() : $x; |
| 110 | 110 | } |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | if ($item instanceof Item) { |
| 123 | 123 | $this->driverConnect(); |
| 124 | 124 | $keyword = self::PREFIX . $item->getKey(); |
| 125 | - $_COOKIE[ $keyword ] = null; |
|
| 125 | + $_COOKIE[$keyword] = null; |
|
| 126 | 126 | |
| 127 | 127 | return @setcookie($keyword, null, -10); |
| 128 | 128 | } |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | $this->driverConnect(); |
| 140 | 140 | foreach ($_COOKIE as $keyword => $value) { |
| 141 | 141 | if (\strpos($keyword, self::PREFIX) !== false) { |
| 142 | - $_COOKIE[ $keyword ] = null; |
|
| 142 | + $_COOKIE[$keyword] = null; |
|
| 143 | 143 | $result = @setcookie($keyword, null, -10); |
| 144 | 144 | if ($return !== false) { |
| 145 | 145 | $return = $result; |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | use Phpfastcache\Core\Pool\ExtendedCacheItemPoolInterface; |
| 20 | 20 | use Phpfastcache\Drivers\Predis\Driver as PredisDriver; |
| 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\Predis; |
| 17 | 17 | |
@@ -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 |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | use Phpfastcache\Core\Pool\ExtendedCacheItemPoolInterface; |
| 20 | 20 | use Phpfastcache\Drivers\Apc\Driver as ApcDriver; |
| 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\Apc; |
| 17 | 17 | |