@@ -137,10 +137,10 @@ |
||
137 | 137 | $date = (new \DateTime())->setTimestamp($stats[ 'start_time' ]); |
138 | 138 | |
139 | 139 | return (new DriverStatistic()) |
140 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
141 | - ->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), |
|
140 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
141 | + ->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), |
|
142 | 142 | $stats[ 'num_entries' ])) |
143 | - ->setRawData($stats) |
|
144 | - ->setSize($stats[ 'mem_size' ]); |
|
143 | + ->setRawData($stats) |
|
144 | + ->setSize($stats[ 'mem_size' ]); |
|
145 | 145 | } |
146 | 146 | } |
147 | 147 | \ No newline at end of file |
@@ -133,14 +133,14 @@ |
||
133 | 133 | */ |
134 | 134 | public function getStats() |
135 | 135 | { |
136 | - $stats = (array)apc_cache_info('user'); |
|
137 | - $date = (new \DateTime())->setTimestamp($stats[ 'start_time' ]); |
|
136 | + $stats = (array) apc_cache_info('user'); |
|
137 | + $date = (new \DateTime())->setTimestamp($stats['start_time']); |
|
138 | 138 | |
139 | 139 | return (new DriverStatistic()) |
140 | 140 | ->setData(implode(', ', array_keys($this->itemInstances))) |
141 | 141 | ->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), |
142 | - $stats[ 'num_entries' ])) |
|
142 | + $stats['num_entries'])) |
|
143 | 143 | ->setRawData($stats) |
144 | - ->setSize($stats[ 'mem_size' ]); |
|
144 | + ->setSize($stats['mem_size']); |
|
145 | 145 | } |
146 | 146 | } |
147 | 147 | \ No newline at end of file |
@@ -137,10 +137,10 @@ |
||
137 | 137 | $info = xcache_info(XC_TYPE_VAR, 0); |
138 | 138 | |
139 | 139 | return (new DriverStatistic()) |
140 | - ->setSize(abs($info[ 'size' ] - $info[ 'avail' ])) |
|
141 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
142 | - ->setInfo(sprintf("Xcache v%s with following modules loaded:\n %s", XCACHE_VERSION, str_replace(' ', ', ', XCACHE_MODULES))) |
|
143 | - ->setRawData($info); |
|
140 | + ->setSize(abs($info[ 'size' ] - $info[ 'avail' ])) |
|
141 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
142 | + ->setInfo(sprintf("Xcache v%s with following modules loaded:\n %s", XCACHE_VERSION, str_replace(' ', ', ', XCACHE_MODULES))) |
|
143 | + ->setRawData($info); |
|
144 | 144 | } else { |
145 | 145 | throw new \RuntimeException("PhpFastCache is not able to read Xcache configuration. Please put this to your php.ini:\n |
146 | 146 | [xcache.admin] |
@@ -137,7 +137,7 @@ |
||
137 | 137 | $info = xcache_info(XC_TYPE_VAR, 0); |
138 | 138 | |
139 | 139 | return (new DriverStatistic()) |
140 | - ->setSize(abs($info[ 'size' ] - $info[ 'avail' ])) |
|
140 | + ->setSize(abs($info['size'] - $info['avail'])) |
|
141 | 141 | ->setData(implode(', ', array_keys($this->itemInstances))) |
142 | 142 | ->setInfo(sprintf("Xcache v%s with following modules loaded:\n %s", XCACHE_VERSION, str_replace(' ', ', ', XCACHE_MODULES))) |
143 | 143 | ->setRawData($info); |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | |
61 | 61 | /** |
62 | 62 | * @param \Psr\Cache\CacheItemInterface $item |
63 | - * @return mixed |
|
63 | + * @return boolean |
|
64 | 64 | * @throws phpFastCacheDriverException |
65 | 65 | * @throws phpFastCacheInvalidArgumentException |
66 | 66 | */ |
@@ -187,6 +187,7 @@ discard block |
||
187 | 187 | } |
188 | 188 | |
189 | 189 | /** |
190 | + * @param string $docId |
|
190 | 191 | * @return string|null |
191 | 192 | */ |
192 | 193 | protected function getLatestDocumentRevision($docId) |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | if ($item instanceof Item) { |
73 | 73 | try { |
74 | 74 | $this->instance->putDocument(['data' => $this->encode($this->driverPreWrap($item))], $item->getEncodedKey(), |
75 | - $this->getLatestDocumentRevision($item->getEncodedKey())); |
|
75 | + $this->getLatestDocumentRevision($item->getEncodedKey())); |
|
76 | 76 | } catch (CouchDBException $e) { |
77 | 77 | throw new phpFastCacheDriverException('Got error while trying to upsert a document: ' . $e->getMessage(), null, $e); |
78 | 78 | } |
@@ -174,9 +174,9 @@ discard block |
||
174 | 174 | $url .= $path; |
175 | 175 | |
176 | 176 | $this->instance = CouchDBClient::create([ |
177 | - 'dbname' => $this->getDatabaseName(), |
|
178 | - 'url' => $url, |
|
179 | - 'timeout' => $timeout, |
|
177 | + 'dbname' => $this->getDatabaseName(), |
|
178 | + 'url' => $url, |
|
179 | + 'timeout' => $timeout, |
|
180 | 180 | ]); |
181 | 181 | |
182 | 182 | $this->createDatabase(); |
@@ -193,10 +193,10 @@ discard block |
||
193 | 193 | $path = '/' . $this->getDatabaseName() . '/' . urlencode($docId); |
194 | 194 | |
195 | 195 | $response = $this->instance->getHttpClient()->request( |
196 | - 'HEAD', |
|
197 | - $path, |
|
198 | - null, |
|
199 | - false |
|
196 | + 'HEAD', |
|
197 | + $path, |
|
198 | + null, |
|
199 | + false |
|
200 | 200 | ); |
201 | 201 | if (!empty($response->headers[ 'etag' ])) { |
202 | 202 | return trim($response->headers[ 'etag' ], " '\"\t\n\r\0\x0B"); |
@@ -250,9 +250,9 @@ discard block |
||
250 | 250 | $info = $this->instance->getDatabaseInfo(); |
251 | 251 | |
252 | 252 | return (new DriverStatistic()) |
253 | - ->setSize($info[ 'sizes' ][ 'active' ]) |
|
254 | - ->setRawData($info) |
|
255 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
256 | - ->setInfo('Couchdb version ' . $this->instance->getVersion() . "\n For more information see RawData."); |
|
253 | + ->setSize($info[ 'sizes' ][ 'active' ]) |
|
254 | + ->setRawData($info) |
|
255 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
256 | + ->setInfo('Couchdb version ' . $this->instance->getVersion() . "\n For more information see RawData."); |
|
257 | 257 | } |
258 | 258 | } |
259 | 259 | \ No newline at end of file |
@@ -95,10 +95,10 @@ discard block |
||
95 | 95 | throw new phpFastCacheDriverException('Got error while trying to get a document: ' . $e->getMessage(), null, $e); |
96 | 96 | } |
97 | 97 | |
98 | - if ($response->status === 404 || empty($response->body[ 'data' ])) { |
|
98 | + if ($response->status === 404 || empty($response->body['data'])) { |
|
99 | 99 | return null; |
100 | 100 | } else if ($response->status === 200) { |
101 | - return $this->decode($response->body[ 'data' ]); |
|
101 | + return $this->decode($response->body['data']); |
|
102 | 102 | } else { |
103 | 103 | throw new phpFastCacheDriverException('Got unexpected HTTP status: ' . $response->status); |
104 | 104 | } |
@@ -153,13 +153,13 @@ discard block |
||
153 | 153 | if ($this->instance instanceof CouchdbClient) { |
154 | 154 | throw new phpFastCacheLogicException('Already connected to Couchdb server'); |
155 | 155 | } else { |
156 | - $host = isset($this->config[ 'host' ]) ? $this->config[ 'host' ] : '127.0.0.1'; |
|
157 | - $ssl = isset($this->config[ 'ssl' ]) ? $this->config[ 'ssl' ] : false; |
|
158 | - $port = isset($this->config[ 'port' ]) ? $this->config[ 'port' ] : 5984; |
|
159 | - $path = isset($this->config[ 'path' ]) ? $this->config[ 'path' ] : '/'; |
|
160 | - $username = isset($this->config[ 'username' ]) ? $this->config[ 'username' ] : ''; |
|
161 | - $password = isset($this->config[ 'password' ]) ? $this->config[ 'password' ] : ''; |
|
162 | - $timeout = isset($this->config[ 'timeout' ]) ? $this->config[ 'timeout' ] : 10; |
|
156 | + $host = isset($this->config['host']) ? $this->config['host'] : '127.0.0.1'; |
|
157 | + $ssl = isset($this->config['ssl']) ? $this->config['ssl'] : false; |
|
158 | + $port = isset($this->config['port']) ? $this->config['port'] : 5984; |
|
159 | + $path = isset($this->config['path']) ? $this->config['path'] : '/'; |
|
160 | + $username = isset($this->config['username']) ? $this->config['username'] : ''; |
|
161 | + $password = isset($this->config['password']) ? $this->config['password'] : ''; |
|
162 | + $timeout = isset($this->config['timeout']) ? $this->config['timeout'] : 10; |
|
163 | 163 | |
164 | 164 | $url = ($ssl ? 'https://' : 'http://'); |
165 | 165 | if ($username) { |
@@ -198,8 +198,8 @@ discard block |
||
198 | 198 | null, |
199 | 199 | false |
200 | 200 | ); |
201 | - if (!empty($response->headers[ 'etag' ])) { |
|
202 | - return trim($response->headers[ 'etag' ], " '\"\t\n\r\0\x0B"); |
|
201 | + if (!empty($response->headers['etag'])) { |
|
202 | + return trim($response->headers['etag'], " '\"\t\n\r\0\x0B"); |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | return null; |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | */ |
211 | 211 | protected function getDatabaseName() |
212 | 212 | { |
213 | - return isset($this->config[ 'database' ]) ? $this->config[ 'database' ] : 'phpfastcache'; |
|
213 | + return isset($this->config['database']) ? $this->config['database'] : 'phpfastcache'; |
|
214 | 214 | } |
215 | 215 | |
216 | 216 | /** |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | $info = $this->instance->getDatabaseInfo(); |
251 | 251 | |
252 | 252 | return (new DriverStatistic()) |
253 | - ->setSize($info[ 'sizes' ][ 'active' ]) |
|
253 | + ->setSize($info['sizes']['active']) |
|
254 | 254 | ->setRawData($info) |
255 | 255 | ->setData(implode(', ', array_keys($this->itemInstances))) |
256 | 256 | ->setInfo('Couchdb version ' . $this->instance->getVersion() . "\n For more information see RawData."); |
@@ -137,10 +137,10 @@ |
||
137 | 137 | $date = (new \DateTime())->setTimestamp($stats[ 'start_time' ]); |
138 | 138 | |
139 | 139 | return (new DriverStatistic()) |
140 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
141 | - ->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), |
|
140 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
141 | + ->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), |
|
142 | 142 | $stats[ 'num_entries' ])) |
143 | - ->setRawData($stats) |
|
144 | - ->setSize($stats[ 'mem_size' ]); |
|
143 | + ->setRawData($stats) |
|
144 | + ->setSize($stats[ 'mem_size' ]); |
|
145 | 145 | } |
146 | 146 | } |
147 | 147 | \ No newline at end of file |
@@ -133,14 +133,14 @@ |
||
133 | 133 | */ |
134 | 134 | public function getStats() |
135 | 135 | { |
136 | - $stats = (array)apcu_cache_info(); |
|
137 | - $date = (new \DateTime())->setTimestamp($stats[ 'start_time' ]); |
|
136 | + $stats = (array) apcu_cache_info(); |
|
137 | + $date = (new \DateTime())->setTimestamp($stats['start_time']); |
|
138 | 138 | |
139 | 139 | return (new DriverStatistic()) |
140 | 140 | ->setData(implode(', ', array_keys($this->itemInstances))) |
141 | 141 | ->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), |
142 | - $stats[ 'num_entries' ])) |
|
142 | + $stats['num_entries'])) |
|
143 | 143 | ->setRawData($stats) |
144 | - ->setSize($stats[ 'mem_size' ]); |
|
144 | + ->setSize($stats['mem_size']); |
|
145 | 145 | } |
146 | 146 | } |
147 | 147 | \ No newline at end of file |
@@ -128,10 +128,10 @@ discard block |
||
128 | 128 | $config = isset($this->config[ 'predis' ]) ? $this->config[ 'predis' ] : []; |
129 | 129 | |
130 | 130 | $this->instance = new PredisClient(array_merge([ |
131 | - 'host' => '127.0.0.1', |
|
132 | - 'port' => 6379, |
|
133 | - 'password' => null, |
|
134 | - 'database' => null, |
|
131 | + 'host' => '127.0.0.1', |
|
132 | + 'port' => 6379, |
|
133 | + 'password' => null, |
|
134 | + 'database' => null, |
|
135 | 135 | ], $config)); |
136 | 136 | |
137 | 137 | try { |
@@ -174,10 +174,10 @@ discard block |
||
174 | 174 | $date = (isset($info[ 'Server' ][ 'uptime_in_seconds' ]) ? (new \DateTime())->setTimestamp(time() - $info[ 'Server' ][ 'uptime_in_seconds' ]) : 'unknown date'); |
175 | 175 | |
176 | 176 | return (new DriverStatistic()) |
177 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
178 | - ->setRawData($info) |
|
179 | - ->setSize($size) |
|
180 | - ->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.", |
|
177 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
178 | + ->setRawData($info) |
|
179 | + ->setSize($size) |
|
180 | + ->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.", |
|
181 | 181 | $version, $date->format(DATE_RFC2822))); |
182 | 182 | } |
183 | 183 | } |
184 | 184 | \ No newline at end of file |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | */ |
126 | 126 | protected function driverConnect() |
127 | 127 | { |
128 | - $config = isset($this->config[ 'predis' ]) ? $this->config[ 'predis' ] : []; |
|
128 | + $config = isset($this->config['predis']) ? $this->config['predis'] : []; |
|
129 | 129 | |
130 | 130 | $this->instance = new PredisClient(array_merge([ |
131 | 131 | 'host' => '127.0.0.1', |
@@ -169,9 +169,9 @@ discard block |
||
169 | 169 | public function getStats() |
170 | 170 | { |
171 | 171 | $info = $this->instance->info(); |
172 | - $size = (isset($info[ 'Memory' ][ 'used_memory' ]) ? $info[ 'Memory' ][ 'used_memory' ] : 0); |
|
173 | - $version = (isset($info[ 'Server' ][ 'redis_version' ]) ? $info[ 'Server' ][ 'redis_version' ] : 0); |
|
174 | - $date = (isset($info[ 'Server' ][ 'uptime_in_seconds' ]) ? (new \DateTime())->setTimestamp(time() - $info[ 'Server' ][ 'uptime_in_seconds' ]) : 'unknown date'); |
|
172 | + $size = (isset($info['Memory']['used_memory']) ? $info['Memory']['used_memory'] : 0); |
|
173 | + $version = (isset($info['Server']['redis_version']) ? $info['Server']['redis_version'] : 0); |
|
174 | + $date = (isset($info['Server']['uptime_in_seconds']) ? (new \DateTime())->setTimestamp(time() - $info['Server']['uptime_in_seconds']) : 'unknown date'); |
|
175 | 175 | |
176 | 176 | return (new DriverStatistic()) |
177 | 177 | ->setData(implode(', ', array_keys($this->itemInstances))) |
@@ -147,9 +147,9 @@ |
||
147 | 147 | { |
148 | 148 | $stat = new DriverStatistic(); |
149 | 149 | $stat->setInfo('[ZendDisk] A void info string') |
150 | - ->setSize(0) |
|
151 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
152 | - ->setRawData(false); |
|
150 | + ->setSize(0) |
|
151 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
152 | + ->setRawData(false); |
|
153 | 153 | |
154 | 154 | return $stat; |
155 | 155 | } |
@@ -133,12 +133,12 @@ discard block |
||
133 | 133 | $servers = (!empty($this->config[ 'servers' ]) && is_array($this->config[ 'servers' ]) ? $this->config[ 'servers' ] : []); |
134 | 134 | if (count($servers) < 1) { |
135 | 135 | $servers = [ |
136 | - [ |
|
136 | + [ |
|
137 | 137 | 'host' => '127.0.0.1', |
138 | 138 | 'port' => 11211, |
139 | 139 | 'sasl_user' => false, |
140 | 140 | 'sasl_password' => false, |
141 | - ], |
|
141 | + ], |
|
142 | 142 | ]; |
143 | 143 | } |
144 | 144 | |
@@ -175,9 +175,9 @@ discard block |
||
175 | 175 | $date = (new \DateTime())->setTimestamp(time() - $stats[ 'uptime' ]); |
176 | 176 | |
177 | 177 | return (new DriverStatistic()) |
178 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
179 | - ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats[ 'version' ], $date->format(DATE_RFC2822))) |
|
180 | - ->setRawData($stats) |
|
181 | - ->setSize($stats[ 'bytes' ]); |
|
178 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
179 | + ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats[ 'version' ], $date->format(DATE_RFC2822))) |
|
180 | + ->setRawData($stats) |
|
181 | + ->setSize($stats[ 'bytes' ]); |
|
182 | 182 | } |
183 | 183 | } |
184 | 184 | \ No newline at end of file |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | } else { |
54 | 54 | $this->driverConnect(); |
55 | 55 | |
56 | - if (array_key_exists('compress_data', $config) && $config[ 'compress_data' ] === true) { |
|
56 | + if (array_key_exists('compress_data', $config) && $config['compress_data'] === true) { |
|
57 | 57 | $this->memcacheFlags = MEMCACHE_COMPRESSED; |
58 | 58 | } |
59 | 59 | } |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | protected function driverConnect() |
131 | 131 | { |
132 | 132 | $this->instance = new MemcacheSoftware(); |
133 | - $servers = (!empty($this->config[ 'servers' ]) && is_array($this->config[ 'servers' ]) ? $this->config[ 'servers' ] : []); |
|
133 | + $servers = (!empty($this->config['servers']) && is_array($this->config['servers']) ? $this->config['servers'] : []); |
|
134 | 134 | if (count($servers) < 1) { |
135 | 135 | $servers = [ |
136 | 136 | [ |
@@ -144,11 +144,11 @@ discard block |
||
144 | 144 | |
145 | 145 | foreach ($servers as $server) { |
146 | 146 | try { |
147 | - if (!$this->instance->addServer($server[ 'host' ], $server[ 'port' ])) { |
|
147 | + if (!$this->instance->addServer($server['host'], $server['port'])) { |
|
148 | 148 | $this->fallback = true; |
149 | 149 | } |
150 | - if (!empty($server[ 'sasl_user' ]) && !empty($server[ 'sasl_password' ])) { |
|
151 | - $this->instance->setSaslAuthData($server[ 'sasl_user' ], $server[ 'sasl_password' ]); |
|
150 | + if (!empty($server['sasl_user']) && !empty($server['sasl_password'])) { |
|
151 | + $this->instance->setSaslAuthData($server['sasl_user'], $server['sasl_password']); |
|
152 | 152 | } |
153 | 153 | } catch (\Exception $e) { |
154 | 154 | $this->fallback = true; |
@@ -167,17 +167,17 @@ discard block |
||
167 | 167 | */ |
168 | 168 | public function getStats() |
169 | 169 | { |
170 | - $stats = (array)$this->instance->getstats(); |
|
171 | - $stats[ 'uptime' ] = (isset($stats[ 'uptime' ]) ? $stats[ 'uptime' ] : 0); |
|
172 | - $stats[ 'version' ] = (isset($stats[ 'version' ]) ? $stats[ 'version' ] : 'UnknownVersion'); |
|
173 | - $stats[ 'bytes' ] = (isset($stats[ 'bytes' ]) ? $stats[ 'version' ] : 0); |
|
170 | + $stats = (array) $this->instance->getstats(); |
|
171 | + $stats['uptime'] = (isset($stats['uptime']) ? $stats['uptime'] : 0); |
|
172 | + $stats['version'] = (isset($stats['version']) ? $stats['version'] : 'UnknownVersion'); |
|
173 | + $stats['bytes'] = (isset($stats['bytes']) ? $stats['version'] : 0); |
|
174 | 174 | |
175 | - $date = (new \DateTime())->setTimestamp(time() - $stats[ 'uptime' ]); |
|
175 | + $date = (new \DateTime())->setTimestamp(time() - $stats['uptime']); |
|
176 | 176 | |
177 | 177 | return (new DriverStatistic()) |
178 | 178 | ->setData(implode(', ', array_keys($this->itemInstances))) |
179 | - ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats[ 'version' ], $date->format(DATE_RFC2822))) |
|
179 | + ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats['version'], $date->format(DATE_RFC2822))) |
|
180 | 180 | ->setRawData($stats) |
181 | - ->setSize($stats[ 'bytes' ]); |
|
181 | + ->setSize($stats['bytes']); |
|
182 | 182 | } |
183 | 183 | } |
184 | 184 | \ No newline at end of file |
@@ -140,10 +140,10 @@ discard block |
||
140 | 140 | $password = isset($this->config[ 'password' ]) ? $this->config[ 'password' ] : ''; |
141 | 141 | $username = isset($this->config[ 'username' ]) ? $this->config[ 'username' ] : ''; |
142 | 142 | $buckets = isset($this->config[ 'buckets' ]) ? $this->config[ 'buckets' ] : [ |
143 | - [ |
|
143 | + [ |
|
144 | 144 | 'bucket' => 'default', |
145 | 145 | 'password' => '', |
146 | - ], |
|
146 | + ], |
|
147 | 147 | ]; |
148 | 148 | |
149 | 149 | $this->instance = new CouchbaseClient("couchbase://{$host}", $username, $password); |
@@ -193,10 +193,10 @@ discard block |
||
193 | 193 | $info = $this->getBucket()->manager()->info(); |
194 | 194 | |
195 | 195 | return (new DriverStatistic()) |
196 | - ->setSize($info[ 'basicStats' ][ 'diskUsed' ]) |
|
197 | - ->setRawData($info) |
|
198 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
199 | - ->setInfo('CouchBase version ' . $info[ 'nodes' ][ 0 ][ 'version' ] . ', Uptime (in days): ' . round($info[ 'nodes' ][ 0 ][ 'uptime' ] / 86400, |
|
200 | - 1) . "\n For more information see RawData."); |
|
196 | + ->setSize($info[ 'basicStats' ][ 'diskUsed' ]) |
|
197 | + ->setRawData($info) |
|
198 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
199 | + ->setInfo('CouchBase version ' . $info[ 'nodes' ][ 0 ][ 'version' ] . ', Uptime (in days): ' . round($info[ 'nodes' ][ 0 ][ 'uptime' ] / 86400, |
|
200 | + 1) . "\n For more information see RawData."); |
|
201 | 201 | } |
202 | 202 | } |
203 | 203 | \ No newline at end of file |
@@ -136,10 +136,10 @@ discard block |
||
136 | 136 | } else { |
137 | 137 | |
138 | 138 | |
139 | - $host = isset($this->config[ 'host' ]) ? $this->config[ 'host' ] : '127.0.0.1'; |
|
140 | - $password = isset($this->config[ 'password' ]) ? $this->config[ 'password' ] : ''; |
|
141 | - $username = isset($this->config[ 'username' ]) ? $this->config[ 'username' ] : ''; |
|
142 | - $buckets = isset($this->config[ 'buckets' ]) ? $this->config[ 'buckets' ] : [ |
|
139 | + $host = isset($this->config['host']) ? $this->config['host'] : '127.0.0.1'; |
|
140 | + $password = isset($this->config['password']) ? $this->config['password'] : ''; |
|
141 | + $username = isset($this->config['username']) ? $this->config['username'] : ''; |
|
142 | + $buckets = isset($this->config['buckets']) ? $this->config['buckets'] : [ |
|
143 | 143 | [ |
144 | 144 | 'bucket' => 'default', |
145 | 145 | 'password' => '', |
@@ -149,8 +149,8 @@ discard block |
||
149 | 149 | $this->instance = new CouchbaseClient("couchbase://{$host}", $username, $password); |
150 | 150 | |
151 | 151 | foreach ($buckets as $bucket) { |
152 | - $this->bucketCurrent = $this->bucketCurrent ?: $bucket[ 'bucket' ]; |
|
153 | - $this->setBucket($bucket[ 'bucket' ], $this->instance->openBucket($bucket[ 'bucket' ], $bucket[ 'password' ])); |
|
152 | + $this->bucketCurrent = $this->bucketCurrent ?: $bucket['bucket']; |
|
153 | + $this->setBucket($bucket['bucket'], $this->instance->openBucket($bucket['bucket'], $bucket['password'])); |
|
154 | 154 | } |
155 | 155 | } |
156 | 156 | |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | */ |
163 | 163 | protected function getBucket() |
164 | 164 | { |
165 | - return $this->bucketInstances[ $this->bucketCurrent ]; |
|
165 | + return $this->bucketInstances[$this->bucketCurrent]; |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | /** |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | protected function setBucket($bucketName, \CouchbaseBucket $CouchbaseBucket) |
174 | 174 | { |
175 | 175 | if (!array_key_exists($bucketName, $this->bucketInstances)) { |
176 | - $this->bucketInstances[ $bucketName ] = $CouchbaseBucket; |
|
176 | + $this->bucketInstances[$bucketName] = $CouchbaseBucket; |
|
177 | 177 | } else { |
178 | 178 | throw new phpFastCacheLogicException('A bucket instance with this name already exists.'); |
179 | 179 | } |
@@ -193,10 +193,10 @@ discard block |
||
193 | 193 | $info = $this->getBucket()->manager()->info(); |
194 | 194 | |
195 | 195 | return (new DriverStatistic()) |
196 | - ->setSize($info[ 'basicStats' ][ 'diskUsed' ]) |
|
196 | + ->setSize($info['basicStats']['diskUsed']) |
|
197 | 197 | ->setRawData($info) |
198 | 198 | ->setData(implode(', ', array_keys($this->itemInstances))) |
199 | - ->setInfo('CouchBase version ' . $info[ 'nodes' ][ 0 ][ 'version' ] . ', Uptime (in days): ' . round($info[ 'nodes' ][ 0 ][ 'uptime' ] / 86400, |
|
199 | + ->setInfo('CouchBase version ' . $info['nodes'][0]['version'] . ', Uptime (in days): ' . round($info['nodes'][0]['uptime'] / 86400, |
|
200 | 200 | 1) . "\n For more information see RawData."); |
201 | 201 | } |
202 | 202 | } |
203 | 203 | \ No newline at end of file |
@@ -147,9 +147,9 @@ |
||
147 | 147 | { |
148 | 148 | $stats = (array)zend_shm_cache_info(); |
149 | 149 | return (new DriverStatistic()) |
150 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
151 | - ->setInfo(sprintf("The Zend memory have %d item(s) in cache.\n For more information see RawData.", $stats[ 'items_total' ])) |
|
152 | - ->setRawData($stats) |
|
153 | - ->setSize($stats[ 'memory_total' ]); |
|
150 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
151 | + ->setInfo(sprintf("The Zend memory have %d item(s) in cache.\n For more information see RawData.", $stats[ 'items_total' ])) |
|
152 | + ->setRawData($stats) |
|
153 | + ->setSize($stats[ 'memory_total' ]); |
|
154 | 154 | } |
155 | 155 | } |
156 | 156 | \ No newline at end of file |
@@ -145,11 +145,11 @@ |
||
145 | 145 | */ |
146 | 146 | public function getStats() |
147 | 147 | { |
148 | - $stats = (array)zend_shm_cache_info(); |
|
148 | + $stats = (array) zend_shm_cache_info(); |
|
149 | 149 | return (new DriverStatistic()) |
150 | 150 | ->setData(implode(', ', array_keys($this->itemInstances))) |
151 | - ->setInfo(sprintf("The Zend memory have %d item(s) in cache.\n For more information see RawData.", $stats[ 'items_total' ])) |
|
151 | + ->setInfo(sprintf("The Zend memory have %d item(s) in cache.\n For more information see RawData.", $stats['items_total'])) |
|
152 | 152 | ->setRawData($stats) |
153 | - ->setSize($stats[ 'memory_total' ]); |
|
153 | + ->setSize($stats['memory_total']); |
|
154 | 154 | } |
155 | 155 | } |
156 | 156 | \ No newline at end of file |