@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | return; |
28 | 28 | } else if (strpos($entity, 'Psr\Cache') === 0) { |
29 | 29 | trigger_error('If you cannot use <b>composer</b>, you have to include manually the Psr\\Cache interfaces.<br />See: https://github.com/php-fig/cache/tree/master/src<br /> Called ' . $entity, |
30 | - E_USER_ERROR); |
|
30 | + E_USER_ERROR); |
|
31 | 31 | |
32 | 32 | return; |
33 | 33 | } |
@@ -42,5 +42,5 @@ discard block |
||
42 | 42 | |
43 | 43 | if (class_exists('Composer\Autoload\ClassLoader')) { |
44 | 44 | trigger_error('Your project already makes use of Composer. You SHOULD use the composer dependency "phpfastcache/phpfastcache" instead of hard-autoloading.', |
45 | - E_USER_WARNING); |
|
45 | + E_USER_WARNING); |
|
46 | 46 | } |
47 | 47 | \ No newline at end of file |
@@ -27,7 +27,7 @@ |
||
27 | 27 | return true; |
28 | 28 | } else if (constant($CONSTANT_NAME) !== $driverName) { |
29 | 29 | trigger_error('Memcache collision detected, you used both Memcache and Memcached driver in your script, this may leads to unexpected behaviours', |
30 | - E_USER_WARNING); |
|
30 | + E_USER_WARNING); |
|
31 | 31 | |
32 | 32 | return false; |
33 | 33 | } |
@@ -160,9 +160,9 @@ discard block |
||
160 | 160 | protected static function cleanFileName($filename) |
161 | 161 | { |
162 | 162 | $regex = [ |
163 | - '/[\?\[\]\/\\\=\<\>\:\;\,\'\"\&\$\#\*\(\)\|\~\`\!\{\}]/', |
|
164 | - '/\.$/', |
|
165 | - '/^\./', |
|
163 | + '/[\?\[\]\/\\\=\<\>\:\;\,\'\"\&\$\#\*\(\)\|\~\`\!\{\}]/', |
|
164 | + '/\.$/', |
|
165 | + '/^\./', |
|
166 | 166 | ]; |
167 | 167 | $replace = ['-', '', '']; |
168 | 168 | |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | chmod($path, 0777); |
183 | 183 | } catch (phpFastCacheDriverException $e) { |
184 | 184 | throw new phpFastCacheDriverException('PLEASE CHMOD ' . $path . ' - 0777 OR ANY WRITABLE PERMISSION!', |
185 | - 92); |
|
185 | + 92); |
|
186 | 186 | } |
187 | 187 | } |
188 | 188 |
@@ -127,14 +127,14 @@ |
||
127 | 127 | public function driverConnect() |
128 | 128 | { |
129 | 129 | $server = isset($this->config[ 'redis' ]) ? $this->config[ 'redis' ] : [ |
130 | - 'host' => '127.0.0.1', |
|
131 | - 'port' => '6379', |
|
132 | - 'password' => '', |
|
133 | - 'database' => '', |
|
130 | + 'host' => '127.0.0.1', |
|
131 | + 'port' => '6379', |
|
132 | + 'password' => '', |
|
133 | + 'database' => '', |
|
134 | 134 | ]; |
135 | 135 | |
136 | 136 | $config = [ |
137 | - 'host' => $server[ 'host' ], |
|
137 | + 'host' => $server[ 'host' ], |
|
138 | 138 | ]; |
139 | 139 | |
140 | 140 | $port = isset($server[ 'port' ]) ? $server[ 'port' ] : ''; |
@@ -78,14 +78,14 @@ discard block |
||
78 | 78 | if ($item instanceof Item) { |
79 | 79 | try { |
80 | 80 | $result = (array) $this->getCollection()->update( |
81 | - ['_id' => $item->getKey()], |
|
82 | - [ |
|
81 | + ['_id' => $item->getKey()], |
|
82 | + [ |
|
83 | 83 | '$set' => [ |
84 | - self::DRIVER_TIME_WRAPPER_INDEX => ($item->getTtl() > 0 ? new MongoDate(time() + $item->getTtl()) : null), |
|
85 | - self::DRIVER_DATA_WRAPPER_INDEX => new MongoBinData($this->encode($item->get()), MongoBinData::BYTE_ARRAY), |
|
84 | + self::DRIVER_TIME_WRAPPER_INDEX => ($item->getTtl() > 0 ? new MongoDate(time() + $item->getTtl()) : null), |
|
85 | + self::DRIVER_DATA_WRAPPER_INDEX => new MongoBinData($this->encode($item->get()), MongoBinData::BYTE_ARRAY), |
|
86 | 86 | ], |
87 | - ], |
|
88 | - ['upsert' => true, 'multiple' => false] |
|
87 | + ], |
|
88 | + ['upsert' => true, 'multiple' => false] |
|
89 | 89 | ); |
90 | 90 | } catch (MongoCursorException $e) { |
91 | 91 | return false; |
@@ -106,8 +106,8 @@ discard block |
||
106 | 106 | $document = $this->getCollection()->findOne(['_id' => $key], [self::DRIVER_DATA_WRAPPER_INDEX, self::DRIVER_TIME_WRAPPER_INDEX /*'d', 'e'*/]); |
107 | 107 | if ($document) { |
108 | 108 | return [ |
109 | - self::DRIVER_DATA_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_DATA_WRAPPER_INDEX ]->bin), |
|
110 | - self::DRIVER_TIME_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_TIME_WRAPPER_INDEX ]->sec), |
|
109 | + self::DRIVER_DATA_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_DATA_WRAPPER_INDEX ]->bin), |
|
110 | + self::DRIVER_TIME_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_TIME_WRAPPER_INDEX ]->sec), |
|
111 | 111 | ]; |
112 | 112 | } else { |
113 | 113 | return null; |
@@ -162,10 +162,10 @@ discard block |
||
162 | 162 | * @todo make an url builder |
163 | 163 | */ |
164 | 164 | $this->instance = $this->instance ?: (new MongodbClient('mongodb://' . |
165 | - ($username ?: '') . |
|
166 | - ($password ? ":{$password}" : '') . |
|
167 | - ($username ? '@' : '') . "{$host}" . |
|
168 | - ($port != '27017' ? ":{$port}" : ''), ['timeout' => $timeout * 1000]))->phpFastCache; |
|
165 | + ($username ?: '') . |
|
166 | + ($password ? ":{$password}" : '') . |
|
167 | + ($username ? '@' : '') . "{$host}" . |
|
168 | + ($port != '27017' ? ":{$port}" : ''), ['timeout' => $timeout * 1000]))->phpFastCache; |
|
169 | 169 | $this->instance->Cache->createIndex([self::DRIVER_TIME_WRAPPER_INDEX => 1], ['expireAfterSeconds' => 0]); |
170 | 170 | } |
171 | 171 | } |
@@ -206,23 +206,23 @@ discard block |
||
206 | 206 | public function getStats() |
207 | 207 | { |
208 | 208 | $serverStatus = $this->getCollection()->db->command([ |
209 | - 'serverStatus' => 1, |
|
210 | - 'recordStats' => 0, |
|
211 | - 'repl' => 0, |
|
212 | - 'metrics' => 0, |
|
209 | + 'serverStatus' => 1, |
|
210 | + 'recordStats' => 0, |
|
211 | + 'repl' => 0, |
|
212 | + 'metrics' => 0, |
|
213 | 213 | ]); |
214 | 214 | $collStats = $this->getCollection()->db->command([ |
215 | - 'collStats' => 'Cache', |
|
216 | - 'verbose' => true, |
|
215 | + 'collStats' => 'Cache', |
|
216 | + 'verbose' => true, |
|
217 | 217 | ]); |
218 | 218 | |
219 | 219 | $stats = (new driverStatistic()) |
220 | - ->setInfo('MongoDB version ' . $serverStatus[ 'version' ] . ', Uptime (in days): ' . round($serverStatus[ 'uptime' ] / 86400, 1)) |
|
221 | - ->setSize((int) $collStats[ 'size' ]) |
|
222 | - ->setRawData([ |
|
220 | + ->setInfo('MongoDB version ' . $serverStatus[ 'version' ] . ', Uptime (in days): ' . round($serverStatus[ 'uptime' ] / 86400, 1)) |
|
221 | + ->setSize((int) $collStats[ 'size' ]) |
|
222 | + ->setRawData([ |
|
223 | 223 | 'serverStatus' => $serverStatus, |
224 | 224 | 'collStats' => $collStats, |
225 | - ]); |
|
225 | + ]); |
|
226 | 226 | |
227 | 227 | return $stats; |
228 | 228 | } |
@@ -133,7 +133,7 @@ |
||
133 | 133 | $servers = (!empty($this->config[ 'memcache' ]) && is_array($this->config[ 'memcache' ]) ? $this->config[ 'memcache' ] : []); |
134 | 134 | if (count($servers) < 1) { |
135 | 135 | $servers = [ |
136 | - ['127.0.0.1', 11211], |
|
136 | + ['127.0.0.1', 11211], |
|
137 | 137 | ]; |
138 | 138 | } |
139 | 139 |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | $servers = (!empty($this->config[ 'memcache' ]) && is_array($this->config[ 'memcache' ]) ? $this->config[ 'memcache' ] : []); |
136 | 136 | if (count($servers) < 1) { |
137 | 137 | $servers = [ |
138 | - ['127.0.0.1', 11211], |
|
138 | + ['127.0.0.1', 11211], |
|
139 | 139 | ]; |
140 | 140 | } |
141 | 141 | |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | } |
187 | 187 | } else { |
188 | 188 | throw new \InvalidArgumentException(sprintf('$key must be a string, got type "%s" instead.', |
189 | - gettype($key))); |
|
189 | + gettype($key))); |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | return $this->itemInstances[ $key ]; |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | return $this; |
206 | 206 | } else { |
207 | 207 | throw new \InvalidArgumentException(sprintf('Invalid Item Class "%s" for this driver.', |
208 | - get_class($item))); |
|
208 | + get_class($item))); |
|
209 | 209 | } |
210 | 210 | } |
211 | 211 |
@@ -140,8 +140,8 @@ |
||
140 | 140 | { |
141 | 141 | $stat = new driverStatistic(); |
142 | 142 | $stat->setInfo('A void info string') |
143 | - ->setSize(1337) |
|
144 | - ->setData('A void data string'); |
|
143 | + ->setSize(1337) |
|
144 | + ->setData('A void data string'); |
|
145 | 145 | |
146 | 146 | return $stat; |
147 | 147 | } |
@@ -142,10 +142,10 @@ |
||
142 | 142 | $password = isset($this->config[ 'password' ]) ? $this->config[ 'password' ] : ''; |
143 | 143 | $username = isset($this->config[ 'username' ]) ? $this->config[ 'username' ] : ''; |
144 | 144 | $buckets = isset($this->config[ 'buckets' ]) ? $this->config[ 'buckets' ] : [ |
145 | - [ |
|
145 | + [ |
|
146 | 146 | 'bucket' => 'default', |
147 | 147 | 'password' => '', |
148 | - ], |
|
148 | + ], |
|
149 | 149 | ]; |
150 | 150 | |
151 | 151 | $this->instance = $this->instance ?: new CouchbaseClient("couchbase://{$host}", $username, $password); |