@@ -131,12 +131,12 @@ discard block |
||
| 131 | 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 | + [ |
|
| 135 | 135 | 'host' => !empty($this->config[ 'host' ]) ? $this->config[ 'host' ] : '127.0.0.1', |
| 136 | 136 | 'port' => !empty($this->config[ 'port' ]) ? $this->config[ 'port' ] : 11211, |
| 137 | 137 | 'sasl_user' => !empty($this->config[ 'sasl_user' ]) ? $this->config[ 'sasl_user' ] : false, |
| 138 | 138 | 'sasl_password' => !empty($this->config[ 'sasl_password' ]) ? $this->config[ 'sasl_password' ] : false, |
| 139 | - ], |
|
| 139 | + ], |
|
| 140 | 140 | ]; |
| 141 | 141 | } |
| 142 | 142 | |
@@ -173,9 +173,9 @@ discard block |
||
| 173 | 173 | $date = (new \DateTime())->setTimestamp(time() - $stats[ 'uptime' ]); |
| 174 | 174 | |
| 175 | 175 | return (new driverStatistic()) |
| 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))) |
|
| 178 | - ->setRawData($stats) |
|
| 179 | - ->setSize($stats[ 'bytes' ]); |
|
| 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))) |
|
| 178 | + ->setRawData($stats) |
|
| 179 | + ->setSize($stats[ 'bytes' ]); |
|
| 180 | 180 | } |
| 181 | 181 | } |
| 182 | 182 | \ No newline at end of file |
@@ -128,14 +128,14 @@ discard block |
||
| 128 | 128 | { |
| 129 | 129 | $this->instance = new MemcachedSoftware(); |
| 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 | [ |
| 135 | - 'host' => !empty($this->config[ 'host' ]) ? $this->config[ 'host' ] : '127.0.0.1', |
|
| 136 | - 'port' => !empty($this->config[ 'port' ]) ? $this->config[ 'port' ] : 11211, |
|
| 137 | - 'sasl_user' => !empty($this->config[ 'sasl_user' ]) ? $this->config[ 'sasl_user' ] : false, |
|
| 138 | - 'sasl_password' => !empty($this->config[ 'sasl_password' ]) ? $this->config[ 'sasl_password' ] : false, |
|
| 135 | + 'host' => !empty($this->config['host']) ? $this->config['host'] : '127.0.0.1', |
|
| 136 | + 'port' => !empty($this->config['port']) ? $this->config['port'] : 11211, |
|
| 137 | + 'sasl_user' => !empty($this->config['sasl_user']) ? $this->config['sasl_user'] : false, |
|
| 138 | + 'sasl_password' => !empty($this->config['sasl_password']) ? $this->config['sasl_password'] : false, |
|
| 139 | 139 | ], |
| 140 | 140 | ]; |
| 141 | 141 | } |
@@ -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 |