@@ -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 |
@@ -134,13 +134,13 @@ |
||
134 | 134 | public function getStats() |
135 | 135 | { |
136 | 136 | $stats = (array) apc_cache_info('user'); |
137 | - $date = (new \DateTime())->setTimestamp($stats[ 'start_time' ]); |
|
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); |
@@ -126,10 +126,10 @@ discard block |
||
126 | 126 | $config = isset($this->config[ 'predis' ]) ? $this->config[ 'predis' ] : []; |
127 | 127 | |
128 | 128 | $this->instance = new PredisClient(array_merge([ |
129 | - 'host' => '127.0.0.1', |
|
130 | - 'port' => 6379, |
|
131 | - 'password' => null, |
|
132 | - 'database' => null, |
|
129 | + 'host' => '127.0.0.1', |
|
130 | + 'port' => 6379, |
|
131 | + 'password' => null, |
|
132 | + 'database' => null, |
|
133 | 133 | ], $config)); |
134 | 134 | |
135 | 135 | return true; |
@@ -152,9 +152,9 @@ discard block |
||
152 | 152 | $date = (isset($info['Server'][ 'uptime_in_seconds' ]) ? (new \DateTime())->setTimestamp(time() - $info['Server'][ 'uptime_in_seconds' ]) : 'unknown date'); |
153 | 153 | |
154 | 154 | return (new DriverStatistic()) |
155 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
156 | - ->setRawData($info) |
|
157 | - ->setSize($size) |
|
158 | - ->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.", $version, $date->format(DATE_RFC2822))); |
|
155 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
156 | + ->setRawData($info) |
|
157 | + ->setSize($size) |
|
158 | + ->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.", $version, $date->format(DATE_RFC2822))); |
|
159 | 159 | } |
160 | 160 | } |
161 | 161 | \ No newline at end of file |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | */ |
124 | 124 | protected function driverConnect() |
125 | 125 | { |
126 | - $config = isset($this->config[ 'predis' ]) ? $this->config[ 'predis' ] : []; |
|
126 | + $config = isset($this->config['predis']) ? $this->config['predis'] : []; |
|
127 | 127 | |
128 | 128 | $this->instance = new PredisClient(array_merge([ |
129 | 129 | 'host' => '127.0.0.1', |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | $info = $this->instance->info(); |
150 | 150 | $size = (isset($info['Memory']['used_memory']) ? $info['Memory']['used_memory'] : 0); |
151 | 151 | $version = (isset($info['Server']['redis_version']) ? $info['Server']['redis_version'] : 0); |
152 | - $date = (isset($info['Server'][ 'uptime_in_seconds' ]) ? (new \DateTime())->setTimestamp(time() - $info['Server'][ 'uptime_in_seconds' ]) : 'unknown date'); |
|
152 | + $date = (isset($info['Server']['uptime_in_seconds']) ? (new \DateTime())->setTimestamp(time() - $info['Server']['uptime_in_seconds']) : 'unknown date'); |
|
153 | 153 | |
154 | 154 | return (new DriverStatistic()) |
155 | 155 | ->setData(implode(', ', array_keys($this->itemInstances))) |
@@ -132,12 +132,12 @@ discard block |
||
132 | 132 | $servers = (!empty($this->config[ 'servers' ]) && is_array($this->config[ 'servers' ]) ? $this->config[ 'servers' ] : []); |
133 | 133 | if (count($servers) < 1) { |
134 | 134 | $servers = [ |
135 | - [ |
|
135 | + [ |
|
136 | 136 | 'host' =>'127.0.0.1', |
137 | 137 | 'port' => 11211, |
138 | 138 | 'sasl_user' => false, |
139 | 139 | 'sasl_password' => false |
140 | - ], |
|
140 | + ], |
|
141 | 141 | ]; |
142 | 142 | } |
143 | 143 | |
@@ -174,9 +174,9 @@ discard block |
||
174 | 174 | $date = (new \DateTime())->setTimestamp(time() - $stats[ 'uptime' ]); |
175 | 175 | |
176 | 176 | return (new DriverStatistic()) |
177 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
178 | - ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats[ 'version' ], $date->format(DATE_RFC2822))) |
|
179 | - ->setRawData($stats) |
|
180 | - ->setSize($stats[ 'bytes' ]); |
|
177 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
178 | + ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats[ 'version' ], $date->format(DATE_RFC2822))) |
|
179 | + ->setRawData($stats) |
|
180 | + ->setSize($stats[ 'bytes' ]); |
|
181 | 181 | } |
182 | 182 | } |
183 | 183 | \ 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 | } |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | */ |
130 | 130 | protected function driverConnect() |
131 | 131 | { |
132 | - $servers = (!empty($this->config[ 'servers' ]) && is_array($this->config[ 'servers' ]) ? $this->config[ 'servers' ] : []); |
|
132 | + $servers = (!empty($this->config['servers']) && is_array($this->config['servers']) ? $this->config['servers'] : []); |
|
133 | 133 | if (count($servers) < 1) { |
134 | 134 | $servers = [ |
135 | 135 | [ |
@@ -146,8 +146,8 @@ discard block |
||
146 | 146 | if (!$this->instance->addServer($server['host'], $server['port'])) { |
147 | 147 | $this->fallback = true; |
148 | 148 | } |
149 | - if(!empty($server[ 'sasl_user' ]) && !empty($server[ 'sasl_password'])){ |
|
150 | - $this->instance->setSaslAuthData($server[ 'sasl_user' ], $server[ 'sasl_password']); |
|
149 | + if (!empty($server['sasl_user']) && !empty($server['sasl_password'])) { |
|
150 | + $this->instance->setSaslAuthData($server['sasl_user'], $server['sasl_password']); |
|
151 | 151 | } |
152 | 152 | } catch (\Exception $e) { |
153 | 153 | $this->fallback = true; |
@@ -167,16 +167,16 @@ discard block |
||
167 | 167 | public function getStats() |
168 | 168 | { |
169 | 169 | $stats = (array) $this->instance->getstats(); |
170 | - $stats[ 'uptime' ] = (isset($stats[ 'uptime' ]) ? $stats[ 'uptime' ] : 0); |
|
171 | - $stats[ 'version' ] = (isset($stats[ 'version' ]) ? $stats[ 'version' ] : 'UnknownVersion'); |
|
172 | - $stats[ 'bytes' ] = (isset($stats[ 'bytes' ]) ? $stats[ 'version' ] : 0); |
|
170 | + $stats['uptime'] = (isset($stats['uptime']) ? $stats['uptime'] : 0); |
|
171 | + $stats['version'] = (isset($stats['version']) ? $stats['version'] : 'UnknownVersion'); |
|
172 | + $stats['bytes'] = (isset($stats['bytes']) ? $stats['version'] : 0); |
|
173 | 173 | |
174 | - $date = (new \DateTime())->setTimestamp(time() - $stats[ 'uptime' ]); |
|
174 | + $date = (new \DateTime())->setTimestamp(time() - $stats['uptime']); |
|
175 | 175 | |
176 | 176 | return (new DriverStatistic()) |
177 | 177 | ->setData(implode(', ', array_keys($this->itemInstances))) |
178 | - ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats[ 'version' ], $date->format(DATE_RFC2822))) |
|
178 | + ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats['version'], $date->format(DATE_RFC2822))) |
|
179 | 179 | ->setRawData($stats) |
180 | - ->setSize($stats[ 'bytes' ]); |
|
180 | + ->setSize($stats['bytes']); |
|
181 | 181 | } |
182 | 182 | } |
183 | 183 | \ No newline at end of file |
@@ -163,9 +163,9 @@ |
||
163 | 163 | $date = (new \DateTime())->setTimestamp(time() - $info[ 'uptime_in_seconds' ]); |
164 | 164 | |
165 | 165 | return (new DriverStatistic()) |
166 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
167 | - ->setRawData($info) |
|
168 | - ->setSize($info[ 'used_memory' ]) |
|
169 | - ->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.", $info[ 'redis_version' ], $date->format(DATE_RFC2822))); |
|
166 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
167 | + ->setRawData($info) |
|
168 | + ->setSize($info[ 'used_memory' ]) |
|
169 | + ->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.", $info[ 'redis_version' ], $date->format(DATE_RFC2822))); |
|
170 | 170 | } |
171 | 171 | } |
172 | 172 | \ No newline at end of file |
@@ -126,11 +126,11 @@ discard block |
||
126 | 126 | } else { |
127 | 127 | $this->instance = $this->instance ?: new RedisClient(); |
128 | 128 | |
129 | - $host = isset($this->config[ 'host' ]) ? $this->config[ 'host' ] : '127.0.0.1'; |
|
130 | - $port = isset($this->config[ 'port' ]) ? (int) $this->config[ 'port' ] : '6379'; |
|
131 | - $password = isset($this->config[ 'password' ]) ? $this->config[ 'password' ] : ''; |
|
132 | - $database = isset($this->config[ 'database' ]) ? $this->config[ 'database' ] : ''; |
|
133 | - $timeout = isset($this->config[ 'timeout' ]) ? $this->config[ 'timeout' ] : ''; |
|
129 | + $host = isset($this->config['host']) ? $this->config['host'] : '127.0.0.1'; |
|
130 | + $port = isset($this->config['port']) ? (int) $this->config['port'] : '6379'; |
|
131 | + $password = isset($this->config['password']) ? $this->config['password'] : ''; |
|
132 | + $database = isset($this->config['database']) ? $this->config['database'] : ''; |
|
133 | + $timeout = isset($this->config['timeout']) ? $this->config['timeout'] : ''; |
|
134 | 134 | |
135 | 135 | if (!$this->instance->connect($host, (int) $port, (int) $timeout)) { |
136 | 136 | return false; |
@@ -160,12 +160,12 @@ discard block |
||
160 | 160 | { |
161 | 161 | // used_memory |
162 | 162 | $info = $this->instance->info(); |
163 | - $date = (new \DateTime())->setTimestamp(time() - $info[ 'uptime_in_seconds' ]); |
|
163 | + $date = (new \DateTime())->setTimestamp(time() - $info['uptime_in_seconds']); |
|
164 | 164 | |
165 | 165 | return (new DriverStatistic()) |
166 | 166 | ->setData(implode(', ', array_keys($this->itemInstances))) |
167 | 167 | ->setRawData($info) |
168 | - ->setSize($info[ 'used_memory' ]) |
|
169 | - ->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.", $info[ 'redis_version' ], $date->format(DATE_RFC2822))); |
|
168 | + ->setSize($info['used_memory']) |
|
169 | + ->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.", $info['redis_version'], $date->format(DATE_RFC2822))); |
|
170 | 170 | } |
171 | 171 | } |
172 | 172 | \ No newline at end of file |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | */ |
129 | 129 | protected function driverConnect() |
130 | 130 | { |
131 | - $servers = (!empty($this->config[ 'servers' ]) && is_array($this->config[ 'servers' ]) ? $this->config[ 'servers' ] : []); |
|
131 | + $servers = (!empty($this->config['servers']) && is_array($this->config['servers']) ? $this->config['servers'] : []); |
|
132 | 132 | if (count($servers) < 1) { |
133 | 133 | $servers = [ |
134 | 134 | [ |
@@ -145,8 +145,8 @@ discard block |
||
145 | 145 | if (!$this->instance->addServer($server['host'], $server['port'])) { |
146 | 146 | $this->fallback = true; |
147 | 147 | } |
148 | - if(!empty($server[ 'sasl_user' ]) && !empty($server[ 'sasl_password'])){ |
|
149 | - $this->instance->setSaslAuthData($server[ 'sasl_user' ], $server[ 'sasl_password']); |
|
148 | + if (!empty($server['sasl_user']) && !empty($server['sasl_password'])) { |
|
149 | + $this->instance->setSaslAuthData($server['sasl_user'], $server['sasl_password']); |
|
150 | 150 | } |
151 | 151 | } catch (\Exception $e) { |
152 | 152 | $this->fallback = true; |
@@ -166,16 +166,16 @@ discard block |
||
166 | 166 | public function getStats() |
167 | 167 | { |
168 | 168 | $stats = (array) $this->instance->getStats(); |
169 | - $stats[ 'uptime' ] = (isset($stats[ 'uptime' ]) ? $stats[ 'uptime' ] : 0); |
|
170 | - $stats[ 'version' ] = (isset($stats[ 'version' ]) ? $stats[ 'version' ] : 'UnknownVersion'); |
|
171 | - $stats[ 'bytes' ] = (isset($stats[ 'bytes' ]) ? $stats[ 'version' ] : 0); |
|
169 | + $stats['uptime'] = (isset($stats['uptime']) ? $stats['uptime'] : 0); |
|
170 | + $stats['version'] = (isset($stats['version']) ? $stats['version'] : 'UnknownVersion'); |
|
171 | + $stats['bytes'] = (isset($stats['bytes']) ? $stats['version'] : 0); |
|
172 | 172 | |
173 | - $date = (new \DateTime())->setTimestamp(time() - $stats[ 'uptime' ]); |
|
173 | + $date = (new \DateTime())->setTimestamp(time() - $stats['uptime']); |
|
174 | 174 | |
175 | 175 | return (new DriverStatistic()) |
176 | 176 | ->setData(implode(', ', array_keys($this->itemInstances))) |
177 | - ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats[ 'version' ], $date->format(DATE_RFC2822))) |
|
177 | + ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats['version'], $date->format(DATE_RFC2822))) |
|
178 | 178 | ->setRawData($stats) |
179 | - ->setSize($stats[ 'bytes' ]); |
|
179 | + ->setSize($stats['bytes']); |
|
180 | 180 | } |
181 | 181 | } |
182 | 182 | \ No newline at end of file |
@@ -132,12 +132,12 @@ discard block |
||
132 | 132 | $servers = (!empty($this->config[ 'servers' ]) && is_array($this->config[ 'servers' ]) ? $this->config[ 'servers' ] : []); |
133 | 133 | if (count($servers) < 1) { |
134 | 134 | $servers = [ |
135 | - [ |
|
135 | + [ |
|
136 | 136 | 'host' =>'127.0.0.1', |
137 | 137 | 'port' => 11211, |
138 | 138 | 'sasl_user' => false, |
139 | 139 | 'sasl_password' => false |
140 | - ], |
|
140 | + ], |
|
141 | 141 | ]; |
142 | 142 | } |
143 | 143 | |
@@ -174,9 +174,9 @@ discard block |
||
174 | 174 | $date = (new \DateTime())->setTimestamp(time() - $stats[ 'uptime' ]); |
175 | 175 | |
176 | 176 | return (new DriverStatistic()) |
177 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
178 | - ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats[ 'version' ], $date->format(DATE_RFC2822))) |
|
179 | - ->setRawData($stats) |
|
180 | - ->setSize($stats[ 'bytes' ]); |
|
177 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
178 | + ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats[ 'version' ], $date->format(DATE_RFC2822))) |
|
179 | + ->setRawData($stats) |
|
180 | + ->setSize($stats[ 'bytes' ]); |
|
181 | 181 | } |
182 | 182 | } |
183 | 183 | \ 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,9 +193,9 @@ 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, 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, 1) . "\n For more information see RawData."); |
|
200 | 200 | } |
201 | 201 | } |
202 | 202 | \ 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,9 +193,9 @@ 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, 1) . "\n For more information see RawData."); |
|
199 | + ->setInfo('CouchBase version ' . $info['nodes'][0]['version'] . ', Uptime (in days): ' . round($info['nodes'][0]['uptime'] / 86400, 1) . "\n For more information see RawData."); |
|
200 | 200 | } |
201 | 201 | } |
202 | 202 | \ No newline at end of file |
@@ -137,9 +137,9 @@ |
||
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), $stats[ 'num_entries' ])) |
|
142 | - ->setRawData($stats) |
|
143 | - ->setSize($stats[ 'mem_size' ]); |
|
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), $stats[ 'num_entries' ])) |
|
142 | + ->setRawData($stats) |
|
143 | + ->setSize($stats[ 'mem_size' ]); |
|
144 | 144 | } |
145 | 145 | } |
146 | 146 | \ No newline at end of file |
@@ -134,12 +134,12 @@ |
||
134 | 134 | public function getStats() |
135 | 135 | { |
136 | 136 | $stats = (array) apcu_cache_info(); |
137 | - $date = (new \DateTime())->setTimestamp($stats[ 'start_time' ]); |
|
137 | + $date = (new \DateTime())->setTimestamp($stats['start_time']); |
|
138 | 138 | |
139 | 139 | return (new DriverStatistic()) |
140 | 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), $stats[ 'num_entries' ])) |
|
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), $stats['num_entries'])) |
|
142 | 142 | ->setRawData($stats) |
143 | - ->setSize($stats[ 'mem_size' ]); |
|
143 | + ->setSize($stats['mem_size']); |
|
144 | 144 | } |
145 | 145 | } |
146 | 146 | \ No newline at end of file |