@@ -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; |
@@ -69,13 +69,13 @@ discard block |
||
69 | 69 | $servers = (!empty($this->config->getOption('servers')) && \is_array($this->config->getOption('servers')) ? $this->config->getOption('servers') : []); |
70 | 70 | if (\count($servers) < 1) { |
71 | 71 | $servers = [ |
72 | - [ |
|
72 | + [ |
|
73 | 73 | 'host' => !empty($this->config->getOption('host')) ? $this->config->getOption('host') : '127.0.0.1', |
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 | 77 | 'saslPassword' =>!empty($this->config->getOption('saslPassword')) ? $this->config->getOption('saslPassword'): false, |
78 | - ], |
|
78 | + ], |
|
79 | 79 | ]; |
80 | 80 | } |
81 | 81 | |
@@ -194,9 +194,9 @@ discard block |
||
194 | 194 | $date = (new \DateTime())->setTimestamp(time() - $stats[ 'uptime' ]); |
195 | 195 | |
196 | 196 | return (new DriverStatistic()) |
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))) |
|
199 | - ->setRawData($stats) |
|
200 | - ->setSize((int)$stats[ 'bytes' ]); |
|
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))) |
|
199 | + ->setRawData($stats) |
|
200 | + ->setSize((int)$stats[ 'bytes' ]); |
|
201 | 201 | } |
202 | 202 | } |
203 | 203 | \ 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\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 |
@@ -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 | /** |
@@ -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\Exceptions; |
17 | 17 |
@@ -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\Exceptions; |
17 | 17 |
@@ -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\Exceptions; |
17 | 17 |
@@ -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\Exceptions; |
17 | 17 |
@@ -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\Exceptions; |
17 | 17 |
@@ -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\Exceptions; |
17 | 17 |
@@ -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\Exceptions; |
17 | 17 |