@@ -52,13 +52,13 @@ discard block |
||
52 | 52 | * @var array |
53 | 53 | */ |
54 | 54 | protected static $config = [ |
55 | - 'securityKey' => 'auto',// The securityKey that will be used to create sub-directory |
|
56 | - 'htaccess' => true,// Auto-generate .htaccess if tit is missing |
|
57 | - 'default_chmod' => 0777, // 0777 recommended |
|
58 | - 'path' => '',// if not set will be the value of sys_get_temp_dir() |
|
59 | - 'fallback' => false, //Fall back when old driver is not support |
|
60 | - "limited_memory_each_object" => 4096, // maximum size (bytes) of object store in memory |
|
61 | - "compress_data" => false, // compress stored data, if the backend supports it |
|
55 | + 'securityKey' => 'auto',// The securityKey that will be used to create sub-directory |
|
56 | + 'htaccess' => true,// Auto-generate .htaccess if tit is missing |
|
57 | + 'default_chmod' => 0777, // 0777 recommended |
|
58 | + 'path' => '',// if not set will be the value of sys_get_temp_dir() |
|
59 | + 'fallback' => false, //Fall back when old driver is not support |
|
60 | + "limited_memory_each_object" => 4096, // maximum size (bytes) of object store in memory |
|
61 | + "compress_data" => false, // compress stored data, if the backend supports it |
|
62 | 62 | ]; |
63 | 63 | |
64 | 64 | /** |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | } |
107 | 107 | } |
108 | 108 | } else if(++$badPracticeOmeter[$driver] >= 5){ |
109 | - trigger_error('[' . $driver . '] Calling many times CacheManager::getInstance() for already instanced drivers is a bad practice and have a significant impact on performances. |
|
109 | + trigger_error('[' . $driver . '] Calling many times CacheManager::getInstance() for already instanced drivers is a bad practice and have a significant impact on performances. |
|
110 | 110 | See https://github.com/PHPSocialNetwork/phpfastcache/wiki/[V5]-Why-calling-getInstance%28%29-each-time-is-a-bad-practice-%3F'); |
111 | 111 | } |
112 | 112 | |
@@ -217,21 +217,21 @@ discard block |
||
217 | 217 | public static function getStaticSystemDrivers() |
218 | 218 | { |
219 | 219 | return [ |
220 | - 'Sqlite', |
|
221 | - 'Files', |
|
222 | - 'Apc', |
|
223 | - 'Apcu', |
|
224 | - 'Memcache', |
|
225 | - 'Memcached', |
|
226 | - 'Couchbase', |
|
227 | - 'Mongodb', |
|
228 | - 'Predis', |
|
229 | - 'Redis', |
|
230 | - 'Ssdb', |
|
231 | - 'Leveldb', |
|
232 | - 'Wincache', |
|
233 | - 'Xcache', |
|
234 | - 'Devnull', |
|
220 | + 'Sqlite', |
|
221 | + 'Files', |
|
222 | + 'Apc', |
|
223 | + 'Apcu', |
|
224 | + 'Memcache', |
|
225 | + 'Memcached', |
|
226 | + 'Couchbase', |
|
227 | + 'Mongodb', |
|
228 | + 'Predis', |
|
229 | + 'Redis', |
|
230 | + 'Ssdb', |
|
231 | + 'Leveldb', |
|
232 | + 'Wincache', |
|
233 | + 'Xcache', |
|
234 | + 'Devnull', |
|
235 | 235 | ]; |
236 | 236 | } |
237 | 237 |
@@ -52,10 +52,10 @@ discard block |
||
52 | 52 | * @var array |
53 | 53 | */ |
54 | 54 | protected static $config = [ |
55 | - 'securityKey' => 'auto',// The securityKey that will be used to create sub-directory |
|
56 | - 'htaccess' => true,// Auto-generate .htaccess if tit is missing |
|
55 | + 'securityKey' => 'auto', // The securityKey that will be used to create sub-directory |
|
56 | + 'htaccess' => true, // Auto-generate .htaccess if tit is missing |
|
57 | 57 | 'default_chmod' => 0777, // 0777 recommended |
58 | - 'path' => '',// if not set will be the value of sys_get_temp_dir() |
|
58 | + 'path' => '', // if not set will be the value of sys_get_temp_dir() |
|
59 | 59 | 'fallback' => false, //Fall back when old driver is not support |
60 | 60 | "limited_memory_each_object" => 4096, // maximum size (bytes) of object store in memory |
61 | 61 | "compress_data" => false, // compress stored data, if the backend supports it |
@@ -90,27 +90,27 @@ discard block |
||
90 | 90 | } |
91 | 91 | |
92 | 92 | $instance = crc32($driver . serialize($config)); |
93 | - if (!isset(self::$instances[ $instance ])) { |
|
93 | + if (!isset(self::$instances[$instance])) { |
|
94 | 94 | $badPracticeOmeter[$driver] = 1; |
95 | 95 | $class = self::getNamespacePath() . $driver . '\Driver'; |
96 | - try{ |
|
97 | - self::$instances[ $instance ] = new $class($config); |
|
98 | - }catch(phpFastCacheDriverCheckException $e){ |
|
96 | + try { |
|
97 | + self::$instances[$instance] = new $class($config); |
|
98 | + } catch (phpFastCacheDriverCheckException $e) { |
|
99 | 99 | $fallback = self::standardizeDriverName($config['fallback']); |
100 | - if($fallback && $fallback !== $driver){ |
|
100 | + if ($fallback && $fallback !== $driver) { |
|
101 | 101 | $class = self::getNamespacePath() . $fallback . '\Driver'; |
102 | - self::$instances[ $instance ] = new $class($config); |
|
102 | + self::$instances[$instance] = new $class($config); |
|
103 | 103 | trigger_error(sprintf('The "%s" driver is unavailable at the moment, the fallback driver "%s" has been used instead.', $driver, $fallback), E_USER_WARNING); |
104 | - }else{ |
|
104 | + } else { |
|
105 | 105 | throw new phpFastCacheDriverCheckException($e->getMessage(), $e->getCode(), $e); |
106 | 106 | } |
107 | 107 | } |
108 | - } else if(++$badPracticeOmeter[$driver] >= 5){ |
|
108 | + } else if (++$badPracticeOmeter[$driver] >= 5) { |
|
109 | 109 | trigger_error('[' . $driver . '] Calling many times CacheManager::getInstance() for already instanced drivers is a bad practice and have a significant impact on performances. |
110 | 110 | See https://github.com/PHPSocialNetwork/phpfastcache/wiki/[V5]-Why-calling-getInstance%28%29-each-time-is-a-bad-practice-%3F'); |
111 | 111 | } |
112 | 112 | |
113 | - return self::$instances[ $instance ]; |
|
113 | + return self::$instances[$instance]; |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | /** |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | */ |
144 | 144 | public static function __callStatic($name, $arguments) |
145 | 145 | { |
146 | - $options = (array_key_exists(0, $arguments) && is_array($arguments) ? $arguments[ 0 ] : []); |
|
146 | + $options = (array_key_exists(0, $arguments) && is_array($arguments) ? $arguments[0] : []); |
|
147 | 147 | |
148 | 148 | return self::getInstance($name, $options); |
149 | 149 | } |
@@ -196,9 +196,9 @@ discard block |
||
196 | 196 | { |
197 | 197 | if (is_array($name)) { |
198 | 198 | self::$config = array_merge(self::$config, $name); |
199 | - } else if (is_string($name)){ |
|
200 | - self::$config[ $name ] = $value; |
|
201 | - }else{ |
|
199 | + } else if (is_string($name)) { |
|
200 | + self::$config[$name] = $value; |
|
201 | + } else { |
|
202 | 202 | throw new \InvalidArgumentException('Invalid variable type: $name'); |
203 | 203 | } |
204 | 204 | } |
@@ -95,13 +95,13 @@ discard block |
||
95 | 95 | $class = self::getNamespacePath() . $driver . '\Driver'; |
96 | 96 | try{ |
97 | 97 | self::$instances[ $instance ] = new $class($config); |
98 | - }catch(phpFastCacheDriverCheckException $e){ |
|
98 | + } catch(phpFastCacheDriverCheckException $e){ |
|
99 | 99 | $fallback = self::standardizeDriverName($config['fallback']); |
100 | 100 | if($fallback && $fallback !== $driver){ |
101 | 101 | $class = self::getNamespacePath() . $fallback . '\Driver'; |
102 | 102 | self::$instances[ $instance ] = new $class($config); |
103 | 103 | trigger_error(sprintf('The "%s" driver is unavailable at the moment, the fallback driver "%s" has been used instead.', $driver, $fallback), E_USER_WARNING); |
104 | - }else{ |
|
104 | + } else{ |
|
105 | 105 | throw new phpFastCacheDriverCheckException($e->getMessage(), $e->getCode(), $e); |
106 | 106 | } |
107 | 107 | } |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | self::$config = array_merge(self::$config, $name); |
199 | 199 | } else if (is_string($name)){ |
200 | 200 | self::$config[ $name ] = $value; |
201 | - }else{ |
|
201 | + } else{ |
|
202 | 202 | throw new \InvalidArgumentException('Invalid variable type: $name'); |
203 | 203 | } |
204 | 204 | } |