@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | use Phpfastcache\Core\Pool\{DriverBaseTrait, ExtendedCacheItemPoolInterface}; |
19 | 19 | use Phpfastcache\Entities\DriverStatistic; |
20 | 20 | use Phpfastcache\Exceptions\{ |
21 | - PhpfastcacheInvalidArgumentException |
|
21 | + PhpfastcacheInvalidArgumentException |
|
22 | 22 | }; |
23 | 23 | use Psr\Cache\CacheItemInterface; |
24 | 24 | |
@@ -133,10 +133,10 @@ discard block |
||
133 | 133 | $date = (new \DateTime())->setTimestamp($stats[ 'start_time' ]); |
134 | 134 | |
135 | 135 | return (new DriverStatistic()) |
136 | - ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
137 | - ->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), |
|
136 | + ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
137 | + ->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), |
|
138 | 138 | $stats[ 'num_entries' ])) |
139 | - ->setRawData($stats) |
|
140 | - ->setSize($stats[ 'mem_size' ]); |
|
139 | + ->setRawData($stats) |
|
140 | + ->setSize($stats[ 'mem_size' ]); |
|
141 | 141 | } |
142 | 142 | } |
143 | 143 | \ No newline at end of file |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * @author Georges.L (Geolim4) <[email protected]> |
12 | 12 | * |
13 | 13 | */ |
14 | -declare(strict_types=1); |
|
14 | +declare(strict_types = 1); |
|
15 | 15 | |
16 | 16 | namespace Phpfastcache\Drivers\Apc; |
17 | 17 | |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | if ($item instanceof Item) { |
88 | 88 | $ttl = $item->getExpirationDate()->getTimestamp() - time(); |
89 | 89 | |
90 | - return (bool)apc_store($item->getKey(), $this->driverPreWrap($item), ($ttl > 0 ? $ttl : 0)); |
|
90 | + return (bool) apc_store($item->getKey(), $this->driverPreWrap($item), ($ttl > 0 ? $ttl : 0)); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | throw new PhpfastcacheInvalidArgumentException('Cross-Driver type confusion detected'); |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | * Check for Cross-Driver type confusion |
105 | 105 | */ |
106 | 106 | if ($item instanceof Item) { |
107 | - return (bool)apc_delete($item->getKey()); |
|
107 | + return (bool) apc_delete($item->getKey()); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | throw new PhpfastcacheInvalidArgumentException('Cross-Driver type confusion detected'); |
@@ -129,14 +129,14 @@ discard block |
||
129 | 129 | */ |
130 | 130 | public function getStats(): DriverStatistic |
131 | 131 | { |
132 | - $stats = (array)apc_cache_info('user'); |
|
133 | - $date = (new \DateTime())->setTimestamp($stats[ 'start_time' ]); |
|
132 | + $stats = (array) apc_cache_info('user'); |
|
133 | + $date = (new \DateTime())->setTimestamp($stats['start_time']); |
|
134 | 134 | |
135 | 135 | return (new DriverStatistic()) |
136 | 136 | ->setData(\implode(', ', \array_keys($this->itemInstances))) |
137 | 137 | ->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), |
138 | - $stats[ 'num_entries' ])) |
|
138 | + $stats['num_entries'])) |
|
139 | 139 | ->setRawData($stats) |
140 | - ->setSize($stats[ 'mem_size' ]); |
|
140 | + ->setSize($stats['mem_size']); |
|
141 | 141 | } |
142 | 142 | } |
143 | 143 | \ No newline at end of file |
@@ -19,7 +19,7 @@ |
||
19 | 19 | use Phpfastcache\Core\Pool\ExtendedCacheItemPoolInterface; |
20 | 20 | use Phpfastcache\Drivers\Apc\Driver as ApcDriver; |
21 | 21 | use Phpfastcache\Exceptions\{ |
22 | - PhpfastcacheInvalidArgumentException, PhpfastcacheInvalidArgumentTypeException |
|
22 | + PhpfastcacheInvalidArgumentException, PhpfastcacheInvalidArgumentTypeException |
|
23 | 23 | }; |
24 | 24 | |
25 | 25 | /** |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | use Phpfastcache\Core\Pool\{DriverBaseTrait, ExtendedCacheItemPoolInterface}; |
19 | 19 | use Phpfastcache\Entities\DriverStatistic; |
20 | 20 | use Phpfastcache\Exceptions\{ |
21 | - PhpfastcacheInvalidArgumentException |
|
21 | + PhpfastcacheInvalidArgumentException |
|
22 | 22 | }; |
23 | 23 | use Psr\Cache\CacheItemInterface; |
24 | 24 | |
@@ -112,9 +112,9 @@ discard block |
||
112 | 112 | { |
113 | 113 | $stat = new DriverStatistic(); |
114 | 114 | $stat->setInfo('[Devnull] A void info string') |
115 | - ->setSize(0) |
|
116 | - ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
117 | - ->setRawData(null); |
|
115 | + ->setSize(0) |
|
116 | + ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
117 | + ->setRawData(null); |
|
118 | 118 | |
119 | 119 | return $stat; |
120 | 120 | } |
@@ -19,7 +19,7 @@ |
||
19 | 19 | use Phpfastcache\Core\Pool\ExtendedCacheItemPoolInterface; |
20 | 20 | use Phpfastcache\Drivers\Devnull\Driver as DevnullDriver; |
21 | 21 | use Phpfastcache\Exceptions\{ |
22 | - PhpfastcacheInvalidArgumentException, PhpfastcacheInvalidArgumentTypeException |
|
22 | + PhpfastcacheInvalidArgumentException, PhpfastcacheInvalidArgumentTypeException |
|
23 | 23 | }; |
24 | 24 | |
25 | 25 | /** |
@@ -18,7 +18,7 @@ |
||
18 | 18 | use Phpfastcache\Core\Pool\{DriverBaseTrait, ExtendedCacheItemPoolInterface}; |
19 | 19 | use Phpfastcache\Entities\DriverStatistic; |
20 | 20 | use Phpfastcache\Exceptions\{ |
21 | - PhpfastcacheInvalidArgumentException, PhpfastcacheDriverException |
|
21 | + PhpfastcacheInvalidArgumentException, PhpfastcacheDriverException |
|
22 | 22 | }; |
23 | 23 | use Psr\Cache\CacheItemInterface; |
24 | 24 |
@@ -19,7 +19,7 @@ |
||
19 | 19 | use Phpfastcache\Core\Pool\ExtendedCacheItemPoolInterface; |
20 | 20 | use Phpfastcache\Drivers\Cookie\Driver as CookieDriver; |
21 | 21 | use Phpfastcache\Exceptions\{ |
22 | - PhpfastcacheInvalidArgumentException |
|
22 | + PhpfastcacheInvalidArgumentException |
|
23 | 23 | }; |
24 | 24 | |
25 | 25 | /** |
@@ -18,14 +18,14 @@ discard block |
||
18 | 18 | |
19 | 19 | use LogicException; |
20 | 20 | use MongoDB\{ |
21 | - BSON\Binary, BSON\UTCDateTime, Collection, DeleteResult, Driver\Command, Driver\Exception\Exception as MongoDBException, Driver\Manager as MongodbManager |
|
21 | + BSON\Binary, BSON\UTCDateTime, Collection, DeleteResult, Driver\Command, Driver\Exception\Exception as MongoDBException, Driver\Manager as MongodbManager |
|
22 | 22 | }; |
23 | 23 | use Phpfastcache\Core\Pool\{ |
24 | - DriverBaseTrait, ExtendedCacheItemPoolInterface |
|
24 | + DriverBaseTrait, ExtendedCacheItemPoolInterface |
|
25 | 25 | }; |
26 | 26 | use Phpfastcache\Entities\DriverStatistic; |
27 | 27 | use Phpfastcache\Exceptions\{ |
28 | - PhpfastcacheDriverException, PhpfastcacheInvalidArgumentException |
|
28 | + PhpfastcacheDriverException, PhpfastcacheInvalidArgumentException |
|
29 | 29 | }; |
30 | 30 | use Phpfastcache\Util\ArrayObject; |
31 | 31 | use Psr\Cache\CacheItemInterface; |
@@ -71,16 +71,16 @@ discard block |
||
71 | 71 | |
72 | 72 | if ($document) { |
73 | 73 | $return = [ |
74 | - self::DRIVER_DATA_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_DATA_WRAPPER_INDEX ]->getData()), |
|
75 | - self::DRIVER_TAGS_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_TAGS_WRAPPER_INDEX ]->getData()), |
|
76 | - self::DRIVER_EDATE_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_EDATE_WRAPPER_INDEX ]->toDateTime()->getTimestamp()), |
|
74 | + self::DRIVER_DATA_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_DATA_WRAPPER_INDEX ]->getData()), |
|
75 | + self::DRIVER_TAGS_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_TAGS_WRAPPER_INDEX ]->getData()), |
|
76 | + self::DRIVER_EDATE_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_EDATE_WRAPPER_INDEX ]->toDateTime()->getTimestamp()), |
|
77 | 77 | ]; |
78 | 78 | |
79 | 79 | if(!empty($this->getConfigOption('itemDetailedDate'))){ |
80 | 80 | $return += [ |
81 | - self::DRIVER_MDATE_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_MDATE_WRAPPER_INDEX ]->toDateTime() |
|
81 | + self::DRIVER_MDATE_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_MDATE_WRAPPER_INDEX ]->toDateTime() |
|
82 | 82 | ->getTimestamp()), |
83 | - self::DRIVER_CDATE_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_CDATE_WRAPPER_INDEX ]->toDateTime() |
|
83 | + self::DRIVER_CDATE_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_CDATE_WRAPPER_INDEX ]->toDateTime() |
|
84 | 84 | ->getTimestamp()), |
85 | 85 | ]; |
86 | 86 | } |
@@ -105,23 +105,23 @@ discard block |
||
105 | 105 | if ($item instanceof Item) { |
106 | 106 | try { |
107 | 107 | $set = [ |
108 | - self::DRIVER_DATA_WRAPPER_INDEX => new Binary($this->encode($item->get()), Binary::TYPE_GENERIC), |
|
109 | - self::DRIVER_TAGS_WRAPPER_INDEX => new Binary($this->encode($item->getTags()), Binary::TYPE_GENERIC), |
|
110 | - self::DRIVER_EDATE_WRAPPER_INDEX => ($item->getTtl() > 0 ? new UTCDateTime((time() + $item->getTtl()) * 1000) : new UTCDateTime(time() * 1000)), |
|
108 | + self::DRIVER_DATA_WRAPPER_INDEX => new Binary($this->encode($item->get()), Binary::TYPE_GENERIC), |
|
109 | + self::DRIVER_TAGS_WRAPPER_INDEX => new Binary($this->encode($item->getTags()), Binary::TYPE_GENERIC), |
|
110 | + self::DRIVER_EDATE_WRAPPER_INDEX => ($item->getTtl() > 0 ? new UTCDateTime((time() + $item->getTtl()) * 1000) : new UTCDateTime(time() * 1000)), |
|
111 | 111 | ]; |
112 | 112 | |
113 | 113 | if(!empty($this->getConfigOption('itemDetailedDate'))){ |
114 | 114 | $set += [ |
115 | - self::DRIVER_MDATE_WRAPPER_INDEX => ($item->getModificationDate() ? new UTCDateTime(($item->getModificationDate()->getTimestamp()) * 1000) : new UTCDateTime(time() * 1000)), |
|
116 | - self::DRIVER_CDATE_WRAPPER_INDEX => ($item->getCreationDate() ? new UTCDateTime(($item->getCreationDate()->getTimestamp()) * 1000) : new UTCDateTime(time() * 1000)), |
|
115 | + self::DRIVER_MDATE_WRAPPER_INDEX => ($item->getModificationDate() ? new UTCDateTime(($item->getModificationDate()->getTimestamp()) * 1000) : new UTCDateTime(time() * 1000)), |
|
116 | + self::DRIVER_CDATE_WRAPPER_INDEX => ($item->getCreationDate() ? new UTCDateTime(($item->getCreationDate()->getTimestamp()) * 1000) : new UTCDateTime(time() * 1000)), |
|
117 | 117 | ]; |
118 | 118 | } |
119 | 119 | $result = (array)$this->getCollection()->updateOne( |
120 | - ['_id' => $item->getEncodedKey()], |
|
121 | - [ |
|
120 | + ['_id' => $item->getEncodedKey()], |
|
121 | + [ |
|
122 | 122 | '$set' => $set, |
123 | - ], |
|
124 | - ['upsert' => true, 'multiple' => false] |
|
123 | + ], |
|
124 | + ['upsert' => true, 'multiple' => false] |
|
125 | 125 | ); |
126 | 126 | } catch (MongoDBException $e) { |
127 | 127 | throw new PhpfastcacheDriverException('Got an exception while trying to write data to MongoDB server', null, $e); |
@@ -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 | - ($clientConfig[ 'username' ] ?: '') . |
|
195 | - ($clientConfig[ 'password' ] ? ":{$clientConfig['password']}" : '') . |
|
196 | - ($clientConfig[ 'username' ] ? '@' : '') . "{$clientConfig['host']}" . |
|
197 | - ($clientConfig[ 'port' ] != 27017 ? ":{$clientConfig['port']}" : ''), ['connectTimeoutMS' => $clientConfig[ 'timeout' ] * 1000])); |
|
194 | + ($clientConfig[ 'username' ] ?: '') . |
|
195 | + ($clientConfig[ 'password' ] ? ":{$clientConfig['password']}" : '') . |
|
196 | + ($clientConfig[ 'username' ] ? '@' : '') . "{$clientConfig['host']}" . |
|
197 | + ($clientConfig[ 'port' ] != 27017 ? ":{$clientConfig['port']}" : ''), ['connectTimeoutMS' => $clientConfig[ 'timeout' ] * 1000])); |
|
198 | 198 | $this->collection = $this->collection ?: new Collection($this->instance, $clientConfig[ 'databaseName' ], $clientConfig[ 'collectionName' ]); |
199 | 199 | |
200 | 200 | return true; |
@@ -221,15 +221,15 @@ discard block |
||
221 | 221 | public function getStats(): DriverStatistic |
222 | 222 | { |
223 | 223 | $serverStats = $this->instance->executeCommand($this->getConfigOption('databaseName'), new Command([ |
224 | - 'serverStatus' => 1, |
|
225 | - 'recordStats' => 0, |
|
226 | - 'repl' => 0, |
|
227 | - 'metrics' => 0, |
|
224 | + 'serverStatus' => 1, |
|
225 | + 'recordStats' => 0, |
|
226 | + 'repl' => 0, |
|
227 | + 'metrics' => 0, |
|
228 | 228 | ]))->toArray()[ 0 ]; |
229 | 229 | |
230 | 230 | $collectionStats = $this->instance->executeCommand($this->getConfigOption('databaseName'), new Command([ |
231 | - 'collStats' => ($this->config->getOption('collectionName') !== null ? $this->config->getOption('collectionName') : 'Cache'), |
|
232 | - 'verbose' => true, |
|
231 | + 'collStats' => ($this->config->getOption('collectionName') !== null ? $this->config->getOption('collectionName') : 'Cache'), |
|
232 | + 'verbose' => true, |
|
233 | 233 | ]))->toArray()[ 0 ]; |
234 | 234 | |
235 | 235 | $array_filter_recursive = function ($array, callable $callback = null) use (&$array_filter_recursive) { |
@@ -258,14 +258,14 @@ discard block |
||
258 | 258 | $collectionStats = $array_filter_recursive($collectionStats, $callback); |
259 | 259 | |
260 | 260 | $stats = (new DriverStatistic()) |
261 | - ->setInfo('MongoDB version ' . $serverStats->version . ', Uptime (in days): ' . round($serverStats->uptime / 86400, |
|
262 | - 1) . "\n For more information see RawData.") |
|
263 | - ->setSize($collectionStats->size) |
|
264 | - ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
265 | - ->setRawData([ |
|
261 | + ->setInfo('MongoDB version ' . $serverStats->version . ', Uptime (in days): ' . round($serverStats->uptime / 86400, |
|
262 | + 1) . "\n For more information see RawData.") |
|
263 | + ->setSize($collectionStats->size) |
|
264 | + ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
265 | + ->setRawData([ |
|
266 | 266 | 'serverStatus' => $serverStats, |
267 | 267 | 'collStats' => $collectionStats, |
268 | - ]); |
|
268 | + ]); |
|
269 | 269 | |
270 | 270 | return $stats; |
271 | 271 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | * @author Fabio Covolo Mazzo (fabiocmazzo) <[email protected]> |
13 | 13 | * |
14 | 14 | */ |
15 | -declare(strict_types=1); |
|
15 | +declare(strict_types = 1); |
|
16 | 16 | |
17 | 17 | namespace Phpfastcache\Drivers\Mongodb; |
18 | 18 | |
@@ -71,16 +71,16 @@ discard block |
||
71 | 71 | |
72 | 72 | if ($document) { |
73 | 73 | $return = [ |
74 | - self::DRIVER_DATA_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_DATA_WRAPPER_INDEX ]->getData()), |
|
75 | - self::DRIVER_TAGS_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_TAGS_WRAPPER_INDEX ]->getData()), |
|
76 | - self::DRIVER_EDATE_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_EDATE_WRAPPER_INDEX ]->toDateTime()->getTimestamp()), |
|
74 | + self::DRIVER_DATA_WRAPPER_INDEX => $this->decode($document[self::DRIVER_DATA_WRAPPER_INDEX]->getData()), |
|
75 | + self::DRIVER_TAGS_WRAPPER_INDEX => $this->decode($document[self::DRIVER_TAGS_WRAPPER_INDEX]->getData()), |
|
76 | + self::DRIVER_EDATE_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[self::DRIVER_EDATE_WRAPPER_INDEX]->toDateTime()->getTimestamp()), |
|
77 | 77 | ]; |
78 | 78 | |
79 | - if(!empty($this->getConfigOption('itemDetailedDate'))){ |
|
79 | + if (!empty($this->getConfigOption('itemDetailedDate'))) { |
|
80 | 80 | $return += [ |
81 | - self::DRIVER_MDATE_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_MDATE_WRAPPER_INDEX ]->toDateTime() |
|
81 | + self::DRIVER_MDATE_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[self::DRIVER_MDATE_WRAPPER_INDEX]->toDateTime() |
|
82 | 82 | ->getTimestamp()), |
83 | - self::DRIVER_CDATE_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_CDATE_WRAPPER_INDEX ]->toDateTime() |
|
83 | + self::DRIVER_CDATE_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[self::DRIVER_CDATE_WRAPPER_INDEX]->toDateTime() |
|
84 | 84 | ->getTimestamp()), |
85 | 85 | ]; |
86 | 86 | } |
@@ -110,13 +110,13 @@ discard block |
||
110 | 110 | self::DRIVER_EDATE_WRAPPER_INDEX => ($item->getTtl() > 0 ? new UTCDateTime((time() + $item->getTtl()) * 1000) : new UTCDateTime(time() * 1000)), |
111 | 111 | ]; |
112 | 112 | |
113 | - if(!empty($this->getConfigOption('itemDetailedDate'))){ |
|
113 | + if (!empty($this->getConfigOption('itemDetailedDate'))) { |
|
114 | 114 | $set += [ |
115 | 115 | self::DRIVER_MDATE_WRAPPER_INDEX => ($item->getModificationDate() ? new UTCDateTime(($item->getModificationDate()->getTimestamp()) * 1000) : new UTCDateTime(time() * 1000)), |
116 | 116 | self::DRIVER_CDATE_WRAPPER_INDEX => ($item->getCreationDate() ? new UTCDateTime(($item->getCreationDate()->getTimestamp()) * 1000) : new UTCDateTime(time() * 1000)), |
117 | 117 | ]; |
118 | 118 | } |
119 | - $result = (array)$this->getCollection()->updateOne( |
|
119 | + $result = (array) $this->getCollection()->updateOne( |
|
120 | 120 | ['_id' => $item->getEncodedKey()], |
121 | 121 | [ |
122 | 122 | '$set' => $set, |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | throw new PhpfastcacheDriverException('Got an exception while trying to write data to MongoDB server', null, $e); |
128 | 128 | } |
129 | 129 | |
130 | - return isset($result[ 'ok' ]) ? $result[ 'ok' ] == 1 : true; |
|
130 | + return isset($result['ok']) ? $result['ok'] == 1 : true; |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | throw new PhpfastcacheInvalidArgumentException('Cross-Driver type confusion detected'); |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | */ |
172 | 172 | $this->save($this->getItem('__PFC_CACHE_CLEARED__')->set(true)); |
173 | 173 | |
174 | - return !empty($result[ 'ok' ]); |
|
174 | + return !empty($result['ok']); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | /** |
@@ -191,11 +191,11 @@ discard block |
||
191 | 191 | * @todo make an url builder |
192 | 192 | */ |
193 | 193 | $this->instance = $this->instance ?: (new MongodbManager('mongodb://' . |
194 | - ($clientConfig[ 'username' ] ?: '') . |
|
195 | - ($clientConfig[ 'password' ] ? ":{$clientConfig['password']}" : '') . |
|
196 | - ($clientConfig[ 'username' ] ? '@' : '') . "{$clientConfig['host']}" . |
|
197 | - ($clientConfig[ 'port' ] != 27017 ? ":{$clientConfig['port']}" : ''), ['connectTimeoutMS' => $clientConfig[ 'timeout' ] * 1000])); |
|
198 | - $this->collection = $this->collection ?: new Collection($this->instance, $clientConfig[ 'databaseName' ], $clientConfig[ 'collectionName' ]); |
|
194 | + ($clientConfig['username'] ?: '') . |
|
195 | + ($clientConfig['password'] ? ":{$clientConfig['password']}" : '') . |
|
196 | + ($clientConfig['username'] ? '@' : '') . "{$clientConfig['host']}" . |
|
197 | + ($clientConfig['port'] != 27017 ? ":{$clientConfig['port']}" : ''), ['connectTimeoutMS' => $clientConfig['timeout'] * 1000])); |
|
198 | + $this->collection = $this->collection ?: new Collection($this->instance, $clientConfig['databaseName'], $clientConfig['collectionName']); |
|
199 | 199 | |
200 | 200 | return true; |
201 | 201 | } |
@@ -225,14 +225,14 @@ discard block |
||
225 | 225 | 'recordStats' => 0, |
226 | 226 | 'repl' => 0, |
227 | 227 | 'metrics' => 0, |
228 | - ]))->toArray()[ 0 ]; |
|
228 | + ]))->toArray()[0]; |
|
229 | 229 | |
230 | 230 | $collectionStats = $this->instance->executeCommand($this->getConfigOption('databaseName'), new Command([ |
231 | 231 | 'collStats' => ($this->config->getOption('collectionName') !== null ? $this->config->getOption('collectionName') : 'Cache'), |
232 | 232 | 'verbose' => true, |
233 | - ]))->toArray()[ 0 ]; |
|
233 | + ]))->toArray()[0]; |
|
234 | 234 | |
235 | - $array_filter_recursive = function ($array, callable $callback = null) use (&$array_filter_recursive) { |
|
235 | + $array_filter_recursive = function($array, callable $callback = null) use (&$array_filter_recursive) { |
|
236 | 236 | $array = $callback($array); |
237 | 237 | |
238 | 238 | if (\is_object($array) || \is_array($array)) { |
@@ -244,12 +244,12 @@ discard block |
||
244 | 244 | return $array; |
245 | 245 | }; |
246 | 246 | |
247 | - $callback = function ($item) { |
|
247 | + $callback = function($item) { |
|
248 | 248 | /** |
249 | 249 | * Remove unserializable properties |
250 | 250 | */ |
251 | 251 | if ($item instanceof \MongoDB\BSON\UTCDateTime) { |
252 | - return (string)$item; |
|
252 | + return (string) $item; |
|
253 | 253 | } |
254 | 254 | return $item; |
255 | 255 | }; |
@@ -19,7 +19,7 @@ |
||
19 | 19 | use Phpfastcache\Core\Pool\ExtendedCacheItemPoolInterface; |
20 | 20 | use Phpfastcache\Drivers\Mongodb\Driver as MongodbDriver; |
21 | 21 | use Phpfastcache\Exceptions\{ |
22 | - PhpfastcacheInvalidArgumentException, PhpfastcacheInvalidArgumentTypeException |
|
22 | + PhpfastcacheInvalidArgumentException, PhpfastcacheInvalidArgumentTypeException |
|
23 | 23 | }; |
24 | 24 | |
25 | 25 | /** |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | use Phpfastcache\Core\Pool\{DriverBaseTrait, ExtendedCacheItemPoolInterface}; |
20 | 20 | use Phpfastcache\Entities\DriverStatistic; |
21 | 21 | use Phpfastcache\Exceptions\{ |
22 | - PhpfastcacheInvalidArgumentException, PhpfastcacheLogicException |
|
22 | + PhpfastcacheInvalidArgumentException, PhpfastcacheLogicException |
|
23 | 23 | }; |
24 | 24 | use Phpfastcache\Util\ArrayObject; |
25 | 25 | use Psr\Cache\CacheItemInterface; |
@@ -89,9 +89,9 @@ discard block |
||
89 | 89 | */ |
90 | 90 | if ($item instanceof Item) { |
91 | 91 | $this->instance |
92 | - ->bucket($this->bucketName) |
|
93 | - ->newBinary($item->getKey(), $this->encode($this->driverPreWrap($item))) |
|
94 | - ->store(); |
|
92 | + ->bucket($this->bucketName) |
|
93 | + ->newBinary($item->getKey(), $this->encode($this->driverPreWrap($item))) |
|
94 | + ->store(); |
|
95 | 95 | return true; |
96 | 96 | } |
97 | 97 | |
@@ -142,9 +142,9 @@ discard block |
||
142 | 142 | $info = $this->instance->bucket($this->bucketName)->getProperties(); |
143 | 143 | |
144 | 144 | return (new DriverStatistic()) |
145 | - ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
146 | - ->setRawData($info) |
|
147 | - ->setSize(false) |
|
148 | - ->setInfo('Riak does not provide size/date information att all :('); |
|
145 | + ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
146 | + ->setRawData($info) |
|
147 | + ->setSize(false) |
|
148 | + ->setInfo('Riak does not provide size/date information att all :('); |
|
149 | 149 | } |
150 | 150 | } |
151 | 151 | \ No newline at end of file |