Completed
Push — V6 ( c84d93...e1be50 )
by Georges
02:30
created
src/phpFastCache/CacheManager.php 2 patches
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -56,18 +56,18 @@  discard block
 block discarded – undo
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
-      'autoTmpFallback' => false, // Automatically attempt to fallback to the temporary directory if the cache fails to write to the specified directory
61
-      'secureFileManipulation' => false, // Provide a secure file manipulation mechanism; on intensive usage the performance can be negatively affected.
62
-      'ignoreSymfonyNotice' => false, // Ignore Symfony notices for Symfony projects that do not makes use of PhpFastCache's Symfony Bundle
63
-      'defaultTtl' => 900, // Default time-to-live in seconds
64
-      'securityKey' => 'auto', // The securityKey that will be used to create the sub-directory
65
-      'htaccess' => true, // Auto-generate .htaccess if it is missing
66
-      'default_chmod' => 0777, // 0777 is recommended
67
-      'path' => '', // If not set will be the value of sys_get_temp_dir()
68
-      'fallback' => false, // Fall back when old driver is not supported
69
-      'limited_memory_each_object' => 4096, // Maximum size (bytes) of object store in memory
70
-      '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
+        'autoTmpFallback' => false, // Automatically attempt to fallback to the temporary directory if the cache fails to write to the specified directory
61
+        'secureFileManipulation' => false, // Provide a secure file manipulation mechanism; on intensive usage the performance can be negatively affected.
62
+        'ignoreSymfonyNotice' => false, // Ignore Symfony notices for Symfony projects that do not makes use of PhpFastCache's Symfony Bundle
63
+        'defaultTtl' => 900, // Default time-to-live in seconds
64
+        'securityKey' => 'auto', // The securityKey that will be used to create the sub-directory
65
+        'htaccess' => true, // Auto-generate .htaccess if it is missing
66
+        'default_chmod' => 0777, // 0777 is recommended
67
+        'path' => '', // If not set will be the value of sys_get_temp_dir()
68
+        'fallback' => false, // Fall back when old driver is not supported
69
+        'limited_memory_each_object' => 4096, // Maximum size (bytes) of object store in memory
70
+        'compress_data' => false, // Compress stored data if the backend supports it
71 71
     ];
72 72
 
