@@ -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 | |
@@ -121,9 +121,9 @@ discard block |
||
121 | 121 | $date = (new \DateTime())->setTimestamp(\time() - $info[ 'total_cache_uptime' ]); |
122 | 122 | |
123 | 123 | return (new DriverStatistic()) |
124 | - ->setInfo(\sprintf("The Wincache daemon is up since %s.\n For more information see RawData.", $date->format(DATE_RFC2822))) |
|
125 | - ->setSize($memInfo[ 'memory_free' ] - $memInfo[ 'memory_total' ]) |
|
126 | - ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
127 | - ->setRawData($memInfo); |
|
124 | + ->setInfo(\sprintf("The Wincache daemon is up since %s.\n For more information see RawData.", $date->format(DATE_RFC2822))) |
|
125 | + ->setSize($memInfo[ 'memory_free' ] - $memInfo[ 'memory_total' ]) |
|
126 | + ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
127 | + ->setRawData($memInfo); |
|
128 | 128 | } |
129 | 129 | } |
130 | 130 | \ 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\Wincache; |
17 | 17 | |
@@ -118,11 +118,11 @@ discard block |
||
118 | 118 | { |
119 | 119 | $memInfo = wincache_ucache_meminfo(); |
120 | 120 | $info = wincache_ucache_info(); |
121 | - $date = (new \DateTime())->setTimestamp(\time() - $info[ 'total_cache_uptime' ]); |
|
121 | + $date = (new \DateTime())->setTimestamp(\time() - $info['total_cache_uptime']); |
|
122 | 122 | |
123 | 123 | return (new DriverStatistic()) |
124 | 124 | ->setInfo(\sprintf("The Wincache daemon is up since %s.\n For more information see RawData.", $date->format(DATE_RFC2822))) |
125 | - ->setSize($memInfo[ 'memory_free' ] - $memInfo[ 'memory_total' ]) |
|
125 | + ->setSize($memInfo['memory_free'] - $memInfo['memory_total']) |
|
126 | 126 | ->setData(\implode(', ', \array_keys($this->itemInstances))) |
127 | 127 | ->setRawData($memInfo); |
128 | 128 | } |
@@ -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\Apcu; |
17 | 17 | |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | if ($item instanceof Item) { |
62 | 62 | $ttl = $item->getExpirationDate()->getTimestamp() - \time(); |
63 | 63 | |
64 | - return (bool)apcu_store($item->getKey(), $this->driverPreWrap($item), ($ttl > 0 ? $ttl : 0)); |
|
64 | + return (bool) apcu_store($item->getKey(), $this->driverPreWrap($item), ($ttl > 0 ? $ttl : 0)); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | throw new PhpfastcacheInvalidArgumentException('Cross-Driver type confusion detected'); |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | * Check for Cross-Driver type confusion |
93 | 93 | */ |
94 | 94 | if ($item instanceof Item) { |
95 | - return (bool)apcu_delete($item->getKey()); |
|
95 | + return (bool) apcu_delete($item->getKey()); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | throw new PhpfastcacheInvalidArgumentException('Cross-Driver type confusion detected'); |
@@ -117,14 +117,14 @@ discard block |
||
117 | 117 | */ |
118 | 118 | public function getStats(): DriverStatistic |
119 | 119 | { |
120 | - $stats = (array)apcu_cache_info(); |
|
121 | - $date = (new \DateTime())->setTimestamp($stats[ 'start_time' ]); |
|
120 | + $stats = (array) apcu_cache_info(); |
|
121 | + $date = (new \DateTime())->setTimestamp($stats['start_time']); |
|
122 | 122 | |
123 | 123 | return (new DriverStatistic()) |
124 | 124 | ->setData(\implode(', ', \array_keys($this->itemInstances))) |
125 | 125 | ->setInfo(\sprintf("The APCU cache is up since %s, and have %d item(s) in cache.\n For more information see RawData.", $date->format(DATE_RFC2822), |
126 | - $stats[ 'num_entries' ])) |
|
126 | + $stats['num_entries'])) |
|
127 | 127 | ->setRawData($stats) |
128 | - ->setSize($stats[ 'mem_size' ]); |
|
128 | + ->setSize($stats['mem_size']); |
|
129 | 129 | } |
130 | 130 | } |
131 | 131 | \ No newline at end of file |
@@ -17,11 +17,11 @@ discard block |
||
17 | 17 | |
18 | 18 | use Phpfastcache\Config\ConfigurationOption; |
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; |
@@ -162,10 +162,10 @@ discard block |
||
162 | 162 | $date = (new \DateTime())->setTimestamp(\time() - $info[ 'uptime_in_seconds' ]); |
163 | 163 | |
164 | 164 | return (new DriverStatistic()) |
165 | - ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
166 | - ->setRawData($info) |
|
167 | - ->setSize((int)$info[ 'used_memory' ]) |
|
168 | - ->setInfo(\sprintf("The Redis daemon v%s is up since %s.\n For more information see RawData. \n Driver size includes the memory allocation size.", |
|
165 | + ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
166 | + ->setRawData($info) |
|
167 | + ->setSize((int)$info[ 'used_memory' ]) |
|
168 | + ->setInfo(\sprintf("The Redis daemon v%s is up since %s.\n For more information see RawData. \n Driver size includes the memory allocation size.", |
|
169 | 169 | $info[ 'redis_version' ], $date->format(DATE_RFC2822))); |
170 | 170 | } |
171 | 171 | } |
172 | 172 | \ 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\Redis; |
17 | 17 | |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | if ($this->config->getOption('path')) { |
64 | 64 | $isConnected = $this->instance->connect($this->config->getOption('path')); |
65 | 65 | } else { |
66 | - $isConnected = $this->instance->connect($this->config->getOption('host'), $this->config->getOption('port'), (int)$this->config->getOption('timeout')); |
|
66 | + $isConnected = $this->instance->connect($this->config->getOption('host'), $this->config->getOption('port'), (int) $this->config->getOption('timeout')); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | if (!$isConnected && $this->config->getOption('path')) { |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | * Check for Cross-Driver type confusion |
133 | 133 | */ |
134 | 134 | if ($item instanceof Item) { |
135 | - return (bool)$this->instance->del($item->getKey()); |
|
135 | + return (bool) $this->instance->del($item->getKey()); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | throw new PhpfastcacheInvalidArgumentException('Cross-Driver type confusion detected'); |
@@ -159,13 +159,13 @@ discard block |
||
159 | 159 | { |
160 | 160 | // used_memory |
161 | 161 | $info = $this->instance->info(); |
162 | - $date = (new \DateTime())->setTimestamp(\time() - $info[ 'uptime_in_seconds' ]); |
|
162 | + $date = (new \DateTime())->setTimestamp(\time() - $info['uptime_in_seconds']); |
|
163 | 163 | |
164 | 164 | return (new DriverStatistic()) |
165 | 165 | ->setData(\implode(', ', \array_keys($this->itemInstances))) |
166 | 166 | ->setRawData($info) |
167 | - ->setSize((int)$info[ 'used_memory' ]) |
|
167 | + ->setSize((int) $info['used_memory']) |
|
168 | 168 | ->setInfo(\sprintf("The Redis daemon v%s is up since %s.\n For more information see RawData. \n Driver size includes the memory allocation size.", |
169 | - $info[ 'redis_version' ], $date->format(DATE_RFC2822))); |
|
169 | + $info['redis_version'], $date->format(DATE_RFC2822))); |
|
170 | 170 | } |
171 | 171 | } |
172 | 172 | \ 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\Apc; |
17 | 17 | |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | if ($item instanceof Item) { |
88 | 88 | $ttl = $item->getExpirationDate()->getTimestamp() - \time(); |
89 | 89 | |
90 | - return (bool)apc_store($item->getKey(), $this->driverPreWrap($item), ($ttl > 0 ? $ttl : 0)); |
|
90 | + return (bool) apc_store($item->getKey(), $this->driverPreWrap($item), ($ttl > 0 ? $ttl : 0)); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | throw new PhpfastcacheInvalidArgumentException('Cross-Driver type confusion detected'); |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | * Check for Cross-Driver type confusion |
105 | 105 | */ |
106 | 106 | if ($item instanceof Item) { |
107 | - return (bool)apc_delete($item->getKey()); |
|
107 | + return (bool) apc_delete($item->getKey()); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | throw new PhpfastcacheInvalidArgumentException('Cross-Driver type confusion detected'); |
@@ -129,14 +129,14 @@ discard block |
||
129 | 129 | */ |
130 | 130 | public function getStats(): DriverStatistic |
131 | 131 | { |
132 | - $stats = (array)apc_cache_info('user'); |
|
133 | - $date = (new \DateTime())->setTimestamp($stats[ 'start_time' ]); |
|
132 | + $stats = (array) apc_cache_info('user'); |
|
133 | + $date = (new \DateTime())->setTimestamp($stats['start_time']); |
|
134 | 134 | |
135 | 135 | return (new DriverStatistic()) |
136 | 136 | ->setData(\implode(', ', \array_keys($this->itemInstances))) |
137 | 137 | ->setInfo(\sprintf("The APC cache is up since %s, and have %d item(s) in cache.\n For more information see RawData.", $date->format(DATE_RFC2822), |
138 | - $stats[ 'num_entries' ])) |
|
138 | + $stats['num_entries'])) |
|
139 | 139 | ->setRawData($stats) |
140 | - ->setSize($stats[ 'mem_size' ]); |
|
140 | + ->setSize($stats['mem_size']); |
|
141 | 141 | } |
142 | 142 | } |
143 | 143 | \ 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 @@ 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 |
@@ -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; |
@@ -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 |
@@ -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; |
17 | 17 | |
@@ -76,8 +76,8 @@ discard block |
||
76 | 76 | * due to performance issue on huge |
77 | 77 | * loop dispatching operations |
78 | 78 | */ |
79 | - if (isset($this->events[ $eventName ])) { |
|
80 | - foreach ($this->events[ $eventName ] as $event) { |
|
79 | + if (isset($this->events[$eventName])) { |
|
80 | + foreach ($this->events[$eventName] as $event) { |
|
81 | 81 | call_user_func_array($event, $args); |
82 | 82 | } |
83 | 83 | } |
@@ -93,14 +93,14 @@ discard block |
||
93 | 93 | { |
94 | 94 | if (\strpos($name, 'on') === 0) { |
95 | 95 | $name = \substr($name, 2); |
96 | - if (\is_callable($arguments[ 0 ])) { |
|
97 | - if (isset($arguments[ 1 ]) && \is_string($arguments[ 0 ])) { |
|
98 | - $this->events[ $name ][ $arguments[ 1 ] ] = $arguments[ 0 ]; |
|
96 | + if (\is_callable($arguments[0])) { |
|
97 | + if (isset($arguments[1]) && \is_string($arguments[0])) { |
|
98 | + $this->events[$name][$arguments[1]] = $arguments[0]; |
|
99 | 99 | } else { |
100 | - $this->events[ $name ][] = $arguments[ 0 ]; |
|
100 | + $this->events[$name][] = $arguments[0]; |
|
101 | 101 | } |
102 | 102 | } else { |
103 | - throw new PhpfastcacheInvalidArgumentException(\sprintf('Expected Callable, got "%s"', \gettype($arguments[ 0 ]))); |
|
103 | + throw new PhpfastcacheInvalidArgumentException(\sprintf('Expected Callable, got "%s"', \gettype($arguments[0]))); |
|
104 | 104 | } |
105 | 105 | } else { |
106 | 106 | throw new \BadMethodCallException('An event must start with "on" such as "onCacheGetItem"'); |
@@ -114,8 +114,8 @@ discard block |
||
114 | 114 | */ |
115 | 115 | public function unbindEventCallback($eventName, $callbackName): bool |
116 | 116 | { |
117 | - $return = isset($this->events[ $eventName ][ $callbackName ]); |
|
118 | - unset($this->events[ $eventName ][ $callbackName ]); |
|
117 | + $return = isset($this->events[$eventName][$callbackName]); |
|
118 | + unset($this->events[$eventName][$callbackName]); |
|
119 | 119 | |
120 | 120 | return $return; |
121 | 121 | } |
@@ -221,11 +221,11 @@ discard block |
||
221 | 221 | $this->printSkipText('A driver could not be initialized due to missing requirement: ' . $exception->getMessage()); |
222 | 222 | } else { |
223 | 223 | $this->printFailText(\sprintf( |
224 | - 'Uncaught exception "%s" in "%s" line %d with message: "%s"', |
|
225 | - \get_class($exception), |
|
226 | - $exception->getFile(), |
|
227 | - $exception->getLine(), |
|
228 | - $exception->getMessage() |
|
224 | + 'Uncaught exception "%s" in "%s" line %d with message: "%s"', |
|
225 | + \get_class($exception), |
|
226 | + $exception->getFile(), |
|
227 | + $exception->getLine(), |
|
228 | + $exception->getMessage() |
|
229 | 229 | )); |
230 | 230 | } |
231 | 231 | $this->terminateTest(); |
@@ -272,17 +272,17 @@ discard block |
||
272 | 272 | |
273 | 273 | if ($errorType === '[FATAL ERROR]') { |
274 | 274 | $this->printFailText(\sprintf( |
275 | - "A critical error has been caught: \"%s\" in %s line %d", |
|
276 | - "$errorType $errstr", |
|
277 | - $errfile, |
|
278 | - $errline |
|
275 | + "A critical error has been caught: \"%s\" in %s line %d", |
|
276 | + "$errorType $errstr", |
|
277 | + $errfile, |
|
278 | + $errline |
|
279 | 279 | )); |
280 | 280 | } else { |
281 | 281 | $this->printDebugText(\sprintf( |
282 | - "A non-critical error has been caught: \"%s\" in %s line %d", |
|
283 | - "$errorType $errstr", |
|
284 | - $errfile, |
|
285 | - $errline |
|
282 | + "A non-critical error has been caught: \"%s\" in %s line %d", |
|
283 | + "$errorType $errstr", |
|
284 | + $errfile, |
|
285 | + $errline |
|
286 | 286 | )); |
287 | 287 | } |
288 | 288 | } |