@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | $this->instance = new MemcacheSoftware(); |
53 | 53 | $this->driverConnect(); |
54 | 54 | |
55 | - if (array_key_exists('compress_data', $config) && $config[ 'compress_data' ] === true) { |
|
55 | + if (array_key_exists('compress_data', $config) && $config['compress_data'] === true) { |
|
56 | 56 | $this->memcacheFlags = MEMCACHE_COMPRESSED; |
57 | 57 | } |
58 | 58 | } |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | */ |
129 | 129 | protected function driverConnect() |
130 | 130 | { |
131 | - $servers = (!empty($this->config[ 'memcache' ]) && is_array($this->config[ 'memcache' ]) ? $this->config[ 'memcache' ] : []); |
|
131 | + $servers = (!empty($this->config['memcache']) && is_array($this->config['memcache']) ? $this->config['memcache'] : []); |
|
132 | 132 | if (count($servers) < 1) { |
133 | 133 | $servers = [ |
134 | 134 | ['127.0.0.1', 11211], |
@@ -137,11 +137,11 @@ discard block |
||
137 | 137 | |
138 | 138 | foreach ($servers as $server) { |
139 | 139 | try { |
140 | - if (!$this->instance->addserver($server[ 0 ], $server[ 1 ])) { |
|
140 | + if (!$this->instance->addserver($server[0], $server[1])) { |
|
141 | 141 | $this->fallback = true; |
142 | 142 | } |
143 | - if(!empty($server[ 'sasl_user' ]) && !empty($server[ 'sasl_password'])){ |
|
144 | - $this->instance->setSaslAuthData($server[ 'sasl_user' ], $server[ 'sasl_password']); |
|
143 | + if (!empty($server['sasl_user']) && !empty($server['sasl_password'])) { |
|
144 | + $this->instance->setSaslAuthData($server['sasl_user'], $server['sasl_password']); |
|
145 | 145 | } |
146 | 146 | } catch (\Exception $e) { |
147 | 147 | $this->fallback = true; |
@@ -161,12 +161,12 @@ discard block |
||
161 | 161 | public function getStats() |
162 | 162 | { |
163 | 163 | $stats = (array) $this->instance->getstats(); |
164 | - $date = (new \DateTime())->setTimestamp(time() - $stats[ 'uptime' ]); |
|
164 | + $date = (new \DateTime())->setTimestamp(time() - $stats['uptime']); |
|
165 | 165 | |
166 | 166 | return (new driverStatistic()) |
167 | 167 | ->setData(implode(', ', array_keys($this->itemInstances))) |
168 | - ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats[ 'version' ], $date->format(DATE_RFC2822))) |
|
168 | + ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats['version'], $date->format(DATE_RFC2822))) |
|
169 | 169 | ->setRawData($stats) |
170 | - ->setSize($stats[ 'bytes' ]); |
|
170 | + ->setSize($stats['bytes']); |
|
171 | 171 | } |
172 | 172 | } |
173 | 173 | \ No newline at end of file |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | */ |
128 | 128 | protected function driverConnect() |
129 | 129 | { |
130 | - $servers = (!empty($this->config[ 'memcache' ]) && is_array($this->config[ 'memcache' ]) ? $this->config[ 'memcache' ] : []); |
|
130 | + $servers = (!empty($this->config['memcache']) && is_array($this->config['memcache']) ? $this->config['memcache'] : []); |
|
131 | 131 | if (count($servers) < 1) { |
132 | 132 | $servers = [ |
133 | 133 | ['127.0.0.1', 11211], |
@@ -136,11 +136,11 @@ discard block |
||
136 | 136 | |
137 | 137 | foreach ($servers as $server) { |
138 | 138 | try { |
139 | - if (!$this->instance->addServer($server[ 0 ], $server[ 1 ])) { |
|
139 | + if (!$this->instance->addServer($server[0], $server[1])) { |
|
140 | 140 | $this->fallback = true; |
141 | 141 | } |
142 | - if(!empty($server[ 'sasl_user' ]) && !empty($server[ 'sasl_password'])){ |
|
143 | - $this->instance->setSaslAuthData($server[ 'sasl_user' ], $server[ 'sasl_password']); |
|
142 | + if (!empty($server['sasl_user']) && !empty($server['sasl_password'])) { |
|
143 | + $this->instance->setSaslAuthData($server['sasl_user'], $server['sasl_password']); |
|
144 | 144 | } |
145 | 145 | } catch (\Exception $e) { |
146 | 146 | $this->fallback = true; |
@@ -160,12 +160,12 @@ discard block |
||
160 | 160 | public function getStats() |
161 | 161 | { |
162 | 162 | $stats = (array) $this->instance->getStats(); |
163 | - $date = (new \DateTime())->setTimestamp(time() - $stats[ 'uptime' ]); |
|
163 | + $date = (new \DateTime())->setTimestamp(time() - $stats['uptime']); |
|
164 | 164 | |
165 | 165 | return (new driverStatistic()) |
166 | 166 | ->setData(implode(', ', array_keys($this->itemInstances))) |
167 | - ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats[ 'version' ], $date->format(DATE_RFC2822))) |
|
167 | + ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats['version'], $date->format(DATE_RFC2822))) |
|
168 | 168 | ->setRawData($stats) |
169 | - ->setSize($stats[ 'bytes' ]); |
|
169 | + ->setSize($stats['bytes']); |
|
170 | 170 | } |
171 | 171 | } |
172 | 172 | \ No newline at end of file |