Completed
Branch final (dadb0d)
by Georges
02:41
created
src/phpFastCache/Core/StandardPsr6StructureTrait.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
                         $item->setHit(true);
70 70
                     }
71 71
                 } else {
72
-                    $item->expiresAfter(abs((int) $this->getConfig()[ 'defaultTtl' ]));
72
+                    $item->expiresAfter(abs((int) $this->getConfig()['defaultTtl']));
73 73
                 }
74 74
 
75 75
             }
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
             throw new \InvalidArgumentException(sprintf('$key must be a string, got type "%s" instead.', gettype($key)));
78 78
         }
79 79
 
80
-        return $this->itemInstances[ $key ];
80
+        return $this->itemInstances[$key];
81 81
     }
82 82
 
83 83
     /**
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
     public function setItem(CacheItemInterface $item)
89 89
     {
90 90
         if ($this->getClassNamespace() . '\\Item' === get_class($item)) {
91
-            $this->itemInstances[ $item->getKey() ] = $item;
91
+            $this->itemInstances[$item->getKey()] = $item;
92 92
 
93 93
             return $this;
94 94
         } else {
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
     {
106 106
         $collection = [];
107 107
         foreach ($keys as $key) {
108
-            $collection[ $key ] = $this->getItem($key);
108
+            $collection[$key] = $this->getItem($key);
109 109
         }
110 110
 
111 111
         return $collection;
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
         if ($this->hasItem($key) && $this->driverDelete($item)) {
146 146
             $item->setHit(false);
147 147
             CacheManager::$WriteHits++;
148
-            unset($this->itemInstances[ $key ]);
148
+            unset($this->itemInstances[$key]);
149 149
 
150 150
             return true;
151 151
         }
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
          * @var ExtendedCacheItemInterface $item
183 183
          */
184 184
         if (!array_key_exists($item->getKey(), $this->itemInstances)) {
185
-            $this->itemInstances[ $item->getKey() ] = $item;
185
+            $this->itemInstances[$item->getKey()] = $item;
186 186
         }
187 187
         if ($this->driverWrite($item) && $this->driverWriteTags($item)) {
188 188
             $item->setHit(true);
@@ -201,10 +201,10 @@  discard block
 block discarded – undo
201 201
     public function saveDeferred(CacheItemInterface $item)
202 202
     {
203 203
         if (!array_key_exists($item->getKey(), $this->itemInstances)) {
204
-            $this->itemInstances[ $item->getKey() ] = $item;
204
+            $this->itemInstances[$item->getKey()] = $item;
205 205
         }
206 206
 
207
-        return $this->deferredList[ $item->getKey() ] = $item;
207
+        return $this->deferredList[$item->getKey()] = $item;
208 208
     }
209 209
 
210 210
     /**
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
         foreach ($this->deferredList as $key => $item) {
218 218
             $result = $this->save($item);
219 219
             if ($return !== false) {
220
-                unset($this->deferredList[ $key ]);
220
+                unset($this->deferredList[$key]);
221 221
                 $return = $result;
222 222
             }
223 223
         }
Please login to merge, or discard this patch.
src/phpFastCache/CacheManager.php 2 patches
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -51,14 +51,14 @@  discard block
 block discarded – undo
51 51
      * @var array
52 52
      */
53 53
     protected static $config = [
54
-      'securityKey' => 'auto',// The securityKey that will be used to create sub-directory
55
-      'defaultTtl' => 900,// Default time-to-live in second
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
54
+        'securityKey' => 'auto',// The securityKey that will be used to create sub-directory
55
+        'defaultTtl' => 900,// Default time-to-live in second
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
 block discarded – undo
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
 
@@ -219,21 +219,21 @@  discard block
 block discarded – undo
219 219
     public static function getStaticSystemDrivers()
220 220
     {
221 221
         return [
222
-          'Sqlite',
223
-          'Files',
224
-          'Apc',
225
-          'Apcu',
226
-          'Memcache',
227
-          'Memcached',
228
-          'Couchbase',
229
-          'Mongodb',
230
-          'Predis',
231
-          'Redis',
232
-          'Ssdb',
233
-          'Leveldb',
234
-          'Wincache',
235
-          'Xcache',
236
-          'Devnull',
222
+            'Sqlite',
223
+            'Files',
224
+            'Apc',
225
+            'Apcu',
226
+            'Memcache',
227
+            'Memcached',
228
+            'Couchbase',
229
+            'Mongodb',
230
+            'Predis',
231
+            'Redis',
232
+            'Ssdb',
233
+            'Leveldb',
234
+            'Wincache',
235
+            'Xcache',
236
+            'Devnull',
237 237
         ];
238 238
     }
239 239
 
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -51,11 +51,11 @@  discard block
 block discarded – undo
51 51
      * @var array
52 52
      */
53 53
     protected static $config = [
54
-      'securityKey' => 'auto',// The securityKey that will be used to create sub-directory
55
-      'defaultTtl' => 900,// Default time-to-live in second
56
-      'htaccess' => true,// Auto-generate .htaccess if tit is missing
54
+      'securityKey' => 'auto', // The securityKey that will be used to create sub-directory
55
+      'defaultTtl' => 900, // Default time-to-live in second
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
 block discarded – undo
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
 block discarded – undo
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
     }
@@ -198,9 +198,9 @@  discard block
 block discarded – undo
198 198
     {
199 199
         if (is_array($name)) {
200 200
             self::$config = array_merge(self::$config, $name);
201
-        } else if (is_string($name)){
202
-            self::$config[ $name ] = $value;
203
-        }else{
201
+        } else if (is_string($name)) {
202
+            self::$config[$name] = $value;
203
+        } else {
204 204
             throw new \InvalidArgumentException('Invalid variable type: $name');
205 205
         }
206 206
     }
Please login to merge, or discard this patch.