@@ -17,9 +17,9 @@ |
||
| 17 | 17 | /** |
| 18 | 18 | * Register Autoload |
| 19 | 19 | */ |
| 20 | -spl_autoload_register(function ($entity) { |
|
| 20 | +spl_autoload_register(function($entity) { |
|
| 21 | 21 | $module = explode('\\', $entity, 2); |
| 22 | - if (!in_array($module[ 0 ], ['phpFastCache', 'Psr'])) { |
|
| 22 | + if (!in_array($module[0], ['phpFastCache', 'Psr'])) { |
|
| 23 | 23 | /** |
| 24 | 24 | * Not a part of phpFastCache file |
| 25 | 25 | * then we return here. |
@@ -162,12 +162,12 @@ discard block |
||
| 162 | 162 | $stm = $this->indexing->prepare("SELECT MAX(`db`) as `db` FROM `balancing`"); |
| 163 | 163 | $stm->execute(); |
| 164 | 164 | $row = $stm->fetch(PDO::FETCH_ASSOC); |
| 165 | - if (!isset($row[ 'db' ])) { |
|
| 165 | + if (!isset($row['db'])) { |
|
| 166 | 166 | $db = 1; |
| 167 | - } elseif ($row[ 'db' ] <= 1) { |
|
| 167 | + } elseif ($row['db'] <= 1) { |
|
| 168 | 168 | $db = 1; |
| 169 | 169 | } else { |
| 170 | - $db = $row[ 'db' ]; |
|
| 170 | + $db = $row['db']; |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | // check file size |
@@ -189,8 +189,8 @@ discard block |
||
| 189 | 189 | ':keyword' => $keyword, |
| 190 | 190 | ]); |
| 191 | 191 | $row = $stm->fetch(PDO::FETCH_ASSOC); |
| 192 | - if (isset($row[ 'db' ]) && $row[ 'db' ] != '') { |
|
| 193 | - $db = $row[ 'db' ]; |
|
| 192 | + if (isset($row['db']) && $row['db'] != '') { |
|
| 193 | + $db = $row['db']; |
|
| 194 | 194 | } else { |
| 195 | 195 | /* |
| 196 | 196 | * Insert new to Indexing |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | /** |
| 222 | 222 | * init instant |
| 223 | 223 | */ |
| 224 | - if (!isset($this->instance[ $instant ])) { |
|
| 224 | + if (!isset($this->instance[$instant])) { |
|
| 225 | 225 | // check DB Files ready or not |
| 226 | 226 | $createTable = false; |
| 227 | 227 | if (!file_exists($this->SqliteDir . '/db' . $instant) || $reset == true) { |
@@ -234,12 +234,12 @@ discard block |
||
| 234 | 234 | $this->initDB($PDO); |
| 235 | 235 | } |
| 236 | 236 | |
| 237 | - $this->instance[ $instant ] = $PDO; |
|
| 237 | + $this->instance[$instant] = $PDO; |
|
| 238 | 238 | unset($PDO); |
| 239 | 239 | |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | - return $this->instance[ $instant ]; |
|
| 242 | + return $this->instance[$instant]; |
|
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | /** |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | * Check for Cross-Driver type confusion |
| 254 | 254 | */ |
| 255 | 255 | if ($item instanceof Item) { |
| 256 | - $skipExisting = isset($this->config[ 'skipExisting' ]) ? $this->config[ 'skipExisting' ] : false; |
|
| 256 | + $skipExisting = isset($this->config['skipExisting']) ? $this->config['skipExisting'] : false; |
|
| 257 | 257 | $toWrite = true; |
| 258 | 258 | |
| 259 | 259 | // check in cache first |
@@ -329,8 +329,8 @@ discard block |
||
| 329 | 329 | } |
| 330 | 330 | } |
| 331 | 331 | |
| 332 | - if (isset($row[ 'object' ])) { |
|
| 333 | - return $this->decode($row[ 'object' ]); |
|
| 332 | + if (isset($row['object'])) { |
|
| 333 | + return $this->decode($row['object']); |
|
| 334 | 334 | } |
| 335 | 335 | |
| 336 | 336 | return null; |
@@ -110,7 +110,7 @@ |
||
| 110 | 110 | public function getMultiple($keys, $default = null) |
| 111 | 111 | { |
| 112 | 112 | try { |
| 113 | - return array_map(function (ExtendedCacheItemInterface $item) { |
|
| 113 | + return array_map(function(ExtendedCacheItemInterface $item) { |
|
| 114 | 114 | return $item->get(); |
| 115 | 115 | }, $this->internalCacheInstance->getItems($keys)); |
| 116 | 116 | } catch (phpFastCacheInvalidArgumentException $e) { |
@@ -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 | } |
@@ -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); |
@@ -133,14 +133,14 @@ |
||
| 133 | 133 | */ |
| 134 | 134 | public function getStats() |
| 135 | 135 | { |
| 136 | - $stats = (array)apcu_cache_info(); |
|
| 137 | - $date = (new \DateTime())->setTimestamp($stats[ 'start_time' ]); |
|
| 136 | + $stats = (array) apcu_cache_info(); |
|
| 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 APCU 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 |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | $results = $this->instance->execute(new Cassandra\SimpleStatement($query), $options); |
| 134 | 134 | |
| 135 | 135 | if ($results instanceof Cassandra\Rows && $results->count() === 1) { |
| 136 | - return $this->decode($results->first()[ 'cache_data' ]); |
|
| 136 | + return $this->decode($results->first()['cache_data']); |
|
| 137 | 137 | } else { |
| 138 | 138 | return null; |
| 139 | 139 | } |
@@ -206,18 +206,18 @@ discard block |
||
| 206 | 206 | if ($this->instance instanceof CassandraSession) { |
| 207 | 207 | throw new phpFastCacheLogicException('Already connected to Couchbase server'); |
| 208 | 208 | } else { |
| 209 | - $host = isset($this->config[ 'host' ]) ? $this->config[ 'host' ] : '127.0.0.1'; |
|
| 210 | - $port = isset($this->config[ 'port' ]) ? $this->config[ 'port' ] : 9042; |
|
| 211 | - $timeout = isset($this->config[ 'timeout' ]) ? $this->config[ 'timeout' ] : 2; |
|
| 212 | - $password = isset($this->config[ 'password' ]) ? $this->config[ 'password' ] : ''; |
|
| 213 | - $username = isset($this->config[ 'username' ]) ? $this->config[ 'username' ] : ''; |
|
| 209 | + $host = isset($this->config['host']) ? $this->config['host'] : '127.0.0.1'; |
|
| 210 | + $port = isset($this->config['port']) ? $this->config['port'] : 9042; |
|
| 211 | + $timeout = isset($this->config['timeout']) ? $this->config['timeout'] : 2; |
|
| 212 | + $password = isset($this->config['password']) ? $this->config['password'] : ''; |
|
| 213 | + $username = isset($this->config['username']) ? $this->config['username'] : ''; |
|
| 214 | 214 | |
| 215 | 215 | $clusterBuilder = Cassandra::cluster() |
| 216 | 216 | ->withContactPoints($host) |
| 217 | 217 | ->withPort($port); |
| 218 | 218 | |
| 219 | - if (!empty($this->config[ 'ssl' ][ 'enabled' ])) { |
|
| 220 | - if (!empty($this->config[ 'ssl' ][ 'verify' ])) { |
|
| 219 | + if (!empty($this->config['ssl']['enabled'])) { |
|
| 220 | + if (!empty($this->config['ssl']['verify'])) { |
|
| 221 | 221 | $sslBuilder = Cassandra::ssl()->withVerifyFlags(Cassandra::VERIFY_PEER_CERT); |
| 222 | 222 | } else { |
| 223 | 223 | $sslBuilder = Cassandra::ssl()->withVerifyFlags(Cassandra::VERIFY_NONE); |
@@ -296,7 +296,7 @@ discard block |
||
| 296 | 296 | ))); |
| 297 | 297 | |
| 298 | 298 | return (new DriverStatistic()) |
| 299 | - ->setSize($result->first()[ 'cache_size' ]) |
|
| 299 | + ->setSize($result->first()['cache_size']) |
|
| 300 | 300 | ->setRawData([]) |
| 301 | 301 | ->setData(implode(', ', array_keys($this->itemInstances))) |
| 302 | 302 | ->setInfo('The cache size represents only the cache data itself without counting data structures associated to the cache entries.'); |
@@ -125,17 +125,17 @@ discard block |
||
| 125 | 125 | protected function driverConnect() |
| 126 | 126 | { |
| 127 | 127 | try { |
| 128 | - $server = isset($this->config[ 'ssdb' ]) ? $this->config[ 'ssdb' ] : [ |
|
| 128 | + $server = isset($this->config['ssdb']) ? $this->config['ssdb'] : [ |
|
| 129 | 129 | 'host' => "127.0.0.1", |
| 130 | 130 | 'port' => 8888, |
| 131 | 131 | 'password' => '', |
| 132 | 132 | 'timeout' => 2000, |
| 133 | 133 | ]; |
| 134 | 134 | |
| 135 | - $host = $server[ 'host' ]; |
|
| 136 | - $port = isset($server[ 'port' ]) ? (int)$server[ 'port' ] : 8888; |
|
| 137 | - $password = isset($server[ 'password' ]) ? $server[ 'password' ] : ''; |
|
| 138 | - $timeout = !empty($server[ 'timeout' ]) ? (int)$server[ 'timeout' ] : 2000; |
|
| 135 | + $host = $server['host']; |
|
| 136 | + $port = isset($server['port']) ? (int) $server['port'] : 8888; |
|
| 137 | + $password = isset($server['password']) ? $server['password'] : ''; |
|
| 138 | + $timeout = !empty($server['timeout']) ? (int) $server['timeout'] : 2000; |
|
| 139 | 139 | $this->instance = new SimpleSSDB($host, $port, $timeout); |
| 140 | 140 | if (!empty($password)) { |
| 141 | 141 | $this->instance->auth($password); |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | * Data returned by Ssdb are very poorly formatted |
| 170 | 170 | * using hardcoded offset of pair key-value :-( |
| 171 | 171 | */ |
| 172 | - $stat->setInfo(sprintf("Ssdb-server v%s with a total of %s call(s).\n For more information see RawData.", $info[ 2 ], $info[ 6 ])) |
|
| 172 | + $stat->setInfo(sprintf("Ssdb-server v%s with a total of %s call(s).\n For more information see RawData.", $info[2], $info[6])) |
|
| 173 | 173 | ->setRawData($info) |
| 174 | 174 | ->setData(implode(', ', array_keys($this->itemInstances))) |
| 175 | 175 | ->setSize($this->instance->dbsize()); |
@@ -145,11 +145,11 @@ |
||
| 145 | 145 | */ |
| 146 | 146 | public function getStats() |
| 147 | 147 | { |
| 148 | - $stats = (array)zend_shm_cache_info(); |
|
| 148 | + $stats = (array) zend_shm_cache_info(); |
|
| 149 | 149 | return (new DriverStatistic()) |
| 150 | 150 | ->setData(implode(', ', array_keys($this->itemInstances))) |
| 151 | - ->setInfo(sprintf("The Zend memory have %d item(s) in cache.\n For more information see RawData.", $stats[ 'items_total' ])) |
|
| 151 | + ->setInfo(sprintf("The Zend memory have %d item(s) in cache.\n For more information see RawData.", $stats['items_total'])) |
|
| 152 | 152 | ->setRawData($stats) |
| 153 | - ->setSize($stats[ 'memory_total' ]); |
|
| 153 | + ->setSize($stats['memory_total']); |
|
| 154 | 154 | } |
| 155 | 155 | } |
| 156 | 156 | \ No newline at end of file |