@@ -97,30 +97,30 @@ discard block |
||
97 | 97 | } |
98 | 98 | |
99 | 99 | $instance = crc32($driver . serialize($config)); |
100 | - if (!isset(self::$instances[ $instance ])) { |
|
100 | + if (!isset(self::$instances[$instance])) { |
|
101 | 101 | $badPracticeOmeter[$driver] = 1; |
102 | - if(!$config['ignoreSymfonyNotice'] && interface_exists('Symfony\Component\HttpKernel\KernelInterface') && !class_exists('phpFastCache\Bundle\phpFastCacheBundle')){ |
|
102 | + if (!$config['ignoreSymfonyNotice'] && interface_exists('Symfony\Component\HttpKernel\KernelInterface') && !class_exists('phpFastCache\Bundle\phpFastCacheBundle')) { |
|
103 | 103 | 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); |
104 | 104 | } |
105 | 105 | $class = self::getNamespacePath() . $driver . '\Driver'; |
106 | - try{ |
|
107 | - self::$instances[ $instance ] = new $class($config); |
|
108 | - }catch(phpFastCacheDriverCheckException $e){ |
|
106 | + try { |
|
107 | + self::$instances[$instance] = new $class($config); |
|
108 | + } catch (phpFastCacheDriverCheckException $e) { |
|
109 | 109 | $fallback = self::standardizeDriverName($config['fallback']); |
110 | - if($fallback && $fallback !== $driver){ |
|
110 | + if ($fallback && $fallback !== $driver) { |
|
111 | 111 | $class = self::getNamespacePath() . $fallback . '\Driver'; |
112 | - self::$instances[ $instance ] = new $class($config); |
|
112 | + self::$instances[$instance] = new $class($config); |
|
113 | 113 | trigger_error(sprintf('The "%s" driver is unavailable at the moment, the fallback driver "%s" has been used instead.', $driver, $fallback), E_USER_WARNING); |
114 | - }else{ |
|
114 | + } else { |
|
115 | 115 | throw new phpFastCacheDriverCheckException($e->getMessage(), $e->getCode(), $e); |
116 | 116 | } |
117 | 117 | } |
118 | - } else if(++$badPracticeOmeter[$driver] >= 5){ |
|
118 | + } else if (++$badPracticeOmeter[$driver] >= 5) { |
|
119 | 119 | trigger_error('[' . $driver . '] Calling many times CacheManager::getInstance() for already instanced drivers is a bad practice and have a significant impact on performances. |
120 | 120 | See https://github.com/PHPSocialNetwork/phpfastcache/wiki/[V5]-Why-calling-getInstance%28%29-each-time-is-a-bad-practice-%3F'); |
121 | 121 | } |
122 | 122 | |
123 | - return self::$instances[ $instance ]; |
|
123 | + return self::$instances[$instance]; |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | /** |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | */ |
154 | 154 | public static function __callStatic($name, $arguments) |
155 | 155 | { |
156 | - $options = (array_key_exists(0, $arguments) && is_array($arguments) ? $arguments[ 0 ] : []); |
|
156 | + $options = (array_key_exists(0, $arguments) && is_array($arguments) ? $arguments[0] : []); |
|
157 | 157 | |
158 | 158 | return self::getInstance($name, $options); |
159 | 159 | } |
@@ -206,9 +206,9 @@ discard block |
||
206 | 206 | { |
207 | 207 | if (is_array($name)) { |
208 | 208 | self::$config = array_merge(self::$config, $name); |
209 | - } else if (is_string($name)){ |
|
210 | - self::$config[ $name ] = $value; |
|
211 | - }else{ |
|
209 | + } else if (is_string($name)) { |
|
210 | + self::$config[$name] = $value; |
|
211 | + } else { |
|
212 | 212 | throw new \InvalidArgumentException('Invalid variable type: $name'); |
213 | 213 | } |
214 | 214 | } |