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