@@ -62,82 +62,82 @@ discard block |
||
| 62 | 62 | /** |
| 63 | 63 | * Specify if the item must provide detailed creation/modification dates |
| 64 | 64 | */ |
| 65 | - 'itemDetailedDate' => false, |
|
| 65 | + 'itemDetailedDate' => false, |
|
| 66 | 66 | |
| 67 | 67 | /** |
| 68 | 68 | * Automatically attempt to fallback to temporary directory |
| 69 | 69 | * if the cache fails to write on the specified directory |
| 70 | 70 | */ |
| 71 | - 'autoTmpFallback' => false, |
|
| 71 | + 'autoTmpFallback' => false, |
|
| 72 | 72 | |
| 73 | 73 | /** |
| 74 | 74 | * Provide a secure file manipulation mechanism |
| 75 | 75 | * on intensive usage the performance can be affected. |
| 76 | 76 | */ |
| 77 | - 'secureFileManipulation' => false, |
|
| 77 | + 'secureFileManipulation' => false, |
|
| 78 | 78 | |
| 79 | 79 | /** |
| 80 | 80 | * Ignore Symfony notice for Symfony project which |
| 81 | 81 | * do not makes use of PhpFastCache's Symfony Bundle |
| 82 | 82 | */ |
| 83 | - 'ignoreSymfonyNotice' => false, |
|
| 83 | + 'ignoreSymfonyNotice' => false, |
|
| 84 | 84 | |
| 85 | 85 | /** |
| 86 | 86 | * Default time-to-live in second |
| 87 | 87 | */ |
| 88 | - 'defaultTtl' => 900, |
|
| 88 | + 'defaultTtl' => 900, |
|
| 89 | 89 | |
| 90 | 90 | /** |
| 91 | 91 | * Default key hash function |
| 92 | 92 | * (md5 by default) |
| 93 | 93 | */ |
| 94 | - 'defaultKeyHashFunction' => '', |
|
| 94 | + 'defaultKeyHashFunction' => '', |
|
| 95 | 95 | |
| 96 | 96 | /** |
| 97 | 97 | * The securityKey that will be used |
| 98 | 98 | * to create sub-directory |
| 99 | 99 | * (Files-based drivers only) |
| 100 | 100 | */ |
| 101 | - 'securityKey' => 'auto', |
|
| 101 | + 'securityKey' => 'auto', |
|
| 102 | 102 | |
| 103 | 103 | /** |
| 104 | 104 | * Auto-generate .htaccess if it's missing |
| 105 | 105 | * (Files-based drivers only) |
| 106 | 106 | */ |
| 107 | - 'htaccess' => true, |
|
| 107 | + 'htaccess' => true, |
|
| 108 | 108 | |
| 109 | 109 | /** |
| 110 | 110 | * Default files chmod |
| 111 | 111 | * 0777 recommended |
| 112 | 112 | * (Files-based drivers only) |
| 113 | 113 | */ |
| 114 | - 'default_chmod' => 0777, |
|
| 114 | + 'default_chmod' => 0777, |
|
| 115 | 115 | |
| 116 | 116 | /** |
| 117 | 117 | * The path where we will writecache files |
| 118 | 118 | * default value if empty: sys_get_temp_dir() |
| 119 | 119 | * (Files-based drivers only) |
| 120 | 120 | */ |
| 121 | - 'path' => '', |
|
| 121 | + 'path' => '', |
|
| 122 | 122 | |
| 123 | 123 | /** |
| 124 | 124 | * Driver fallback in case of failure. |
| 125 | 125 | * Caution, in case of failure an E_WARNING |
| 126 | 126 | * error will always be raised |
| 127 | 127 | */ |
| 128 | - 'fallback' => false, |
|
| 128 | + 'fallback' => false, |
|
| 129 | 129 | |
| 130 | 130 | /** |
| 131 | 131 | * Maximum size (bytes) of object store in memory |
| 132 | 132 | * (Memcache(d) drivers only) |
| 133 | 133 | */ |
| 134 | - 'limited_memory_each_object' => 4096, |
|
| 134 | + 'limited_memory_each_object' => 4096, |
|
| 135 | 135 | |
| 136 | 136 | /** |
| 137 | 137 | * Compress stored data, if the backend supports it |
| 138 | 138 | * (Memcache(d) drivers only) |
| 139 | 139 | */ |
| 140 | - 'compress_data' => false, |
|
| 140 | + 'compress_data' => false, |
|
| 141 | 141 | ]; |
| 142 | 142 | |
| 143 | 143 | /** |
@@ -319,24 +319,24 @@ discard block |
||
| 319 | 319 | public static function getStaticSystemDrivers() |
| 320 | 320 | { |
| 321 | 321 | return [ |
| 322 | - 'Apc', |
|
| 323 | - 'Apcu', |
|
| 324 | - 'Cassandra', |
|
| 325 | - 'Couchbase', |
|
| 326 | - 'Couchdb', |
|
| 327 | - 'Devnull', |
|
| 328 | - 'Files', |
|
| 329 | - 'Leveldb', |
|
| 330 | - 'Memcache', |
|
| 331 | - 'Memcached', |
|
| 332 | - 'Memstatic', |
|
| 333 | - 'Mongodb', |
|
| 334 | - 'Predis', |
|
| 335 | - 'Redis', |
|
| 336 | - 'Ssdb', |
|
| 337 | - 'Sqlite', |
|
| 338 | - 'Wincache', |
|
| 339 | - 'Xcache', |
|
| 322 | + 'Apc', |
|
| 323 | + 'Apcu', |
|
| 324 | + 'Cassandra', |
|
| 325 | + 'Couchbase', |
|
| 326 | + 'Couchdb', |
|
| 327 | + 'Devnull', |
|
| 328 | + 'Files', |
|
| 329 | + 'Leveldb', |
|
| 330 | + 'Memcache', |
|
| 331 | + 'Memcached', |
|
| 332 | + 'Memstatic', |
|
| 333 | + 'Mongodb', |
|
| 334 | + 'Predis', |
|
| 335 | + 'Redis', |
|
| 336 | + 'Ssdb', |
|
| 337 | + 'Sqlite', |
|
| 338 | + 'Wincache', |
|
| 339 | + 'Xcache', |
|
| 340 | 340 | ]; |
| 341 | 341 | } |
| 342 | 342 | |
@@ -346,9 +346,9 @@ discard block |
||
| 346 | 346 | public static function getStaticAllDrivers() |
| 347 | 347 | { |
| 348 | 348 | return array_merge(self::getStaticSystemDrivers(), [ |
| 349 | - 'Devtrue', |
|
| 350 | - 'Devfalse', |
|
| 351 | - 'Cookie', |
|
| 349 | + 'Devtrue', |
|
| 350 | + 'Devfalse', |
|
| 351 | + 'Cookie', |
|
| 352 | 352 | ]); |
| 353 | 353 | } |
| 354 | 354 | |
@@ -173,9 +173,9 @@ discard block |
||
| 173 | 173 | $url .= $path; |
| 174 | 174 | |
| 175 | 175 | $this->instance = CouchDBClient::create([ |
| 176 | - 'dbname' => $this->getDatabaseName(), |
|
| 177 | - 'url' => $url, |
|
| 178 | - 'timeout' => $timeout |
|
| 176 | + 'dbname' => $this->getDatabaseName(), |
|
| 177 | + 'url' => $url, |
|
| 178 | + 'timeout' => $timeout |
|
| 179 | 179 | ]); |
| 180 | 180 | |
| 181 | 181 | $this->createDatabase(); |
@@ -192,10 +192,10 @@ discard block |
||
| 192 | 192 | $path = '/' . $this->getDatabaseName() . '/' . urlencode($docId); |
| 193 | 193 | |
| 194 | 194 | $response = $this->instance->getHttpClient()->request( |
| 195 | - 'GET',// At this moment HEAD requests are not working: https://github.com/doctrine/couchdb-client/issues/72 |
|
| 196 | - $path, |
|
| 197 | - null, |
|
| 198 | - false |
|
| 195 | + 'GET',// At this moment HEAD requests are not working: https://github.com/doctrine/couchdb-client/issues/72 |
|
| 196 | + $path, |
|
| 197 | + null, |
|
| 198 | + false |
|
| 199 | 199 | ); |
| 200 | 200 | if(!empty($response->headers['etag'])){ |
| 201 | 201 | return trim($response->headers['etag'], " '\"\t\n\r\0\x0B"); |
@@ -236,9 +236,9 @@ discard block |
||
| 236 | 236 | $info = $this->instance->getDatabaseInfo(); |
| 237 | 237 | |
| 238 | 238 | return (new driverStatistic()) |
| 239 | - ->setSize($info['sizes']['active']) |
|
| 240 | - ->setRawData($info) |
|
| 241 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 242 | - ->setInfo('Couchdb version ' . $this->instance->getVersion() . "\n For more information see RawData."); |
|
| 239 | + ->setSize($info['sizes']['active']) |
|
| 240 | + ->setRawData($info) |
|
| 241 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 242 | + ->setInfo('Couchdb version ' . $this->instance->getVersion() . "\n For more information see RawData."); |
|
| 243 | 243 | } |
| 244 | 244 | } |
| 245 | 245 | \ No newline at end of file |
@@ -69,9 +69,9 @@ discard block |
||
| 69 | 69 | * Check for Cross-Driver type confusion |
| 70 | 70 | */ |
| 71 | 71 | if ($item instanceof Item) { |
| 72 | - try{ |
|
| 72 | + try { |
|
| 73 | 73 | $this->instance->putDocument(['data' => $this->encode($this->driverPreWrap($item))], $item->getEncodedKey(), $this->getLatestDocumentRevision($item->getEncodedKey())); |
| 74 | - }catch (CouchDBException $e){ |
|
| 74 | + } catch (CouchDBException $e) { |
|
| 75 | 75 | throw new phpFastCacheDriverException('Got error while trying to upsert a document: ' . $e->getMessage(), null, $e); |
| 76 | 76 | } |
| 77 | 77 | return true; |
@@ -87,17 +87,17 @@ discard block |
||
| 87 | 87 | */ |
| 88 | 88 | protected function driverRead(CacheItemInterface $item) |
| 89 | 89 | { |
| 90 | - try{ |
|
| 90 | + try { |
|
| 91 | 91 | $response = $this->instance->findDocument($item->getEncodedKey()); |
| 92 | - }catch (CouchDBException $e){ |
|
| 92 | + } catch (CouchDBException $e) { |
|
| 93 | 93 | throw new phpFastCacheDriverException('Got error while trying to get a document: ' . $e->getMessage(), null, $e); |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - if($response->status === 404 || empty($response->body['data'])){ |
|
| 96 | + if ($response->status === 404 || empty($response->body['data'])) { |
|
| 97 | 97 | return null; |
| 98 | - }else if($response->status === 200){ |
|
| 98 | + } else if ($response->status === 200) { |
|
| 99 | 99 | return $this->decode($response->body['data']); |
| 100 | - }else{ |
|
| 100 | + } else { |
|
| 101 | 101 | throw new phpFastCacheDriverException('Got unexpected HTTP status: ' . $response->status); |
| 102 | 102 | } |
| 103 | 103 | } |
@@ -114,9 +114,9 @@ discard block |
||
| 114 | 114 | * Check for Cross-Driver type confusion |
| 115 | 115 | */ |
| 116 | 116 | if ($item instanceof Item) { |
| 117 | - try{ |
|
| 117 | + try { |
|
| 118 | 118 | $this->instance->deleteDocument($item->getEncodedKey(), $this->getLatestDocumentRevision($item->getEncodedKey())); |
| 119 | - }catch (CouchDBException $e){ |
|
| 119 | + } catch (CouchDBException $e) { |
|
| 120 | 120 | throw new phpFastCacheDriverException('Got error while trying to delete a document: ' . $e->getMessage(), null, $e); |
| 121 | 121 | } |
| 122 | 122 | return true; |
@@ -131,10 +131,10 @@ discard block |
||
| 131 | 131 | */ |
| 132 | 132 | protected function driverClear() |
| 133 | 133 | { |
| 134 | - try{ |
|
| 134 | + try { |
|
| 135 | 135 | $this->instance->deleteDatabase($this->getDatabaseName()); |
| 136 | 136 | $this->createDatabase(); |
| 137 | - }catch (CouchDBException $e){ |
|
| 137 | + } catch (CouchDBException $e) { |
|
| 138 | 138 | throw new phpFastCacheDriverException('Got error while trying to delete and recreate the database: ' . $e->getMessage(), null, $e); |
| 139 | 139 | } |
| 140 | 140 | |
@@ -150,19 +150,19 @@ discard block |
||
| 150 | 150 | if ($this->instance instanceof CouchdbClient) { |
| 151 | 151 | throw new \LogicException('Already connected to Couchdb server'); |
| 152 | 152 | } else { |
| 153 | - $host = isset($this->config[ 'host' ]) ? $this->config[ 'host' ] : '127.0.0.1'; |
|
| 154 | - $ssl = isset($this->config[ 'ssl' ]) ? $this->config[ 'ssl' ] : false; |
|
| 155 | - $port = isset($this->config[ 'port' ]) ? $this->config[ 'port' ] : 5984; |
|
| 156 | - $path = isset($this->config[ 'path' ]) ? $this->config[ 'path' ] : '/'; |
|
| 157 | - $username = isset($this->config[ 'username' ]) ? $this->config[ 'username' ] : ''; |
|
| 158 | - $password = isset($this->config[ 'password' ]) ? $this->config[ 'password' ] : ''; |
|
| 159 | - $timeout = isset($this->config[ 'timeout' ]) ? $this->config[ 'timeout' ] : 10; |
|
| 153 | + $host = isset($this->config['host']) ? $this->config['host'] : '127.0.0.1'; |
|
| 154 | + $ssl = isset($this->config['ssl']) ? $this->config['ssl'] : false; |
|
| 155 | + $port = isset($this->config['port']) ? $this->config['port'] : 5984; |
|
| 156 | + $path = isset($this->config['path']) ? $this->config['path'] : '/'; |
|
| 157 | + $username = isset($this->config['username']) ? $this->config['username'] : ''; |
|
| 158 | + $password = isset($this->config['password']) ? $this->config['password'] : ''; |
|
| 159 | + $timeout = isset($this->config['timeout']) ? $this->config['timeout'] : 10; |
|
| 160 | 160 | |
| 161 | 161 | $url = ($ssl ? 'https://' : 'http://'); |
| 162 | - if($username) |
|
| 162 | + if ($username) |
|
| 163 | 163 | { |
| 164 | 164 | $url .= "{$username}"; |
| 165 | - if($password) |
|
| 165 | + if ($password) |
|
| 166 | 166 | { |
| 167 | 167 | $url .= ":{$password}"; |
| 168 | 168 | } |
@@ -192,14 +192,14 @@ discard block |
||
| 192 | 192 | $path = '/' . $this->getDatabaseName() . '/' . urlencode($docId); |
| 193 | 193 | |
| 194 | 194 | $response = $this->instance->getHttpClient()->request( |
| 195 | - 'GET',// At this moment HEAD requests are not working: https://github.com/doctrine/couchdb-client/issues/72 |
|
| 195 | + 'GET', // At this moment HEAD requests are not working: https://github.com/doctrine/couchdb-client/issues/72 |
|
| 196 | 196 | $path, |
| 197 | 197 | null, |
| 198 | 198 | false |
| 199 | 199 | ); |
| 200 | - if(!empty($response->headers['etag'])){ |
|
| 200 | + if (!empty($response->headers['etag'])) { |
|
| 201 | 201 | return trim($response->headers['etag'], " '\"\t\n\r\0\x0B"); |
| 202 | - }else{ |
|
| 202 | + } else { |
|
| 203 | 203 | return null; |
| 204 | 204 | } |
| 205 | 205 | } |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | */ |
| 210 | 210 | protected function getDatabaseName() |
| 211 | 211 | { |
| 212 | - return isset($this->config[ 'database' ]) ? $this->config[ 'database' ] : 'phpfastcache'; |
|
| 212 | + return isset($this->config['database']) ? $this->config['database'] : 'phpfastcache'; |
|
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | /** |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | */ |
| 218 | 218 | protected function createDatabase() |
| 219 | 219 | { |
| 220 | - if(!in_array($this->instance->getDatabase(), $this->instance->getAllDatabases(), true)){ |
|
| 220 | + if (!in_array($this->instance->getDatabase(), $this->instance->getAllDatabases(), true)) { |
|
| 221 | 221 | $this->instance->createDatabase($this->instance->getDatabase()); |
| 222 | 222 | } |
| 223 | 223 | } |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | if ($item instanceof Item) { |
| 72 | 72 | try{ |
| 73 | 73 | $this->instance->putDocument(['data' => $this->encode($this->driverPreWrap($item))], $item->getEncodedKey(), $this->getLatestDocumentRevision($item->getEncodedKey())); |
| 74 | - }catch (CouchDBException $e){ |
|
| 74 | + } catch (CouchDBException $e){ |
|
| 75 | 75 | throw new phpFastCacheDriverException('Got error while trying to upsert a document: ' . $e->getMessage(), null, $e); |
| 76 | 76 | } |
| 77 | 77 | return true; |
@@ -89,15 +89,15 @@ discard block |
||
| 89 | 89 | { |
| 90 | 90 | try{ |
| 91 | 91 | $response = $this->instance->findDocument($item->getEncodedKey()); |
| 92 | - }catch (CouchDBException $e){ |
|
| 92 | + } catch (CouchDBException $e){ |
|
| 93 | 93 | throw new phpFastCacheDriverException('Got error while trying to get a document: ' . $e->getMessage(), null, $e); |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | if($response->status === 404 || empty($response->body['data'])){ |
| 97 | 97 | return null; |
| 98 | - }else if($response->status === 200){ |
|
| 98 | + } else if($response->status === 200){ |
|
| 99 | 99 | return $this->decode($response->body['data']); |
| 100 | - }else{ |
|
| 100 | + } else{ |
|
| 101 | 101 | throw new phpFastCacheDriverException('Got unexpected HTTP status: ' . $response->status); |
| 102 | 102 | } |
| 103 | 103 | } |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | if ($item instanceof Item) { |
| 117 | 117 | try{ |
| 118 | 118 | $this->instance->deleteDocument($item->getEncodedKey(), $this->getLatestDocumentRevision($item->getEncodedKey())); |
| 119 | - }catch (CouchDBException $e){ |
|
| 119 | + } catch (CouchDBException $e){ |
|
| 120 | 120 | throw new phpFastCacheDriverException('Got error while trying to delete a document: ' . $e->getMessage(), null, $e); |
| 121 | 121 | } |
| 122 | 122 | return true; |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | try{ |
| 135 | 135 | $this->instance->deleteDatabase($this->getDatabaseName()); |
| 136 | 136 | $this->createDatabase(); |
| 137 | - }catch (CouchDBException $e){ |
|
| 137 | + } catch (CouchDBException $e){ |
|
| 138 | 138 | throw new phpFastCacheDriverException('Got error while trying to delete and recreate the database: ' . $e->getMessage(), null, $e); |
| 139 | 139 | } |
| 140 | 140 | |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | ); |
| 200 | 200 | if(!empty($response->headers['etag'])){ |
| 201 | 201 | return trim($response->headers['etag'], " '\"\t\n\r\0\x0B"); |
| 202 | - }else{ |
|
| 202 | + } else{ |
|
| 203 | 203 | return null; |
| 204 | 204 | } |
| 205 | 205 | } |