@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $keyword = self::PREFIX . $item->getKey(); |
80 | 80 | $v = json_encode($this->driverPreWrap($item)); |
81 | 81 | |
82 | - if (isset($this->config[ 'limited_memory_each_object' ]) && strlen($v) > $this->config[ 'limited_memory_each_object' ]) { |
|
82 | + if (isset($this->config['limited_memory_each_object']) && strlen($v) > $this->config['limited_memory_each_object']) { |
|
83 | 83 | return false; |
84 | 84 | } |
85 | 85 | |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | // return null if no caching |
101 | 101 | // return value if in caching |
102 | 102 | $keyword = self::PREFIX . $key; |
103 | - $x = isset($_COOKIE[ $keyword ]) ? $this->decode(json_decode($_COOKIE[ $keyword ], true)) : false; |
|
103 | + $x = isset($_COOKIE[$keyword]) ? $this->decode(json_decode($_COOKIE[$keyword], true)) : false; |
|
104 | 104 | |
105 | 105 | if ($x == false) { |
106 | 106 | return null; |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | { |
122 | 122 | $this->driverConnect(); |
123 | 123 | $keyword = self::PREFIX . $key; |
124 | - $x = isset($_COOKIE[ $keyword ]) ? $this->decode(json_decode($_COOKIE[ $keyword ])->t) : false; |
|
124 | + $x = isset($_COOKIE[$keyword]) ? $this->decode(json_decode($_COOKIE[$keyword])->t) : false; |
|
125 | 125 | |
126 | 126 | return $x ? $x - time() : $x; |
127 | 127 | } |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | if ($item instanceof Item) { |
140 | 140 | $this->driverConnect(); |
141 | 141 | $keyword = self::PREFIX . $item->getKey(); |
142 | - $_COOKIE[ $keyword ] = null; |
|
142 | + $_COOKIE[$keyword] = null; |
|
143 | 143 | |
144 | 144 | return @setcookie($keyword, null, -10); |
145 | 145 | } else { |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | $this->driverConnect(); |
157 | 157 | foreach ($_COOKIE as $keyword => $value) { |
158 | 158 | if (strpos($keyword, self::PREFIX) !== false) { |
159 | - $_COOKIE[ $keyword ] = null; |
|
159 | + $_COOKIE[$keyword] = null; |
|
160 | 160 | $result = @setcookie($keyword, null, -10); |
161 | 161 | if ($return !== false) { |
162 | 162 | $return = $result; |
@@ -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 | } |
@@ -137,11 +137,11 @@ discard block |
||
137 | 137 | } else { |
138 | 138 | |
139 | 139 | |
140 | - $host = isset($this->config[ 'host' ]) ? $this->config[ 'host' ] : '127.0.0.1'; |
|
140 | + $host = isset($this->config['host']) ? $this->config['host'] : '127.0.0.1'; |
|
141 | 141 | //$port = isset($server[ 'port' ]) ? $server[ 'port' ] : '11211'; |
142 | - $password = isset($this->config[ 'password' ]) ? $this->config[ 'password' ] : ''; |
|
143 | - $username = isset($this->config[ 'username' ]) ? $this->config[ 'username' ] : ''; |
|
144 | - $buckets = isset($this->config[ 'buckets' ]) ? $this->config[ 'buckets' ] : [ |
|
142 | + $password = isset($this->config['password']) ? $this->config['password'] : ''; |
|
143 | + $username = isset($this->config['username']) ? $this->config['username'] : ''; |
|
144 | + $buckets = isset($this->config['buckets']) ? $this->config['buckets'] : [ |
|
145 | 145 | [ |
146 | 146 | 'bucket' => 'default', |
147 | 147 | 'password' => '', |
@@ -151,8 +151,8 @@ discard block |
||
151 | 151 | $this->instance = $this->instance ?: new CouchbaseClient("couchbase://{$host}", $username, $password); |
152 | 152 | |
153 | 153 | foreach ($buckets as $bucket) { |
154 | - $this->bucketCurrent = $this->bucketCurrent ?: $bucket[ 'bucket' ]; |
|
155 | - $this->setBucket($bucket[ 'bucket' ], $this->instance->openBucket($bucket[ 'bucket' ], $bucket[ 'password' ])); |
|
154 | + $this->bucketCurrent = $this->bucketCurrent ?: $bucket['bucket']; |
|
155 | + $this->setBucket($bucket['bucket'], $this->instance->openBucket($bucket['bucket'], $bucket['password'])); |
|
156 | 156 | } |
157 | 157 | } |
158 | 158 | } |
@@ -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 \LogicException('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 |
@@ -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 |