@@ -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 |
@@ -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 | |
@@ -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 |
@@ -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 |
@@ -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 @@ 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); |
@@ -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 @@ |
||
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 |
@@ -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\Cookie; |
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\Predis; |
17 | 17 |
@@ -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 | /** |
@@ -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 |
@@ -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 |
@@ -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 | /** |