73 73
     /**
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
                 }
122 122
             }
123 123
         } else if(++$badPracticeOmeter[$driver] >= 5){
124
-           trigger_error('[' . $driver . '] Calling many times CacheManager::getInstance() for already instanced drivers is a bad practice and have a significant impact on performances.
124
+            trigger_error('[' . $driver . '] Calling many times CacheManager::getInstance() for already instanced drivers is a bad practice and have a significant impact on performances.
125 125
            See https://github.com/PHPSocialNetwork/phpfastcache/wiki/[V5]-Why-calling-getInstance%28%29-each-time-is-a-bad-practice-%3F');
126 126
         }
127 127
 
@@ -248,23 +248,23 @@  discard block
 block discarded – undo
248 248
     public static function getStaticSystemDrivers()
249 249
     {
250 250
         return [
251
-          'Apc',
252
-          'Apcu',
253
-          'Cassandra',
254
-          'Couchbase',
255
-          'Devnull',
256
-          'Files',
257
-          'Leveldb',
258
-          'Memcache',
259
-          'Memcached',
260
-          'Memstatic',
261
-          'Mongodb',
262
-          'Predis',
263
-          'Redis',
264
-          'Ssdb',
265
-          'Sqlite',
266
-          'Wincache',
267
-          'Xcache',
251
+            'Apc',
252
+            'Apcu',
253
+            'Cassandra',
254
+            'Couchbase',
255
+            'Devnull',
256
+            'Files',
257
+            'Leveldb',
258
+            'Memcache',
259
+            'Memcached',
260
+            'Memstatic',
261
+            'Mongodb',
262
+            'Predis',
263
+            'Redis',
264
+            'Ssdb',
265
+            'Sqlite',
266
+            'Wincache',
267
+            'Xcache',
268 268
         ];
269 269
     }
270 270
 
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -100,32 +100,32 @@  discard block
 block discarded – undo
100 100
         }
101 101
 
102 102
         $instance = crc32($driver . serialize($config));
103
-        if (!isset(self::$instances[ $instance ])) {
103
+        if (!isset(self::$instances[$instance])) {
104 104
             $badPracticeOmeter[$driver] = 1;
105
-            if(!$config['ignoreSymfonyNotice'] && interface_exists('Symfony\Component\HttpKernel\KernelInterface') && !class_exists('phpFastCache\Bundle\phpFastCacheBundle')){
105
+            if (!$config['ignoreSymfonyNotice'] && interface_exists('Symfony\Component\HttpKernel\KernelInterface') && !class_exists('phpFastCache\Bundle\phpFastCacheBundle')) {
106 106
                 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);
107 107
             }
108 108
             $class = self::getNamespacePath() . $driver . '\Driver';
109
-            try{
110
-                self::$instances[ $instance ] = new $class($config);
111
-                self::$instances[ $instance ]->setEventManager(EventManager::getInstance());
112
-            }catch(phpFastCacheDriverCheckException $e){
109
+            try {
110
+                self::$instances[$instance] = new $class($config);
111
+                self::$instances[$instance]->setEventManager(EventManager::getInstance());
112
+            } catch (phpFastCacheDriverCheckException $e) {
113 113
                 $fallback = self::standardizeDriverName($config['fallback']);
114
-                if($fallback && $fallback !== $driver){
114
+                if ($fallback && $fallback !== $driver) {
115 115
                     $class = self::getNamespacePath() . $fallback . '\Driver';
116
-                    self::$instances[ $instance ] = new $class($config);
117
-                    self::$instances[ $instance ]->setEventManager(EventManager::getInstance());
116
+                    self::$instances[$instance] = new $class($config);
117
+                    self::$instances[$instance]->setEventManager(EventManager::getInstance());
118 118
                     trigger_error(sprintf('The "%s" driver is unavailable at the moment, the fallback driver "%s" has been used instead.', $driver, $fallback), E_USER_WARNING);
119
-                }else{
119
+                } else {
120 120
                     throw new phpFastCacheDriverCheckException($e->getMessage(), $e->getCode(), $e);
121 121
                 }
122 122
             }
123
-        } else if(++$badPracticeOmeter[$driver] >= 5){
123
+        } else if (++$badPracticeOmeter[$driver] >= 5) {
124 124
            trigger_error('[' . $driver . '] Calling many times CacheManager::getInstance() for already instanced drivers is a bad practice and have a significant impact on performances.
125 125
            See https://github.com/PHPSocialNetwork/phpfastcache/wiki/[V5]-Why-calling-getInstance%28%29-each-time-is-a-bad-practice-%3F');
126 126
         }
127 127
 
128
-        return self::$instances[ $instance ];
128
+        return self::$instances[$instance];
129 129
     }
130 130
 
131 131
     /**
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
      */
187 187
     public static function __callStatic($name, $arguments)
188 188
     {
189
-        $options = (array_key_exists(0, $arguments) && is_array($arguments) ? $arguments[ 0 ] : []);
189
+        $options = (array_key_exists(0, $arguments) && is_array($arguments) ? $arguments[0] : []);
190 190
 
191 191
         return self::getInstance($name, $options);
192 192
     }
@@ -227,9 +227,9 @@  discard block
 block discarded – undo
227 227
     {
228 228
         if (is_array($name)) {
229 229
             self::$config = array_merge(self::$config, $name);
230
-        } else if (is_string($name)){
231
-            self::$config[ $name ] = $value;
232
-        }else{
230
+        } else if (is_string($name)) {
231
+            self::$config[$name] = $value;
232
+        } else {
233 233
             throw new phpFastCacheInvalidArgumentException('Invalid variable type: $name');
234 234
         }
235 235
     }
Please login to merge, or discard this patch.