@@ -126,7 +126,7 @@ |
||
126 | 126 | } |
127 | 127 | |
128 | 128 | /** |
129 | - * @return bool |
|
129 | + * @return boolean|null |
|
130 | 130 | */ |
131 | 131 | protected function driverConnect() |
132 | 132 | { |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | { |
133 | 133 | $this->instance = new MemcachedSoftware(); |
134 | 134 | $this->instance->setOption(\Memcached::OPT_BINARY_PROTOCOL, true); |
135 | - $servers = (!empty($this->config[ 'servers' ]) && is_array($this->config[ 'servers' ]) ? $this->config[ 'servers' ] : []); |
|
135 | + $servers = (!empty($this->config['servers']) && is_array($this->config['servers']) ? $this->config['servers'] : []); |
|
136 | 136 | if (count($servers) < 1) { |
137 | 137 | $servers = [ |
138 | 138 | [ |
@@ -146,11 +146,11 @@ discard block |
||
146 | 146 | |
147 | 147 | foreach ($servers as $server) { |
148 | 148 | try { |
149 | - if (!$this->instance->addServer($server[ 'host' ], $server[ 'port' ])) { |
|
149 | + if (!$this->instance->addServer($server['host'], $server['port'])) { |
|
150 | 150 | $this->fallback = true; |
151 | 151 | } |
152 | - if (!empty($server[ 'sasl_user' ]) && !empty($server[ 'sasl_password' ])) { |
|
153 | - $this->instance->setSaslAuthData($server[ 'sasl_user' ], $server[ 'sasl_password' ]); |
|
152 | + if (!empty($server['sasl_user']) && !empty($server['sasl_password'])) { |
|
153 | + $this->instance->setSaslAuthData($server['sasl_user'], $server['sasl_password']); |
|
154 | 154 | } |
155 | 155 | } catch (\Exception $e) { |
156 | 156 | $this->fallback = true; |
@@ -170,16 +170,16 @@ discard block |
||
170 | 170 | public function getStats() |
171 | 171 | { |
172 | 172 | $stats = current($this->instance->getStats()); |
173 | - $stats[ 'uptime' ] = (isset($stats[ 'uptime' ]) ? $stats[ 'uptime' ] : 0); |
|
174 | - $stats[ 'version' ] = (isset($stats[ 'version' ]) ? $stats[ 'version' ] : $this->instance->getVersion()); |
|
175 | - $stats[ 'bytes' ] = (isset($stats[ 'bytes' ]) ? $stats[ 'version' ] : 0); |
|
173 | + $stats['uptime'] = (isset($stats['uptime']) ? $stats['uptime'] : 0); |
|
174 | + $stats['version'] = (isset($stats['version']) ? $stats['version'] : $this->instance->getVersion()); |
|
175 | + $stats['bytes'] = (isset($stats['bytes']) ? $stats['version'] : 0); |
|
176 | 176 | |
177 | - $date = (new \DateTime())->setTimestamp(time() - $stats[ 'uptime' ]); |
|
177 | + $date = (new \DateTime())->setTimestamp(time() - $stats['uptime']); |
|
178 | 178 | |
179 | 179 | return (new DriverStatistic()) |
180 | 180 | ->setData(implode(', ', array_keys($this->itemInstances))) |
181 | - ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats[ 'version' ], $date->format(DATE_RFC2822))) |
|
181 | + ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats['version'], $date->format(DATE_RFC2822))) |
|
182 | 182 | ->setRawData($stats) |
183 | - ->setSize($stats[ 'bytes' ]); |
|
183 | + ->setSize($stats['bytes']); |
|
184 | 184 | } |
185 | 185 | } |
186 | 186 | \ No newline at end of file |