@@ -56,17 +56,17 @@ discard block |
||
56 | 56 | * @var ExtendedCacheItemPoolInterface[] |
57 | 57 | */ |
58 | 58 | protected static $config = [ |
59 | - 'itemDetailedDate' => false,// Specify if the item must provide detailed creation/modification dates |
|
60 | - 'secureFileManipulation' => false,// Provide a secure file manipulation mechanism, on intensive usage the performance can be affected. |
|
61 | - 'ignoreSymfonyNotice' => false,// Ignore Symfony notice for Symfony project which do not makes use of PhpFastCache's Symfony Bundle |
|
62 | - 'defaultTtl' => 900,// Default time-to-live in second |
|
63 | - 'securityKey' => 'auto',// The securityKey that will be used to create sub-directory |
|
64 | - 'htaccess' => true,// Auto-generate .htaccess if tit is missing |
|
65 | - 'default_chmod' => 0777, // 0777 recommended |
|
66 | - 'path' => '',// if not set will be the value of sys_get_temp_dir() |
|
67 | - 'fallback' => false, //Fall back when old driver is not support |
|
68 | - 'limited_memory_each_object' => 4096, // maximum size (bytes) of object store in memory |
|
69 | - 'compress_data' => false, // compress stored data, if the backend supports it |
|
59 | + 'itemDetailedDate' => false,// Specify if the item must provide detailed creation/modification dates |
|
60 | + 'secureFileManipulation' => false,// Provide a secure file manipulation mechanism, on intensive usage the performance can be affected. |
|
61 | + 'ignoreSymfonyNotice' => false,// Ignore Symfony notice for Symfony project which do not makes use of PhpFastCache's Symfony Bundle |
|
62 | + 'defaultTtl' => 900,// Default time-to-live in second |
|
63 | + 'securityKey' => 'auto',// The securityKey that will be used to create sub-directory |
|
64 | + 'htaccess' => true,// Auto-generate .htaccess if tit is missing |
|
65 | + 'default_chmod' => 0777, // 0777 recommended |
|
66 | + 'path' => '',// if not set will be the value of sys_get_temp_dir() |
|
67 | + 'fallback' => false, //Fall back when old driver is not support |
|
68 | + 'limited_memory_each_object' => 4096, // maximum size (bytes) of object store in memory |
|
69 | + 'compress_data' => false, // compress stored data, if the backend supports it |
|
70 | 70 | ]; |
71 | 71 | |
72 | 72 | /** |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | } |
121 | 121 | } |
122 | 122 | } else if(++$badPracticeOmeter[$driver] >= 5){ |
123 | - trigger_error('[' . $driver . '] Calling many times CacheManager::getInstance() for already instanced drivers is a bad practice and have a significant impact on performances. |
|
123 | + trigger_error('[' . $driver . '] Calling many times CacheManager::getInstance() for already instanced drivers is a bad practice and have a significant impact on performances. |
|
124 | 124 | See https://github.com/PHPSocialNetwork/phpfastcache/wiki/[V5]-Why-calling-getInstance%28%29-each-time-is-a-bad-practice-%3F'); |
125 | 125 | } |
126 | 126 | |
@@ -259,21 +259,21 @@ discard block |
||
259 | 259 | public static function getStaticSystemDrivers() |
260 | 260 | { |
261 | 261 | return [ |
262 | - 'Sqlite', |
|
263 | - 'Files', |
|
264 | - 'Apc', |
|
265 | - 'Apcu', |
|
266 | - 'Memcache', |
|
267 | - 'Memcached', |
|
268 | - 'Couchbase', |
|
269 | - 'Mongodb', |
|
270 | - 'Predis', |
|
271 | - 'Redis', |
|
272 | - 'Ssdb', |
|
273 | - 'Leveldb', |
|
274 | - 'Wincache', |
|
275 | - 'Xcache', |
|
276 | - 'Devnull', |
|
262 | + 'Sqlite', |
|
263 | + 'Files', |
|
264 | + 'Apc', |
|
265 | + 'Apcu', |
|
266 | + 'Memcache', |
|
267 | + 'Memcached', |
|
268 | + 'Couchbase', |
|
269 | + 'Mongodb', |
|
270 | + 'Predis', |
|
271 | + 'Redis', |
|
272 | + 'Ssdb', |
|
273 | + 'Leveldb', |
|
274 | + 'Wincache', |
|
275 | + 'Xcache', |
|
276 | + 'Devnull', |
|
277 | 277 | ]; |
278 | 278 | } |
279 | 279 |
@@ -56,14 +56,14 @@ discard block |
||
56 | 56 | * @var ExtendedCacheItemPoolInterface[] |
57 | 57 | */ |
58 | 58 | protected static $config = [ |
59 | - 'itemDetailedDate' => false,// Specify if the item must provide detailed creation/modification dates |
|
60 | - 'secureFileManipulation' => false,// Provide a secure file manipulation mechanism, on intensive usage the performance can be affected. |
|
61 | - 'ignoreSymfonyNotice' => false,// Ignore Symfony notice for Symfony project which do not makes use of PhpFastCache's Symfony Bundle |
|
62 | - 'defaultTtl' => 900,// Default time-to-live in second |
|
63 | - 'securityKey' => 'auto',// The securityKey that will be used to create sub-directory |
|
64 | - 'htaccess' => true,// Auto-generate .htaccess if tit is missing |
|
59 | + 'itemDetailedDate' => false, // Specify if the item must provide detailed creation/modification dates |
|
60 | + 'secureFileManipulation' => false, // Provide a secure file manipulation mechanism, on intensive usage the performance can be affected. |
|
61 | + 'ignoreSymfonyNotice' => false, // Ignore Symfony notice for Symfony project which do not makes use of PhpFastCache's Symfony Bundle |
|
62 | + 'defaultTtl' => 900, // Default time-to-live in second |
|
63 | + 'securityKey' => 'auto', // The securityKey that will be used to create sub-directory |
|
64 | + 'htaccess' => true, // Auto-generate .htaccess if tit is missing |
|
65 | 65 | 'default_chmod' => 0777, // 0777 recommended |
66 | - 'path' => '',// if not set will be the value of sys_get_temp_dir() |
|
66 | + 'path' => '', // if not set will be the value of sys_get_temp_dir() |
|
67 | 67 | 'fallback' => false, //Fall back when old driver is not support |
68 | 68 | 'limited_memory_each_object' => 4096, // maximum size (bytes) of object store in memory |
69 | 69 | 'compress_data' => false, // compress stored data, if the backend supports it |
@@ -99,32 +99,32 @@ discard block |
||
99 | 99 | } |
100 | 100 | |
101 | 101 | $instance = crc32($driver . serialize($config)); |
102 | - if (!isset(self::$instances[ $instance ])) { |
|
102 | + if (!isset(self::$instances[$instance])) { |
|
103 | 103 | $badPracticeOmeter[$driver] = 1; |
104 | - if(!$config['ignoreSymfonyNotice'] && interface_exists('Symfony\Component\HttpKernel\KernelInterface') && !class_exists('phpFastCache\Bundle\phpFastCacheBundle')){ |
|
104 | + if (!$config['ignoreSymfonyNotice'] && interface_exists('Symfony\Component\HttpKernel\KernelInterface') && !class_exists('phpFastCache\Bundle\phpFastCacheBundle')) { |
|
105 | 105 | trigger_error('A Symfony Bundle to make the PhpFastCache integration more easier is now available here: https://github.com/PHPSocialNetwork/phpfastcache-bundle', E_USER_NOTICE); |
106 | 106 | } |
107 | 107 | $class = self::getNamespacePath() . $driver . '\Driver'; |
108 | - try{ |
|
109 | - self::$instances[ $instance ] = new $class($config); |
|
110 | - self::$instances[ $instance ]->setEventManager(EventManager::getInstance()); |
|
111 | - }catch(phpFastCacheDriverCheckException $e){ |
|
108 | + try { |
|
109 | + self::$instances[$instance] = new $class($config); |
|
110 | + self::$instances[$instance]->setEventManager(EventManager::getInstance()); |
|
111 | + } catch (phpFastCacheDriverCheckException $e) { |
|
112 | 112 | $fallback = self::standardizeDriverName($config['fallback']); |
113 | - if($fallback && $fallback !== $driver){ |
|
113 | + if ($fallback && $fallback !== $driver) { |
|
114 | 114 | $class = self::getNamespacePath() . $fallback . '\Driver'; |
115 | - self::$instances[ $instance ] = new $class($config); |
|
116 | - self::$instances[ $instance ]->setEventManager(EventManager::getInstance()); |
|
115 | + self::$instances[$instance] = new $class($config); |
|
116 | + self::$instances[$instance]->setEventManager(EventManager::getInstance()); |
|
117 | 117 | trigger_error(sprintf('The "%s" driver is unavailable at the moment, the fallback driver "%s" has been used instead.', $driver, $fallback), E_USER_WARNING); |
118 | - }else{ |
|
118 | + } else { |
|
119 | 119 | throw new phpFastCacheDriverCheckException($e->getMessage(), $e->getCode(), $e); |
120 | 120 | } |
121 | 121 | } |
122 | - } else if(++$badPracticeOmeter[$driver] >= 5){ |
|
122 | + } else if (++$badPracticeOmeter[$driver] >= 5) { |
|
123 | 123 | trigger_error('[' . $driver . '] Calling many times CacheManager::getInstance() for already instanced drivers is a bad practice and have a significant impact on performances. |
124 | 124 | See https://github.com/PHPSocialNetwork/phpfastcache/wiki/[V5]-Why-calling-getInstance%28%29-each-time-is-a-bad-practice-%3F'); |
125 | 125 | } |
126 | 126 | |
127 | - return self::$instances[ $instance ]; |
|
127 | + return self::$instances[$instance]; |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | /** |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | */ |
186 | 186 | public static function __callStatic($name, $arguments) |
187 | 187 | { |
188 | - $options = (array_key_exists(0, $arguments) && is_array($arguments) ? $arguments[ 0 ] : []); |
|
188 | + $options = (array_key_exists(0, $arguments) && is_array($arguments) ? $arguments[0] : []); |
|
189 | 189 | |
190 | 190 | return self::getInstance($name, $options); |
191 | 191 | } |
@@ -238,9 +238,9 @@ discard block |
||
238 | 238 | { |
239 | 239 | if (is_array($name)) { |
240 | 240 | self::$config = array_merge(self::$config, $name); |
241 | - } else if (is_string($name)){ |
|
242 | - self::$config[ $name ] = $value; |
|
243 | - }else{ |
|
241 | + } else if (is_string($name)) { |
|
242 | + self::$config[$name] = $value; |
|
243 | + } else { |
|
244 | 244 | throw new \InvalidArgumentException('Invalid variable type: $name'); |
245 | 245 | } |
246 | 246 | } |