@@ -62,7 +62,7 @@ |
||
62 | 62 | |
63 | 63 | /** |
64 | 64 | * @param \Psr\Cache\CacheItemInterface $item |
65 | - * @return mixed |
|
65 | + * @return boolean |
|
66 | 66 | * @throws phpFastCacheInvalidArgumentException |
67 | 67 | */ |
68 | 68 | protected function driverWrite(CacheItemInterface $item) |
@@ -80,9 +80,9 @@ discard block |
||
80 | 80 | protected function driverRead(CacheItemInterface $item) |
81 | 81 | { |
82 | 82 | return [ |
83 | - self::DRIVER_DATA_WRAPPER_INDEX => true, |
|
84 | - self::DRIVER_TAGS_WRAPPER_INDEX => [], |
|
85 | - self::DRIVER_EDATE_WRAPPER_INDEX => new \DateTime(), |
|
83 | + self::DRIVER_DATA_WRAPPER_INDEX => true, |
|
84 | + self::DRIVER_TAGS_WRAPPER_INDEX => [], |
|
85 | + self::DRIVER_EDATE_WRAPPER_INDEX => new \DateTime(), |
|
86 | 86 | ]; |
87 | 87 | } |
88 | 88 | |
@@ -132,9 +132,9 @@ discard block |
||
132 | 132 | { |
133 | 133 | $stat = new DriverStatistic(); |
134 | 134 | $stat->setInfo('[Devtrue] A void info string') |
135 | - ->setSize(0) |
|
136 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
137 | - ->setRawData(true); |
|
135 | + ->setSize(0) |
|
136 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
137 | + ->setRawData(true); |
|
138 | 138 | |
139 | 139 | return $stat; |
140 | 140 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | */ |
96 | 96 | public function printNewLine($count = 1) |
97 | 97 | { |
98 | - for($i = 0; $i < $count; $i++){ |
|
98 | + for ($i = 0; $i < $count; $i++) { |
|
99 | 99 | print PHP_EOL; |
100 | 100 | } |
101 | 101 | |
@@ -109,9 +109,9 @@ discard block |
||
109 | 109 | */ |
110 | 110 | public function printText($string, $strtoupper = false) |
111 | 111 | { |
112 | - if(!$strtoupper){ |
|
112 | + if (!$strtoupper) { |
|
113 | 113 | print trim($string) . PHP_EOL; |
114 | - }else{ |
|
114 | + } else { |
|
115 | 115 | print strtoupper(trim($string) . PHP_EOL); |
116 | 116 | } |
117 | 117 | |
@@ -123,8 +123,8 @@ discard block |
||
123 | 123 | */ |
124 | 124 | public function runAsyncProcess($cmd) |
125 | 125 | { |
126 | - if (substr(php_uname(), 0, 7) === 'Windows'){ |
|
127 | - pclose(popen('start /B '. $cmd, 'r')); |
|
126 | + if (substr(php_uname(), 0, 7) === 'Windows') { |
|
127 | + pclose(popen('start /B ' . $cmd, 'r')); |
|
128 | 128 | } |
129 | 129 | else { |
130 | 130 | exec($cmd . ' > /dev/null &'); |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | { |
112 | 112 | if(!$strtoupper){ |
113 | 113 | print trim($string) . PHP_EOL; |
114 | - }else{ |
|
114 | + } else{ |
|
115 | 115 | print strtoupper(trim($string) . PHP_EOL); |
116 | 116 | } |
117 | 117 | |
@@ -125,8 +125,7 @@ discard block |
||
125 | 125 | { |
126 | 126 | if (substr(php_uname(), 0, 7) === 'Windows'){ |
127 | 127 | pclose(popen('start /B '. $cmd, 'r')); |
128 | - } |
|
129 | - else { |
|
128 | + } else { |
|
130 | 129 | exec($cmd . ' > /dev/null &'); |
131 | 130 | } |
132 | 131 | } |
@@ -39,10 +39,10 @@ |
||
39 | 39 | */ |
40 | 40 | public function __construct($itemKey, \DateTime $itemDate) |
41 | 41 | { |
42 | - if(is_string($itemKey)){ |
|
42 | + if (is_string($itemKey)) { |
|
43 | 43 | $this->itemKey = $itemKey; |
44 | 44 | $this->itemDate = $itemDate; |
45 | - }else{ |
|
45 | + } else { |
|
46 | 46 | throw new phpFastCacheInvalidArgumentException(sprintf('$itemKey must be a string, got "%s" instead', gettype($itemKey))); |
47 | 47 | } |
48 | 48 | } |
@@ -42,7 +42,7 @@ |
||
42 | 42 | if(is_string($itemKey)){ |
43 | 43 | $this->itemKey = $itemKey; |
44 | 44 | $this->itemDate = $itemDate; |
45 | - }else{ |
|
45 | + } else{ |
|
46 | 46 | throw new phpFastCacheInvalidArgumentException(sprintf('$itemKey must be a string, got "%s" instead', gettype($itemKey))); |
47 | 47 | } |
48 | 48 | } |
@@ -76,7 +76,7 @@ |
||
76 | 76 | |
77 | 77 | /** |
78 | 78 | * @param \Psr\Cache\CacheItemInterface $item |
79 | - * @return mixed |
|
79 | + * @return boolean |
|
80 | 80 | * @throws phpFastCacheInvalidArgumentException |
81 | 81 | * @throws phpFastCacheDriverException |
82 | 82 | */ |
@@ -88,15 +88,15 @@ discard block |
||
88 | 88 | if ($item instanceof Item) { |
89 | 89 | try { |
90 | 90 | $result = (array) $this->getCollection()->updateOne( |
91 | - ['_id' => $item->getEncodedKey()], |
|
92 | - [ |
|
91 | + ['_id' => $item->getEncodedKey()], |
|
92 | + [ |
|
93 | 93 | '$set' => [ |
94 | - self::DRIVER_DATA_WRAPPER_INDEX => new Binary($this->encode($item->get()), Binary::TYPE_GENERIC), |
|
95 | - self::DRIVER_TAGS_WRAPPER_INDEX => new Binary($this->encode($item->getTags()), Binary::TYPE_GENERIC), |
|
96 | - self::DRIVER_EDATE_WRAPPER_INDEX => ($item->getTtl() > 0 ? new UTCDateTime((time() + $item->getTtl()) * 1000) : new UTCDateTime(time()*1000)), |
|
94 | + self::DRIVER_DATA_WRAPPER_INDEX => new Binary($this->encode($item->get()), Binary::TYPE_GENERIC), |
|
95 | + self::DRIVER_TAGS_WRAPPER_INDEX => new Binary($this->encode($item->getTags()), Binary::TYPE_GENERIC), |
|
96 | + self::DRIVER_EDATE_WRAPPER_INDEX => ($item->getTtl() > 0 ? new UTCDateTime((time() + $item->getTtl()) * 1000) : new UTCDateTime(time()*1000)), |
|
97 | 97 | ], |
98 | - ], |
|
99 | - ['upsert' => true, 'multiple' => false] |
|
98 | + ], |
|
99 | + ['upsert' => true, 'multiple' => false] |
|
100 | 100 | ); |
101 | 101 | } catch (MongoDBException $e) { |
102 | 102 | throw new phpFastCacheDriverException('Got an exception while trying to write data to MongoDB server', null, $e); |
@@ -118,9 +118,9 @@ discard block |
||
118 | 118 | |
119 | 119 | if ($document) { |
120 | 120 | return [ |
121 | - self::DRIVER_DATA_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_DATA_WRAPPER_INDEX ]->getData()), |
|
122 | - self::DRIVER_TAGS_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_TAGS_WRAPPER_INDEX ]->getData()), |
|
123 | - self::DRIVER_EDATE_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_EDATE_WRAPPER_INDEX ]->toDateTime()->getTimestamp()), |
|
121 | + self::DRIVER_DATA_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_DATA_WRAPPER_INDEX ]->getData()), |
|
122 | + self::DRIVER_TAGS_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_TAGS_WRAPPER_INDEX ]->getData()), |
|
123 | + self::DRIVER_EDATE_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_EDATE_WRAPPER_INDEX ]->toDateTime()->getTimestamp()), |
|
124 | 124 | ]; |
125 | 125 | } else { |
126 | 126 | return null; |
@@ -191,10 +191,10 @@ discard block |
||
191 | 191 | * @todo make an url builder |
192 | 192 | */ |
193 | 193 | $this->instance = $this->instance ?: (new MongodbManager('mongodb://' . |
194 | - ($username ?: '') . |
|
195 | - ($password ? ":{$password}" : '') . |
|
196 | - ($username ? '@' : '') . "{$host}" . |
|
197 | - ($port != '27017' ? ":{$port}" : ''), ['connectTimeoutMS' => $timeout * 1000])); |
|
194 | + ($username ?: '') . |
|
195 | + ($password ? ":{$password}" : '') . |
|
196 | + ($username ? '@' : '') . "{$host}" . |
|
197 | + ($port != '27017' ? ":{$port}" : ''), ['connectTimeoutMS' => $timeout * 1000])); |
|
198 | 198 | $this->collection = $this->collection ?: new Collection($this->instance,$databaseName, $collectionName); |
199 | 199 | |
200 | 200 | return true; |
@@ -222,15 +222,15 @@ discard block |
||
222 | 222 | public function getStats() |
223 | 223 | { |
224 | 224 | $serverStats = $this->instance->executeCommand('phpFastCache', new Command([ |
225 | - 'serverStatus' => 1, |
|
226 | - 'recordStats' => 0, |
|
227 | - 'repl' => 0, |
|
228 | - 'metrics' => 0, |
|
225 | + 'serverStatus' => 1, |
|
226 | + 'recordStats' => 0, |
|
227 | + 'repl' => 0, |
|
228 | + 'metrics' => 0, |
|
229 | 229 | ]))->toArray()[0]; |
230 | 230 | |
231 | 231 | $collectionStats = $this->instance->executeCommand('phpFastCache', new Command([ |
232 | - 'collStats' => (isset($this->config[ 'collectionName' ]) ? $this->config[ 'collectionName' ] : 'Cache'), |
|
233 | - 'verbose' => true, |
|
232 | + 'collStats' => (isset($this->config[ 'collectionName' ]) ? $this->config[ 'collectionName' ] : 'Cache'), |
|
233 | + 'verbose' => true, |
|
234 | 234 | ]))->toArray()[0]; |
235 | 235 | |
236 | 236 | $array_filter_recursive = function( $array, callable $callback = null ) use(&$array_filter_recursive) { |
@@ -260,13 +260,13 @@ discard block |
||
260 | 260 | $collectionStats = $array_filter_recursive($collectionStats, $callback); |
261 | 261 | |
262 | 262 | $stats = (new DriverStatistic()) |
263 | - ->setInfo('MongoDB version ' . $serverStats->version . ', Uptime (in days): ' . round($serverStats->uptime / 86400, 1) . "\n For more information see RawData.") |
|
264 | - ->setSize($collectionStats->size) |
|
265 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
266 | - ->setRawData([ |
|
263 | + ->setInfo('MongoDB version ' . $serverStats->version . ', Uptime (in days): ' . round($serverStats->uptime / 86400, 1) . "\n For more information see RawData.") |
|
264 | + ->setSize($collectionStats->size) |
|
265 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
266 | + ->setRawData([ |
|
267 | 267 | 'serverStatus' => $serverStats, |
268 | 268 | 'collStats' => $collectionStats, |
269 | - ]); |
|
269 | + ]); |
|
270 | 270 | |
271 | 271 | return $stats; |
272 | 272 | } |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | */ |
67 | 67 | public function driverCheck() |
68 | 68 | { |
69 | - if(!class_exists('MongoDB\Driver\Manager') && class_exists('MongoClient')){ |
|
69 | + if (!class_exists('MongoDB\Driver\Manager') && class_exists('MongoClient')) { |
|
70 | 70 | trigger_error('This driver is used to support the pecl MongoDb extension with mongo-php-library. |
71 | 71 | For MongoDb with Mongo PECL support use Mongo Driver.', E_USER_ERROR); |
72 | 72 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | '$set' => [ |
94 | 94 | self::DRIVER_DATA_WRAPPER_INDEX => new Binary($this->encode($item->get()), Binary::TYPE_GENERIC), |
95 | 95 | self::DRIVER_TAGS_WRAPPER_INDEX => new Binary($this->encode($item->getTags()), Binary::TYPE_GENERIC), |
96 | - self::DRIVER_EDATE_WRAPPER_INDEX => ($item->getTtl() > 0 ? new UTCDateTime((time() + $item->getTtl()) * 1000) : new UTCDateTime(time()*1000)), |
|
96 | + self::DRIVER_EDATE_WRAPPER_INDEX => ($item->getTtl() > 0 ? new UTCDateTime((time() + $item->getTtl()) * 1000) : new UTCDateTime(time() * 1000)), |
|
97 | 97 | ], |
98 | 98 | ], |
99 | 99 | ['upsert' => true, 'multiple' => false] |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | throw new phpFastCacheDriverException('Got an exception while trying to write data to MongoDB server', null, $e); |
103 | 103 | } |
104 | 104 | |
105 | - return isset($result[ 'ok' ]) ? $result[ 'ok' ] == 1 : true; |
|
105 | + return isset($result['ok']) ? $result['ok'] == 1 : true; |
|
106 | 106 | } else { |
107 | 107 | throw new phpFastCacheInvalidArgumentException('Cross-Driver type confusion detected'); |
108 | 108 | } |
@@ -118,9 +118,9 @@ discard block |
||
118 | 118 | |
119 | 119 | if ($document) { |
120 | 120 | return [ |
121 | - self::DRIVER_DATA_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_DATA_WRAPPER_INDEX ]->getData()), |
|
122 | - self::DRIVER_TAGS_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_TAGS_WRAPPER_INDEX ]->getData()), |
|
123 | - self::DRIVER_EDATE_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_EDATE_WRAPPER_INDEX ]->toDateTime()->getTimestamp()), |
|
121 | + self::DRIVER_DATA_WRAPPER_INDEX => $this->decode($document[self::DRIVER_DATA_WRAPPER_INDEX]->getData()), |
|
122 | + self::DRIVER_TAGS_WRAPPER_INDEX => $this->decode($document[self::DRIVER_TAGS_WRAPPER_INDEX]->getData()), |
|
123 | + self::DRIVER_EDATE_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[self::DRIVER_EDATE_WRAPPER_INDEX]->toDateTime()->getTimestamp()), |
|
124 | 124 | ]; |
125 | 125 | } else { |
126 | 126 | return null; |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | * @var \MongoDB\Model\BSONDocument $result |
159 | 159 | */ |
160 | 160 | $result = $this->getCollection()->drop()->getArrayCopy(); |
161 | - $this->collection = new Collection($this->instance,'phpFastCache','Cache'); |
|
161 | + $this->collection = new Collection($this->instance, 'phpFastCache', 'Cache'); |
|
162 | 162 | |
163 | 163 | /** |
164 | 164 | * This will rebuild automatically the Collection indexes |
@@ -178,13 +178,13 @@ discard block |
||
178 | 178 | if ($this->instance instanceof \MongoDB\Driver\Manager) { |
179 | 179 | throw new LogicException('Already connected to Mongodb server'); |
180 | 180 | } else { |
181 | - $host = isset($this->config[ 'host' ]) ? $this->config[ 'host' ] : '127.0.0.1'; |
|
182 | - $port = isset($this->config[ 'port' ]) ? $this->config[ 'port' ] : '27017'; |
|
183 | - $timeout = isset($this->config[ 'timeout' ]) ? $this->config[ 'timeout' ] : 3; |
|
184 | - $password = isset($this->config[ 'password' ]) ? $this->config[ 'password' ] : ''; |
|
185 | - $username = isset($this->config[ 'username' ]) ? $this->config[ 'username' ] : ''; |
|
186 | - $collectionName = isset($this->config[ 'collectionName' ]) ? $this->config[ 'collectionName' ] : 'Cache'; |
|
187 | - $databaseName = isset($this->config[ 'databaseName' ]) ? $this->config[ 'databaseName' ] : 'phpFastCache'; |
|
181 | + $host = isset($this->config['host']) ? $this->config['host'] : '127.0.0.1'; |
|
182 | + $port = isset($this->config['port']) ? $this->config['port'] : '27017'; |
|
183 | + $timeout = isset($this->config['timeout']) ? $this->config['timeout'] : 3; |
|
184 | + $password = isset($this->config['password']) ? $this->config['password'] : ''; |
|
185 | + $username = isset($this->config['username']) ? $this->config['username'] : ''; |
|
186 | + $collectionName = isset($this->config['collectionName']) ? $this->config['collectionName'] : 'Cache'; |
|
187 | + $databaseName = isset($this->config['databaseName']) ? $this->config['databaseName'] : 'phpFastCache'; |
|
188 | 188 | |
189 | 189 | |
190 | 190 | /** |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | ($password ? ":{$password}" : '') . |
196 | 196 | ($username ? '@' : '') . "{$host}" . |
197 | 197 | ($port != '27017' ? ":{$port}" : ''), ['connectTimeoutMS' => $timeout * 1000])); |
198 | - $this->collection = $this->collection ?: new Collection($this->instance,$databaseName, $collectionName); |
|
198 | + $this->collection = $this->collection ?: new Collection($this->instance, $databaseName, $collectionName); |
|
199 | 199 | |
200 | 200 | return true; |
201 | 201 | } |
@@ -229,16 +229,16 @@ discard block |
||
229 | 229 | ]))->toArray()[0]; |
230 | 230 | |
231 | 231 | $collectionStats = $this->instance->executeCommand('phpFastCache', new Command([ |
232 | - 'collStats' => (isset($this->config[ 'collectionName' ]) ? $this->config[ 'collectionName' ] : 'Cache'), |
|
232 | + 'collStats' => (isset($this->config['collectionName']) ? $this->config['collectionName'] : 'Cache'), |
|
233 | 233 | 'verbose' => true, |
234 | 234 | ]))->toArray()[0]; |
235 | 235 | |
236 | - $array_filter_recursive = function( $array, callable $callback = null ) use(&$array_filter_recursive) { |
|
236 | + $array_filter_recursive = function($array, callable $callback = null) use(&$array_filter_recursive) { |
|
237 | 237 | $array = $callback($array); |
238 | 238 | |
239 | - if(is_object($array) ||is_array($array)){ |
|
240 | - foreach ( $array as &$value ) { |
|
241 | - $value = call_user_func( $array_filter_recursive, $value, $callback ); |
|
239 | + if (is_object($array) || is_array($array)) { |
|
240 | + foreach ($array as &$value) { |
|
241 | + $value = call_user_func($array_filter_recursive, $value, $callback); |
|
242 | 242 | } |
243 | 243 | } |
244 | 244 | |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | /** |
251 | 251 | * Remove unserializable properties |
252 | 252 | */ |
253 | - if($item instanceof \MongoDB\BSON\UTCDateTime){ |
|
253 | + if ($item instanceof \MongoDB\BSON\UTCDateTime) { |
|
254 | 254 | return (string) $item; |
255 | 255 | } |
256 | 256 | return $item; |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
55 | - * @return int|bool Return size in octet or false if no information available |
|
55 | + * @return string Return size in octet or false if no information available |
|
56 | 56 | */ |
57 | 57 | public function getSize() |
58 | 58 | { |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
63 | - * @return mixed |
|
63 | + * @return string |
|
64 | 64 | */ |
65 | 65 | public function getData() |
66 | 66 | { |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | } |
69 | 69 | |
70 | 70 | /** |
71 | - * @param $info |
|
71 | + * @param string $info |
|
72 | 72 | * @return $this |
73 | 73 | */ |
74 | 74 | public function setInfo($info) |
@@ -133,9 +133,9 @@ |
||
133 | 133 | $date = (new \DateTime())->setTimestamp(time() - $info[ 'total_cache_uptime' ]); |
134 | 134 | |
135 | 135 | return (new DriverStatistic()) |
136 | - ->setInfo(sprintf("The Wincache daemon is up since %s.\n For more information see RawData.", $date->format(DATE_RFC2822))) |
|
137 | - ->setSize($memInfo[ 'memory_free' ] - $memInfo[ 'memory_total' ]) |
|
138 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
139 | - ->setRawData($memInfo); |
|
136 | + ->setInfo(sprintf("The Wincache daemon is up since %s.\n For more information see RawData.", $date->format(DATE_RFC2822))) |
|
137 | + ->setSize($memInfo[ 'memory_free' ] - $memInfo[ 'memory_total' ]) |
|
138 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
139 | + ->setRawData($memInfo); |
|
140 | 140 | } |
141 | 141 | } |
142 | 142 | \ No newline at end of file |
@@ -130,11 +130,11 @@ |
||
130 | 130 | { |
131 | 131 | $memInfo = wincache_ucache_meminfo(); |
132 | 132 | $info = wincache_ucache_info(); |
133 | - $date = (new \DateTime())->setTimestamp(time() - $info[ 'total_cache_uptime' ]); |
|
133 | + $date = (new \DateTime())->setTimestamp(time() - $info['total_cache_uptime']); |
|
134 | 134 | |
135 | 135 | return (new DriverStatistic()) |
136 | 136 | ->setInfo(sprintf("The Wincache daemon is up since %s.\n For more information see RawData.", $date->format(DATE_RFC2822))) |
137 | - ->setSize($memInfo[ 'memory_free' ] - $memInfo[ 'memory_total' ]) |
|
137 | + ->setSize($memInfo['memory_free'] - $memInfo['memory_total']) |
|
138 | 138 | ->setData(implode(', ', array_keys($this->itemInstances))) |
139 | 139 | ->setRawData($memInfo); |
140 | 140 | } |
@@ -147,8 +147,8 @@ |
||
147 | 147 | $stats = (array) zend_shm_cache_info(); |
148 | 148 | return (new DriverStatistic()) |
149 | 149 | ->setData(implode(', ', array_keys($this->namespaces))) |
150 | - ->setInfo(sprintf("The Zend memory have %d item(s) in cache.\n For more information see RawData.",$stats[ 'items_total' ])) |
|
150 | + ->setInfo(sprintf("The Zend memory have %d item(s) in cache.\n For more information see RawData.", $stats['items_total'])) |
|
151 | 151 | ->setRawData($stats) |
152 | - ->setSize($stats[ 'memory_total' ]); |
|
152 | + ->setSize($stats['memory_total']); |
|
153 | 153 | } |
154 | 154 | } |
155 | 155 | \ No newline at end of file |
@@ -137,10 +137,10 @@ |
||
137 | 137 | $date = (new \DateTime())->setTimestamp($stats[ 'start_time' ]); |
138 | 138 | |
139 | 139 | return (new DriverStatistic()) |
140 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
141 | - ->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), |
|
140 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
141 | + ->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), |
|
142 | 142 | $stats[ 'num_entries' ])) |
143 | - ->setRawData($stats) |
|
144 | - ->setSize($stats[ 'mem_size' ]); |
|
143 | + ->setRawData($stats) |
|
144 | + ->setSize($stats[ 'mem_size' ]); |
|
145 | 145 | } |
146 | 146 | } |
147 | 147 | \ No newline at end of file |
@@ -134,13 +134,13 @@ |
||
134 | 134 | public function getStats() |
135 | 135 | { |
136 | 136 | $stats = (array) apc_cache_info('user'); |
137 | - $date = (new \DateTime())->setTimestamp($stats[ 'start_time' ]); |
|
137 | + $date = (new \DateTime())->setTimestamp($stats['start_time']); |
|
138 | 138 | |
139 | 139 | return (new DriverStatistic()) |
140 | 140 | ->setData(implode(', ', array_keys($this->itemInstances))) |
141 | 141 | ->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), |
142 | - $stats[ 'num_entries' ])) |
|
142 | + $stats['num_entries'])) |
|
143 | 143 | ->setRawData($stats) |
144 | - ->setSize($stats[ 'mem_size' ]); |
|
144 | + ->setSize($stats['mem_size']); |
|
145 | 145 | } |
146 | 146 | } |
147 | 147 | \ No newline at end of file |
@@ -137,10 +137,10 @@ |
||
137 | 137 | $info = xcache_info(XC_TYPE_VAR, 0); |
138 | 138 | |
139 | 139 | return (new DriverStatistic()) |
140 | - ->setSize(abs($info[ 'size' ] - $info[ 'avail' ])) |
|
141 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
142 | - ->setInfo(sprintf("Xcache v%s with following modules loaded:\n %s", XCACHE_VERSION, str_replace(' ', ', ', XCACHE_MODULES))) |
|
143 | - ->setRawData($info); |
|
140 | + ->setSize(abs($info[ 'size' ] - $info[ 'avail' ])) |
|
141 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
142 | + ->setInfo(sprintf("Xcache v%s with following modules loaded:\n %s", XCACHE_VERSION, str_replace(' ', ', ', XCACHE_MODULES))) |
|
143 | + ->setRawData($info); |
|
144 | 144 | } else { |
145 | 145 | throw new \RuntimeException("PhpFastCache is not able to read Xcache configuration. Please put this to your php.ini:\n |
146 | 146 | [xcache.admin] |
@@ -137,7 +137,7 @@ |
||
137 | 137 | $info = xcache_info(XC_TYPE_VAR, 0); |
138 | 138 | |
139 | 139 | return (new DriverStatistic()) |
140 | - ->setSize(abs($info[ 'size' ] - $info[ 'avail' ])) |
|
140 | + ->setSize(abs($info['size'] - $info['avail'])) |
|
141 | 141 | ->setData(implode(', ', array_keys($this->itemInstances))) |
142 | 142 | ->setInfo(sprintf("Xcache v%s with following modules loaded:\n %s", XCACHE_VERSION, str_replace(' ', ', ', XCACHE_MODULES))) |
143 | 143 | ->setRawData($info); |