@@ -81,8 +81,7 @@ |
||
81 | 81 | return unlink($source); |
82 | 82 | } |
83 | 83 | |
84 | - $files = new RecursiveIteratorIterator |
|
85 | - ( |
|
84 | + $files = new RecursiveIteratorIterator( |
|
86 | 85 | new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS), |
87 | 86 | RecursiveIteratorIterator::CHILD_FIRST |
88 | 87 | ); |
@@ -23,10 +23,10 @@ |
||
23 | 23 | if (!is_object($driverInstance)) { |
24 | 24 | echo '[FAIL] CacheManager::getInstance() returned an invalid variable type:' . gettype($driverInstance) . "\n"; |
25 | 25 | $status = 1; |
26 | -}else if(!($driverInstance instanceof CacheItemPoolInterface)){ |
|
26 | +} else if (!($driverInstance instanceof CacheItemPoolInterface)) { |
|
27 | 27 | echo '[FAIL] CacheManager::getInstance() returned an invalid class:' . get_class($driverInstance) . "\n"; |
28 | 28 | $status = 1; |
29 | -}else{ |
|
29 | +} else { |
|
30 | 30 | echo '[PASS] CacheManager::getInstance() returned a valid CacheItemPoolInterface object: ' . get_class($driverInstance) . "\n"; |
31 | 31 | } |
32 | 32 |
@@ -122,11 +122,11 @@ discard block |
||
122 | 122 | } else { |
123 | 123 | $this->instance = $this->instance ?: new RedisClient(); |
124 | 124 | |
125 | - $host = isset($this->config[ 'host' ]) ? $this->config[ 'host' ] : '127.0.0.1'; |
|
126 | - $port = isset($this->config[ 'port' ]) ? (int) $this->config[ 'port' ] : '6379'; |
|
127 | - $password = isset($this->config[ 'password' ]) ? $this->config[ 'password' ] : ''; |
|
128 | - $database = isset($this->config[ 'database' ]) ? $this->config[ 'database' ] : ''; |
|
129 | - $timeout = isset($this->config[ 'timeout' ]) ? $this->config[ 'timeout' ] : ''; |
|
125 | + $host = isset($this->config['host']) ? $this->config['host'] : '127.0.0.1'; |
|
126 | + $port = isset($this->config['port']) ? (int) $this->config['port'] : '6379'; |
|
127 | + $password = isset($this->config['password']) ? $this->config['password'] : ''; |
|
128 | + $database = isset($this->config['database']) ? $this->config['database'] : ''; |
|
129 | + $timeout = isset($this->config['timeout']) ? $this->config['timeout'] : ''; |
|
130 | 130 | |
131 | 131 | if (!$this->instance->connect($host, (int) $port, (int) $timeout)) { |
132 | 132 | return false; |
@@ -156,12 +156,12 @@ discard block |
||
156 | 156 | { |
157 | 157 | // used_memory |
158 | 158 | $info = $this->instance->info(); |
159 | - $date = (new \DateTime())->setTimestamp(time() - $info[ 'uptime_in_seconds' ]); |
|
159 | + $date = (new \DateTime())->setTimestamp(time() - $info['uptime_in_seconds']); |
|
160 | 160 | |
161 | 161 | return (new driverStatistic()) |
162 | 162 | ->setData(implode(', ', array_keys($this->itemInstances))) |
163 | 163 | ->setRawData($info) |
164 | - ->setSize($info[ 'used_memory' ]) |
|
165 | - ->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))); |
|
164 | + ->setSize($info['used_memory']) |
|
165 | + ->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 | 166 | } |
167 | 167 | } |
168 | 168 | \ No newline at end of file |
@@ -133,12 +133,12 @@ |
||
133 | 133 | public function getStats() |
134 | 134 | { |
135 | 135 | $stats = (array) apc_cache_info('user'); |
136 | - $date = (new \DateTime())->setTimestamp($stats[ 'start_time' ]); |
|
136 | + $date = (new \DateTime())->setTimestamp($stats['start_time']); |
|
137 | 137 | |
138 | 138 | return (new driverStatistic()) |
139 | 139 | ->setData(implode(', ', array_keys($this->itemInstances))) |
140 | - ->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' ])) |
|
140 | + ->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 | 141 | ->setRawData($stats) |
142 | - ->setSize($stats[ 'mem_size' ]); |
|
142 | + ->setSize($stats['mem_size']); |
|
143 | 143 | } |
144 | 144 | } |
145 | 145 | \ No newline at end of file |
@@ -129,11 +129,11 @@ |
||
129 | 129 | { |
130 | 130 | $memInfo = wincache_ucache_meminfo(); |
131 | 131 | $info = wincache_ucache_info(); |
132 | - $date = (new \DateTime())->setTimestamp(time() - $info[ 'total_cache_uptime' ]); |
|
132 | + $date = (new \DateTime())->setTimestamp(time() - $info['total_cache_uptime']); |
|
133 | 133 | |
134 | 134 | return (new driverStatistic()) |
135 | 135 | ->setInfo(sprintf("The Wincache daemon is up since %s.\n For more information see RawData.", $date->format(DATE_RFC2822))) |
136 | - ->setSize($memInfo[ 'memory_free' ] - $memInfo[ 'memory_total' ]) |
|
136 | + ->setSize($memInfo['memory_free'] - $memInfo['memory_total']) |
|
137 | 137 | ->setData(implode(', ', array_keys($this->itemInstances))) |
138 | 138 | ->setRawData($memInfo); |
139 | 139 | } |
@@ -136,7 +136,7 @@ |
||
136 | 136 | $info = xcache_info(XC_TYPE_VAR, 0); |
137 | 137 | |
138 | 138 | return (new driverStatistic()) |
139 | - ->setSize(abs($info[ 'size' ] - $info[ 'avail' ])) |
|
139 | + ->setSize(abs($info['size'] - $info['avail'])) |
|
140 | 140 | ->setData(implode(', ', array_keys($this->itemInstances))) |
141 | 141 | ->setInfo(sprintf("Xcache v%s with following modules loaded:\n %s", XCACHE_VERSION, str_replace(' ', ', ', XCACHE_MODULES))) |
142 | 142 | ->setRawData($info); |
@@ -133,13 +133,13 @@ |
||
133 | 133 | public function getStats() |
134 | 134 | { |
135 | 135 | $stats = (array) apc_cache_info('user'); |
136 | - $date = (new \DateTime())->setTimestamp($stats[ 'start_time' ]); |
|
136 | + $date = (new \DateTime())->setTimestamp($stats['start_time']); |
|
137 | 137 | |
138 | 138 | return (new driverStatistic()) |
139 | 139 | ->setData(implode(', ', array_keys($this->itemInstances))) |
140 | 140 | ->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), |
141 | - $stats[ 'num_entries' ])) |
|
141 | + $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 |
@@ -138,17 +138,17 @@ discard block |
||
138 | 138 | protected function driverConnect() |
139 | 139 | { |
140 | 140 | try { |
141 | - $server = isset($this->config[ 'ssdb' ]) ? $this->config[ 'ssdb' ] : [ |
|
141 | + $server = isset($this->config['ssdb']) ? $this->config['ssdb'] : [ |
|
142 | 142 | 'host' => "127.0.0.1", |
143 | 143 | 'port' => 8888, |
144 | 144 | 'password' => '', |
145 | 145 | 'timeout' => 2000, |
146 | 146 | ]; |
147 | 147 | |
148 | - $host = $server[ 'host' ]; |
|
149 | - $port = isset($server[ 'port' ]) ? (int) $server[ 'port' ] : 8888; |
|
150 | - $password = isset($server[ 'password' ]) ? $server[ 'password' ] : ''; |
|
151 | - $timeout = !empty($server[ 'timeout' ]) ? (int) $server[ 'timeout' ] : 2000; |
|
148 | + $host = $server['host']; |
|
149 | + $port = isset($server['port']) ? (int) $server['port'] : 8888; |
|
150 | + $password = isset($server['password']) ? $server['password'] : ''; |
|
151 | + $timeout = !empty($server['timeout']) ? (int) $server['timeout'] : 2000; |
|
152 | 152 | $this->instance = new SimpleSSDB($host, $port, $timeout); |
153 | 153 | if (!empty($password)) { |
154 | 154 | $this->instance->auth($password); |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | * Data returned by Ssdb are very poorly formatted |
183 | 183 | * using hardcoded offset of pair key-value :-( |
184 | 184 | */ |
185 | - $stat->setInfo(sprintf("Ssdb-server v%s with a total of %s call(s).\n For more information see RawData.", $info[ 2 ], $info[ 6 ])) |
|
185 | + $stat->setInfo(sprintf("Ssdb-server v%s with a total of %s call(s).\n For more information see RawData.", $info[2], $info[6])) |
|
186 | 186 | ->setRawData($info) |
187 | 187 | ->setData(implode(', ', array_keys($this->itemInstances))) |
188 | 188 | ->setSize($this->instance->dbsize()); |
@@ -74,9 +74,9 @@ |
||
74 | 74 | */ |
75 | 75 | public function __call($name, $args) |
76 | 76 | { |
77 | - if(method_exists($this->instance, $name)){ |
|
77 | + if (method_exists($this->instance, $name)) { |
|
78 | 78 | return call_user_func_array([$this->instance, $name], $args); |
79 | - }else{ |
|
79 | + } else { |
|
80 | 80 | throw new \BadMethodCallException(sprintf('Method %s does not exists', $name)); |
81 | 81 | } |
82 | 82 | } |