Passed
Push — v7 ( 38b5a4...6da60d )
by Georges
01:42
created
lib/Phpfastcache/Proxy/phpFastCacheAbstractProxy.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
  * @author Georges.L (Geolim4)  <[email protected]>
12 12
  *
13 13
  */
14
-declare(strict_types=1);
14
+declare(strict_types = 1);
15 15
 
16 16
 namespace Phpfastcache\Proxy;
17 17
 
Please login to merge, or discard this patch.
lib/Phpfastcache/CacheManager.php 3 patches
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 use Phpfastcache\Config\ConfigurationOption;
19 19
 use Phpfastcache\Core\Pool\ExtendedCacheItemPoolInterface;
20 20
 use Phpfastcache\Exceptions\{
21
-  phpFastCacheDeprecatedException, phpFastCacheDriverCheckException, phpFastCacheDriverNotFoundException, phpFastCacheInstanceNotFoundException, phpFastCacheInvalidArgumentException, phpFastCacheInvalidConfigurationException
21
+    phpFastCacheDeprecatedException, phpFastCacheDriverCheckException, phpFastCacheDriverNotFoundException, phpFastCacheInstanceNotFoundException, phpFastCacheInvalidArgumentException, phpFastCacheInvalidConfigurationException
22 22
 };
23 23
 
24 24
 /**
@@ -99,8 +99,8 @@  discard block
 block discarded – undo
99 99
         if (is_array($config)) {
100 100
             $config = new ConfigurationOption($config);
101 101
             trigger_error(
102
-              'The CacheManager will drops the support of primitive configuration arrays, use a "\Phpfastcache\Config\ConfigurationOption" object instead',
103
-              E_USER_DEPRECATED
102
+                'The CacheManager will drops the support of primitive configuration arrays, use a "\Phpfastcache\Config\ConfigurationOption" object instead',
103
+                E_USER_DEPRECATED
104 104
             );
105 105
         }elseif ($config === null){
106 106
             $config = self::getDefaultConfig();
@@ -291,27 +291,27 @@  discard block
 block discarded – undo
291 291
          * @todo Reflection reader
292 292
          */
293 293
         return [
294
-          'Apc',
295
-          'Apcu',
296
-          'Cassandra',
297
-          'Couchbase',
298
-          'Couchdb',
299
-          'Devnull',
300
-          'Files',
301
-          'Leveldb',
302
-          'Memcache',
303
-          'Memcached',
304
-          'Memstatic',
305
-          'Mongodb',
306
-          'Predis',
307
-          'Redis',
308
-          'Riak',
309
-          'Ssdb',
310
-          'Sqlite',
311
-          'Wincache',
312
-          'Xcache',
313
-          'Zenddisk',
314
-          'Zendshm',
294
+            'Apc',
295
+            'Apcu',
296
+            'Cassandra',
297
+            'Couchbase',
298
+            'Couchdb',
299
+            'Devnull',
300
+            'Files',
301
+            'Leveldb',
302
+            'Memcache',
303
+            'Memcached',
304
+            'Memstatic',
305
+            'Mongodb',
306
+            'Predis',
307
+            'Redis',
308
+            'Riak',
309
+            'Ssdb',
310
+            'Sqlite',
311
+            'Wincache',
312
+            'Xcache',
313
+            'Zenddisk',
314
+            'Zendshm',
315 315
         ];
316 316
     }
317 317
 
@@ -324,9 +324,9 @@  discard block
 block discarded – undo
324 324
          * @todo Reflection reader
325 325
          */
326 326
         return \array_merge(self::getStaticSystemDrivers(), [
327
-          'Devtrue',
328
-          'Devfalse',
329
-          'Cookie',
327
+            'Devtrue',
328
+            'Devfalse',
329
+            'Cookie',
330 330
         ]);
331 331
     }
332 332
 
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  * @author Georges.L (Geolim4)  <[email protected]>
12 12
  *
13 13
  */
14
-declare(strict_types=1);
14
+declare(strict_types = 1);
15 15
 
16 16
 namespace Phpfastcache;
17 17
 
@@ -102,9 +102,9 @@  discard block
 block discarded – undo
102 102
               'The CacheManager will drops the support of primitive configuration arrays, use a "\Phpfastcache\Config\ConfigurationOption" object instead',
103 103
               E_USER_DEPRECATED
104 104
             );
105
-        }elseif ($config === null){
105
+        }elseif ($config === null) {
106 106
             $config = self::getDefaultConfig();
107
-        }else if(!($config instanceof ConfigurationOption)){
107
+        } else if (!($config instanceof ConfigurationOption)) {
108 108
             throw new phpFastCacheInvalidArgumentException(sprintf('Unsupported config type: %s', gettype($config)));
109 109
         }
110 110
 
@@ -116,14 +116,14 @@  discard block
 block discarded – undo
116 116
 
117 117
         $instance = $instanceId ?: md5($driver . \serialize($config->toArray()));
118 118
 
119
-        if (!isset(self::$instances[ $instance ])) {
120
-            $badPracticeOmeter[ $driver ] = 1;
119
+        if (!isset(self::$instances[$instance])) {
120
+            $badPracticeOmeter[$driver] = 1;
121 121
             $driverClass = self::getNamespacePath() . $driver . '\Driver';
122 122
             try {
123 123
                 if (\class_exists($driverClass)) {
124 124
                     $configClass = $driverClass::getConfigClass();
125
-                    self::$instances[ $instance ] = new $driverClass(new $configClass($config->toArray()), $instance);
126
-                    self::$instances[ $instance ]->setEventManager(EventManager::getInstance());
125
+                    self::$instances[$instance] = new $driverClass(new $configClass($config->toArray()), $instance);
126
+                    self::$instances[$instance]->setEventManager(EventManager::getInstance());
127 127
                 } else {
128 128
                     throw new phpFastCacheDriverNotFoundException(sprintf('The driver "%s" does not exists', $driver));
129 129
                 }
@@ -142,14 +142,14 @@  discard block
 block discarded – undo
142 142
                     throw new phpFastCacheDriverCheckException($e->getMessage(), $e->getCode(), $e);
143 143
                 }
144 144
             }
145
-        } else if ($badPracticeOmeter[ $driver ] >= 2) {
145
+        } else if ($badPracticeOmeter[$driver] >= 2) {
146 146
             trigger_error('[' . $driver . '] Calling many times CacheManager::getInstance() for already instanced drivers is a bad practice and have a significant impact on performances.
147 147
            See https://github.com/PHPSocialNetwork/phpfastcache/wiki/[V5]-Why-calling-getInstance%28%29-each-time-is-a-bad-practice-%3F');
148 148
         }
149 149
 
150
-        $badPracticeOmeter[ $driver ]++;
150
+        $badPracticeOmeter[$driver]++;
151 151
 
152
-        return self::$instances[ $instance ];
152
+        return self::$instances[$instance];
153 153
     }
154 154
 
155 155
     /**
@@ -166,8 +166,8 @@  discard block
 block discarded – undo
166 166
             throw new phpFastCacheInvalidArgumentException('The Instance ID must be a string');
167 167
         }
168 168
 
169
-        if (isset(self::$instances[ $instanceId ])) {
170
-            return self::$instances[ $instanceId ];
169
+        if (isset(self::$instances[$instanceId])) {
170
+            return self::$instances[$instanceId];
171 171
         }
172 172
 
173 173
         throw new phpFastCacheInstanceNotFoundException(sprintf('Instance ID %s not found', $instanceId));
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
      */
235 235
     public static function __callStatic($name, $arguments)
236 236
     {
237
-        $options = (\array_key_exists(0, $arguments) && \is_array($arguments) ? $arguments[ 0 ] : []);
237
+        $options = (\array_key_exists(0, $arguments) && \is_array($arguments) ? $arguments[0] : []);
238 238
 
239 239
         return self::getInstance($name, $options);
240 240
     }
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -102,9 +102,9 @@
 block discarded – undo
102 102
               'The CacheManager will drops the support of primitive configuration arrays, use a "\Phpfastcache\Config\ConfigurationOption" object instead',
103 103
               E_USER_DEPRECATED
104 104
             );
105
-        }elseif ($config === null){
105
+        } elseif ($config === null){
106 106
             $config = self::getDefaultConfig();
107
-        }else if(!($config instanceof ConfigurationOption)){
107
+        } else if(!($config instanceof ConfigurationOption)){
108 108
             throw new phpFastCacheInvalidArgumentException(sprintf('Unsupported config type: %s', gettype($config)));
109 109
         }
110 110
 
Please login to merge, or discard this patch.
lib/Phpfastcache/Core/Item/ItemBaseTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
  * @author Georges.L (Geolim4)  <[email protected]>
12 12
  *
13 13
  */
14
-declare(strict_types=1);
14
+declare(strict_types = 1);
15 15
 
16 16
 namespace Phpfastcache\Core\Item;
17 17
 
Please login to merge, or discard this patch.
lib/Phpfastcache/Core/Item/ExtendedCacheItemInterface.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
 use Phpfastcache\Core\Pool\ExtendedCacheItemPoolInterface;
19 19
 use Phpfastcache\EventManager;
20 20
 use Phpfastcache\Exceptions\{
21
-  phpFastCacheInvalidArgumentException, phpFastCacheLogicException
21
+    phpFastCacheInvalidArgumentException, phpFastCacheLogicException
22 22
 };
23 23
 use Psr\Cache\CacheItemInterface;
24 24
 
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
  * @author Georges.L (Geolim4)  <[email protected]>
12 12
  *
13 13
  */
14
-declare(strict_types=1);
14
+declare(strict_types = 1);
15 15
 
16 16
 namespace Phpfastcache\Core\Item;
17 17
 
Please login to merge, or discard this patch.
lib/Phpfastcache/Core/Item/ItemExtendedTrait.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
 use Phpfastcache\Core\Pool\ExtendedCacheItemPoolInterface;
19 19
 use Phpfastcache\EventManager;
20 20
 use Phpfastcache\Exceptions\{
21
-  phpFastCacheInvalidArgumentException, phpFastCacheInvalidArgumentTypeException, phpFastCacheLogicException
21
+    phpFastCacheInvalidArgumentException, phpFastCacheInvalidArgumentTypeException, phpFastCacheLogicException
22 22
 };
23 23
 
24 24
 /**
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  * @author Georges.L (Geolim4)  <[email protected]>
12 12
  *
13 13
  */
14
-declare(strict_types=1);
14
+declare(strict_types = 1);
15 15
 
16 16
 namespace Phpfastcache\Core\Item;
17 17
 
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
             $this->driver = $driver;
70 70
             $this->driver->setItem($this);
71 71
             $this->expirationDate = new \DateTime();
72
-            if($this->driver->getConfigOption('itemDetailedDate')){
72
+            if ($this->driver->getConfigOption('itemDetailedDate')) {
73 73
                 $this->creationDate = new \DateTime();
74 74
                 $this->modificationDate = new \DateTime();
75 75
             }
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
         if (\is_array($this->data)) {
246 246
             $this->data[] = $data;
247 247
         } else if (\is_string($data)) {
248
-            $this->data .= (string)$data;
248
+            $this->data .= (string) $data;
249 249
         } else {
250 250
             throw new phpFastCacheInvalidArgumentException('$data must be either array nor string.');
251 251
         }
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
         if (\is_array($this->data)) {
265 265
             \array_unshift($this->data, $data);
266 266
         } else if (\is_string($data)) {
267
-            $this->data = (string)$data . $this->data;
267
+            $this->data = (string) $data . $this->data;
268 268
         } else {
269 269
             throw new phpFastCacheInvalidArgumentException('$data must be either array nor string.');
270 270
         }
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
     public function removeTag($tagName): ExtendedCacheItemInterface
344 344
     {
345 345
         if (($key = array_search($tagName, $this->tags)) !== false) {
346
-            unset($this->tags[ $key ]);
346
+            unset($this->tags[$key]);
347 347
             $this->removedTags[] = $tagName;
348 348
         }
349 349
 
@@ -422,8 +422,8 @@  discard block
 block discarded – undo
422 422
     final public function __debugInfo()
423 423
     {
424 424
         $info = \get_object_vars($this);
425
-        $info[ 'driver' ] = 'object(' . \get_class($info[ 'driver' ]) . ')';
425
+        $info['driver'] = 'object(' . \get_class($info['driver']) . ')';
426 426
 
427
-        return (array)$info;
427
+        return (array) $info;
428 428
     }
429 429
 }
430 430
\ No newline at end of file
Please login to merge, or discard this patch.
lib/Phpfastcache/Core/Pool/IO/IOHelperTrait.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -192,9 +192,9 @@  discard block
 block discarded – undo
192 192
     protected static function cleanFileName($filename): string
193 193
     {
194 194
         $regex = [
195
-          '/[\?\[\]\/\\\=\<\>\:\;\,\'\"\&\$\#\*\(\)\|\~\`\!\{\}]/',
196
-          '/\.$/',
197
-          '/^\./',
195
+            '/[\?\[\]\/\\\=\<\>\:\;\,\'\"\&\$\#\*\(\)\|\~\`\!\{\}]/',
196
+            '/\.$/',
197
+            '/^\./',
198 198
         ];
199 199
         $replace = ['-', '', ''];
200 200
 
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
             $tmpFilename = Directory::getAbsolutePath(\dirname($file) . '/tmp_' . \md5(
291 291
                 str_shuffle(\uniqid($this->getDriverName(), false))
292 292
                 . str_shuffle(\uniqid($this->getDriverName(), false))
293
-              ));
293
+                ));
294 294
 
295 295
             $f = fopen($tmpFilename, 'w+');
296 296
             flock($f, LOCK_EX);
@@ -332,11 +332,11 @@  discard block
 block discarded – undo
332 332
         }
333 333
 
334 334
         $stat->setData(\implode(', ', \array_keys($this->itemInstances)))
335
-          ->setRawData([
335
+            ->setRawData([
336 336
             'tmp' => $this->tmp,
337
-          ])
338
-          ->setSize(Directory::dirSize($path))
339
-          ->setInfo('Number of files used to build the cache: ' . Directory::getFileCount($path));
337
+            ])
338
+            ->setSize(Directory::dirSize($path))
339
+            ->setInfo('Number of files used to build the cache: ' . Directory::getFileCount($path));
340 340
 
341 341
         return $stat;
342 342
     }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  * @author Georges.L (Geolim4)  <[email protected]>
12 12
  *
13 13
  */
14
-declare(strict_types=1);
14
+declare(strict_types = 1);
15 15
 
16 16
 namespace Phpfastcache\Core\Pool\IO;
17 17
 
@@ -54,8 +54,8 @@  discard block
 block discarded – undo
54 54
         {
55 55
             $securityKey = \array_key_exists('securityKey', $this->config) ? $this->config->getOption('securityKey') : '';
56 56
             if (!$securityKey || mb_strtolower($securityKey) === 'auto') {
57
-                if (isset($_SERVER[ 'HTTP_HOST' ])) {
58
-                    $securityKey = preg_replace('/^www./', '', \strtolower(\str_replace(':', '_', $_SERVER[ 'HTTP_HOST' ])));
57
+                if (isset($_SERVER['HTTP_HOST'])) {
58
+                    $securityKey = preg_replace('/^www./', '', \strtolower(\str_replace(':', '_', $_SERVER['HTTP_HOST'])));
59 59
                 } else {
60 60
                     $securityKey = ($this->isPHPModule() ? 'web' : 'cli');
61 61
                 }
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
             return $full_path;
99 99
         }
100 100
 
101
-        if (!isset($this->tmp[ $full_path_hash ]) || (!@\file_exists($full_path) || !@\is_writable($full_path))) {
101
+        if (!isset($this->tmp[$full_path_hash]) || (!@\file_exists($full_path) || !@\is_writable($full_path))) {
102 102
             if (!@\file_exists($full_path)) {
103 103
                 @mkdir($full_path, $this->getDefaultChmod(), true);
104 104
             } else if (!@\is_writable($full_path)) {
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
                 throw new phpFastCacheIOException('Path "' . $full_path . '" is not writable, please set a chmod 0777 or any writable permission and make sure to make use of an absolute path !');
124 124
             }
125 125
 
126
-            $this->tmp[ $full_path_hash ] = $full_path;
126
+            $this->tmp[$full_path_hash] = $full_path;
127 127
             $this->htaccessGen($full_path, \array_key_exists('htaccess', $this->config) ? $this->config->getOption('htaccess') : false);
128 128
         }
129 129
 
Please login to merge, or discard this patch.
lib/Phpfastcache/Core/Pool/DriverBaseTrait.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 use Phpfastcache\Config\ConfigurationOption;
19 19
 use Phpfastcache\Core\Item\ExtendedCacheItemInterface;
20 20
 use Phpfastcache\Exceptions\{
21
-  phpFastCacheInvalidArgumentException, phpFastCacheDriverCheckException, phpFastCacheLogicException
21
+    phpFastCacheInvalidArgumentException, phpFastCacheDriverCheckException, phpFastCacheLogicException
22 22
 };
23 23
 use Phpfastcache\Util\ArrayObject;
24 24
 
@@ -161,9 +161,9 @@  discard block
 block discarded – undo
161 161
     public function driverPreWrap(ExtendedCacheItemInterface $item): array
162 162
     {
163 163
         $wrap = [
164
-          self::DRIVER_DATA_WRAPPER_INDEX => $item->get(),
165
-          self::DRIVER_TAGS_WRAPPER_INDEX => $item->getTags(),
166
-          self::DRIVER_EDATE_WRAPPER_INDEX => $item->getExpirationDate(),
164
+            self::DRIVER_DATA_WRAPPER_INDEX => $item->get(),
165
+            self::DRIVER_TAGS_WRAPPER_INDEX => $item->getTags(),
166
+            self::DRIVER_EDATE_WRAPPER_INDEX => $item->getExpirationDate(),
167 167
         ];
168 168
 
169 169
         if ($this->config->getOption('itemDetailedDate')) {
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  * @author Georges.L (Geolim4)  <[email protected]>
12 12
  *
13 13
  */
14
-declare(strict_types=1);
14
+declare(strict_types = 1);
15 15
 
16 16
 namespace Phpfastcache\Core\Pool;
17 17
 
@@ -167,15 +167,15 @@  discard block
 block discarded – undo
167 167
         ];
168 168
 
169 169
         if ($this->config->getOption('itemDetailedDate')) {
170
-            $wrap[ self::DRIVER_MDATE_WRAPPER_INDEX ] = new \DateTime();
170
+            $wrap[self::DRIVER_MDATE_WRAPPER_INDEX] = new \DateTime();
171 171
             /**
172 172
              * If the creation date exists
173 173
              * reuse it else set a new Date
174 174
              */
175
-            $wrap[ self::DRIVER_CDATE_WRAPPER_INDEX ] = $item->getCreationDate() ?: new \DateTime();
175
+            $wrap[self::DRIVER_CDATE_WRAPPER_INDEX] = $item->getCreationDate() ?: new \DateTime();
176 176
         } else {
177
-            $wrap[ self::DRIVER_MDATE_WRAPPER_INDEX ] = null;
178
-            $wrap[ self::DRIVER_CDATE_WRAPPER_INDEX ] = null;
177
+            $wrap[self::DRIVER_MDATE_WRAPPER_INDEX] = null;
178
+            $wrap[self::DRIVER_CDATE_WRAPPER_INDEX] = null;
179 179
         }
180 180
 
181 181
         return $wrap;
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
      */
188 188
     public function driverUnwrapData(array $wrapper)
189 189
     {
190
-        return $wrapper[ self::DRIVER_DATA_WRAPPER_INDEX ];
190
+        return $wrapper[self::DRIVER_DATA_WRAPPER_INDEX];
191 191
     }
192 192
 
193 193
     /**
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
      */
197 197
     public function driverUnwrapTags(array $wrapper)
198 198
     {
199
-        return $wrapper[ self::DRIVER_TAGS_WRAPPER_INDEX ];
199
+        return $wrapper[self::DRIVER_TAGS_WRAPPER_INDEX];
200 200
     }
201 201
 
202 202
 
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
      */
207 207
     public function driverUnwrapEdate(array $wrapper)
208 208
     {
209
-        return $wrapper[ self::DRIVER_EDATE_WRAPPER_INDEX ];
209
+        return $wrapper[self::DRIVER_EDATE_WRAPPER_INDEX];
210 210
     }
211 211
 
212 212
     /**
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
      */
216 216
     public function driverUnwrapCdate(array $wrapper)
217 217
     {
218
-        return $wrapper[ self::DRIVER_CDATE_WRAPPER_INDEX ];
218
+        return $wrapper[self::DRIVER_CDATE_WRAPPER_INDEX];
219 219
     }
220 220
 
221 221
 
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
      */
226 226
     public function driverUnwrapMdate(array $wrapper)
227 227
     {
228
-        return $wrapper[ self::DRIVER_MDATE_WRAPPER_INDEX ];
228
+        return $wrapper[self::DRIVER_MDATE_WRAPPER_INDEX];
229 229
     }
230 230
 
231 231
     /**
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
              * that has slow performances
283 283
              */
284 284
 
285
-            $tagsItem->set(array_merge((array)$data, [$item->getKey() => $expTimestamp]));
285
+            $tagsItem->set(array_merge((array) $data, [$item->getKey() => $expTimestamp]));
286 286
 
287 287
             /**
288 288
              * Set the expiration date
@@ -304,9 +304,9 @@  discard block
 block discarded – undo
304 304
         $tagsItems = $this->getItems($this->getTagKeys($item->getRemovedTags()));
305 305
 
306 306
         foreach ($tagsItems as $tagsItem) {
307
-            $data = (array)$tagsItem->get();
307
+            $data = (array) $tagsItem->get();
308 308
 
309
-            unset($data[ $item->getKey() ]);
309
+            unset($data[$item->getKey()]);
310 310
             $tagsItem->set($data);
311 311
 
312 312
             /**
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
     public static function getConfigClass(): string
388 388
     {
389 389
         $localConfigClass = substr(static::class, 0, strrpos(static::class, '\\')) . '\Config';
390
-        if(\class_exists($localConfigClass) && is_a($localConfigClass, ConfigurationOption::class, true)){
390
+        if (\class_exists($localConfigClass) && is_a($localConfigClass, ConfigurationOption::class, true)) {
391 391
             return $localConfigClass;
392 392
         }
393 393
         return ConfigurationOption::class;
Please login to merge, or discard this patch.
lib/Phpfastcache/Core/Pool/ExtendedCacheItemPoolTrait.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
 use Phpfastcache\Core\Item\ExtendedCacheItemInterface;
19 19
 use Phpfastcache\EventManager;
20 20
 use Phpfastcache\Exceptions\{
21
-  phpFastCacheInvalidArgumentException, phpFastCacheLogicException
21
+    phpFastCacheInvalidArgumentException, phpFastCacheLogicException
22 22
 };
23 23
 use Psr\Cache\CacheItemInterface;
24 24
 
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  * @author Georges.L (Geolim4)  <[email protected]>
12 12
  *
13 13
  */
14
-declare(strict_types=1);
14
+declare(strict_types = 1);
15 15
 
16 16
 namespace Phpfastcache\Core\Pool;
17 17
 
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
      */
33 33
     public function getItemsAsJsonString(array $keys = [], $option = 0, $depth = 512): string
34 34
     {
35
-        $callback = function (CacheItemInterface $item) {
35
+        $callback = function(CacheItemInterface $item) {
36 36
             return $item->get();
37 37
         };
38 38
         return \json_encode(array_map($callback, array_values($this->getItems($keys))), $option, $depth);
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
         if (\is_string($tagName)) {
47 47
             $driverResponse = $this->getItem($this->getTagKey($tagName));
48 48
             if ($driverResponse->isHit()) {
49
-                $items = (array)$driverResponse->get();
49
+                $items = (array) $driverResponse->get();
50 50
 
51 51
                 /**
52 52
                  * getItems() may provides expired item(s)
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
                  *
59 59
                  * #headache
60 60
                  */
61
-                return \array_filter($this->getItems(\array_unique(\array_keys($items))), function (ExtendedCacheItemInterface $item) {
61
+                return \array_filter($this->getItems(\array_unique(\array_keys($items))), function(ExtendedCacheItemInterface $item) {
62 62
                     return $item->isHit();
63 63
                 });
64 64
             }
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 
96 96
         foreach ($items as $key => $item) {
97 97
             if (\array_diff($tagNames, $item->getTags())) {
98
-                unset($items[ $key ]);
98
+                unset($items[$key]);
99 99
             }
100 100
         }
101 101
 
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
      */
109 109
     public function getItemsByTagsAsJsonString(array $tagNames, $option = 0, $depth = 512)
110 110
     {
111
-        $callback = function (CacheItemInterface $item) {
111
+        $callback = function(CacheItemInterface $item) {
112 112
             return $item->get();
113 113
         };
114 114
 
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
      */
380 380
     public function detachItem(CacheItemInterface $item)
381 381
     {
382
-        if (isset($this->itemInstances[ $item->getKey() ])) {
382
+        if (isset($this->itemInstances[$item->getKey()])) {
383 383
             $this->deregisterItem($item);
384 384
         }
385 385
     }
@@ -399,11 +399,11 @@  discard block
 block discarded – undo
399 399
      */
400 400
     public function attachItem(CacheItemInterface $item)
401 401
     {
402
-        if (isset($this->itemInstances[ $item->getKey() ]) && \spl_object_hash($item) !== \spl_object_hash($this->itemInstances[ $item->getKey() ])) {
402
+        if (isset($this->itemInstances[$item->getKey()]) && \spl_object_hash($item) !== \spl_object_hash($this->itemInstances[$item->getKey()])) {
403 403
             throw new phpFastCacheLogicException('The item already exists and cannot be overwritten because the Spl object hash mismatches ! You probably tried to re-attach a detached item which has been already retrieved from cache.');
404 404
         }
405 405
 
406
-        $this->itemInstances[ $item->getKey() ] = $item;
406
+        $this->itemInstances[$item->getKey()] = $item;
407 407
     }
408 408
 
409 409
 
@@ -415,10 +415,10 @@  discard block
 block discarded – undo
415 415
     protected function deregisterItem($item)
416 416
     {
417 417
         if ($item instanceof CacheItemInterface) {
418
-            unset($this->itemInstances[ $item->getKey() ]);
418
+            unset($this->itemInstances[$item->getKey()]);
419 419
 
420 420
         } else if (\is_string($item)) {
421
-            unset($this->itemInstances[ $item ]);
421
+            unset($this->itemInstances[$item]);
422 422
         } else {
423 423
             throw new phpFastCacheInvalidArgumentException('Invalid type for $item variable');
424 424
         }
@@ -445,8 +445,8 @@  discard block
 block discarded – undo
445 445
      */
446 446
     public function isAttached(CacheItemInterface $item)
447 447
     {
448
-        if (isset($this->itemInstances[ $item->getKey() ])) {
449
-            return \spl_object_hash($item) === \spl_object_hash($this->itemInstances[ $item->getKey() ]);
448
+        if (isset($this->itemInstances[$item->getKey()])) {
449
+            return \spl_object_hash($item) === \spl_object_hash($this->itemInstances[$item->getKey()]);
450 450
         }
451 451
         return null;
452 452
     }
@@ -469,8 +469,8 @@  discard block
 block discarded – undo
469 469
      */
470 470
     public function saveMultiple(...$items): bool
471 471
     {
472
-        if (isset($items[ 0 ]) && \is_array($items[ 0 ])) {
473
-            foreach ($items[ 0 ] as $item) {
472
+        if (isset($items[0]) && \is_array($items[0])) {
473
+            foreach ($items[0] as $item) {
474 474
                 $this->save($item);
475 475
             }
476 476
             return true;
Please login to merge, or discard this patch.
lib/Phpfastcache/Core/Pool/CacheItemPoolTrait.php 2 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 use Phpfastcache\Entities\ItemBatch;
22 22
 use Phpfastcache\Util\ClassNamespaceResolverTrait;
23 23
 use Phpfastcache\Exceptions\{
24
-  phpFastCacheInvalidArgumentException, phpFastCacheCoreException, phpFastCacheLogicException
24
+    phpFastCacheInvalidArgumentException, phpFastCacheCoreException, phpFastCacheLogicException
25 25
 };
26 26
 use Phpfastcache\Config\ConfigurationOption;
27 27
 use Psr\Cache\CacheItemInterface;
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
                     if ($driverArray) {
92 92
                         if (!\is_array($driverArray)) {
93 93
                             throw new phpFastCacheCoreException(sprintf('The driverRead method returned an unexpected variable type: %s',
94
-                              \gettype($driverArray)));
94
+                                \gettype($driverArray)));
95 95
                         }
96 96
                         $driverData = $this->driverUnwrapData($driverArray);
97 97
 
@@ -156,9 +156,9 @@  discard block
 block discarded – undo
156 156
                              * Reset the Item
157 157
                              */
158 158
                             $item->set(null)
159
-                              ->expiresAfter(abs((int)$this->getConfig()[ 'defaultTtl' ]))
160
-                              ->setHit(false)
161
-                              ->setTags([]);
159
+                                ->expiresAfter(abs((int)$this->getConfig()[ 'defaultTtl' ]))
160
+                                ->setHit(false)
161
+                                ->setTags([]);
162 162
                             if ($this->getConfigOption( 'itemDetailedDate')) {
163 163
 
164 164
                                 /**
@@ -342,8 +342,8 @@  discard block
 block discarded – undo
342 342
             $class = new \ReflectionClass((new \ReflectionObject($this))->getNamespaceName() . '\Item');
343 343
             $itemBatch = $class->newInstanceArgs([$this, $item->getKey()]);
344 344
             $itemBatch->setEventManager($this->eventManager)
345
-              ->set(new ItemBatch($item->getKey(), new \DateTime()))
346
-              ->expiresAfter($this->getConfigOption('cacheSlamsTimeout'));
345
+                ->set(new ItemBatch($item->getKey(), new \DateTime()))
346
+                ->expiresAfter($this->getConfigOption('cacheSlamsTimeout'));
347 347
 
348 348
             /**
349 349
              * To avoid SPL mismatches
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  * @author Georges.L (Geolim4)  <[email protected]>
12 12
  *
13 13
  */
14
-declare(strict_types=1);
14
+declare(strict_types = 1);
15 15
 
16 16
 namespace Phpfastcache\Core\Pool;
17 17
 
@@ -70,9 +70,9 @@  discard block
 block discarded – undo
70 70
              * due to performance issue on huge
71 71
              * loop dispatching operations
72 72
              */
73
-            if (!isset($this->itemInstances[ $key ])) {
73
+            if (!isset($this->itemInstances[$key])) {
74 74
                 if (preg_match('~([' . preg_quote(self::$unsupportedKeyChars, '~') . ']+)~', $key, $matches)) {
75
-                    throw new phpFastCacheInvalidArgumentException('Unsupported key character detected: "' . $matches[ 1 ] . '". Please check: https://github.com/PHPSocialNetwork/phpfastcache/wiki/%5BV6%5D-Unsupported-characters-in-key-identifiers');
75
+                    throw new phpFastCacheInvalidArgumentException('Unsupported key character detected: "' . $matches[1] . '". Please check: https://github.com/PHPSocialNetwork/phpfastcache/wiki/%5BV6%5D-Unsupported-characters-in-key-identifiers');
76 76
                 }
77 77
 
78 78
                 /**
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
                         }
96 96
                         $driverData = $this->driverUnwrapData($driverArray);
97 97
 
98
-                        if ($this->getConfig()[ 'preventCacheSlams' ]) {
98
+                        if ($this->getConfig()['preventCacheSlams']) {
99 99
                             while ($driverData instanceof ItemBatch) {
100 100
                                 if ($driverData->getItemDate()->getTimestamp() + $this->getConfigOption('cacheSlamsTimeout') < time()) {
101 101
                                     /**
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
                         $item->set($driverData);
130 130
                         $item->expiresAt($this->driverUnwrapEdate($driverArray));
131 131
 
132
-                        if ($this->getConfigOption( 'itemDetailedDate')) {
132
+                        if ($this->getConfigOption('itemDetailedDate')) {
133 133
                             /**
134 134
                              * If the itemDetailedDate has been
135 135
                              * set after caching, we MUST inject
@@ -156,10 +156,10 @@  discard block
 block discarded – undo
156 156
                              * Reset the Item
157 157
                              */
158 158
                             $item->set(null)
159
-                              ->expiresAfter(abs((int)$this->getConfig()[ 'defaultTtl' ]))
159
+                              ->expiresAfter(abs((int) $this->getConfig()['defaultTtl']))
160 160
                               ->setHit(false)
161 161
                               ->setTags([]);
162
-                            if ($this->getConfigOption( 'itemDetailedDate')) {
162
+                            if ($this->getConfigOption('itemDetailedDate')) {
163 163
 
164 164
                                 /**
165 165
                                  * If the itemDetailedDate has been
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
                             $item->setHit(true);
174 174
                         }
175 175
                     } else {
176
-                        $item->expiresAfter(abs((int)$this->getConfig()[ 'defaultTtl' ]));
176
+                        $item->expiresAfter(abs((int) $this->getConfig()['defaultTtl']));
177 177
                     }
178 178
                 }
179 179
             }
@@ -186,9 +186,9 @@  discard block
 block discarded – undo
186 186
          * @param $this ExtendedCacheItemPoolInterface
187 187
          * @param $this ExtendedCacheItemInterface
188 188
          */
189
-        $this->eventManager->dispatch('CacheGetItem', $this, $this->itemInstances[ $key ]);
189
+        $this->eventManager->dispatch('CacheGetItem', $this, $this->itemInstances[$key]);
190 190
 
191
-        return $this->itemInstances[ $key ];
191
+        return $this->itemInstances[$key];
192 192
     }
193 193
 
194 194
     /**
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
     public function setItem(CacheItemInterface $item)
200 200
     {
201 201
         if ($this->getClassNamespace() . '\\Item' === \get_class($item)) {
202
-            $this->itemInstances[ $item->getKey() ] = $item;
202
+            $this->itemInstances[$item->getKey()] = $item;
203 203
 
204 204
             return $this;
205 205
         }
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
     {
217 217
         $collection = [];
218 218
         foreach ($keys as $key) {
219
-            $collection[ $key ] = $this->getItem($key);
219
+            $collection[$key] = $this->getItem($key);
220 220
         }
221 221
 
222 222
         return $collection;
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
             }
304 304
         }
305 305
 
306
-        return (bool)$return;
306
+        return (bool) $return;
307 307
     }
308 308
 
309 309
     /**
@@ -321,9 +321,9 @@  discard block
 block discarded – undo
321 321
          * due to performance issue on huge
322 322
          * loop dispatching operations
323 323
          */
324
-        if (!isset($this->itemInstances[ $item->getKey() ])) {
325
-            $this->itemInstances[ $item->getKey() ] = $item;
326
-        } else if (\spl_object_hash($item) !== \spl_object_hash($this->itemInstances[ $item->getKey() ])) {
324
+        if (!isset($this->itemInstances[$item->getKey()])) {
325
+            $this->itemInstances[$item->getKey()] = $item;
326
+        } else if (\spl_object_hash($item) !== \spl_object_hash($this->itemInstances[$item->getKey()])) {
327 327
             throw new \RuntimeException('Spl object hash mismatches ! You probably tried to save a detached item which has been already retrieved from cache.');
328 328
         }
329 329
 
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
         $this->eventManager->dispatch('CacheSaveItem', $this, $item);
336 336
 
337 337
 
338
-        if ($this->getConfig()[ 'preventCacheSlams' ]) {
338
+        if ($this->getConfig()['preventCacheSlams']) {
339 339
             /**
340 340
              * @var $itemBatch ExtendedCacheItemInterface
341 341
              */
@@ -375,8 +375,8 @@  discard block
 block discarded – undo
375 375
     public function saveDeferred(CacheItemInterface $item)
376 376
     {
377 377
         if (!\array_key_exists($item->getKey(), $this->itemInstances)) {
378
-            $this->itemInstances[ $item->getKey() ] = $item;
379
-        } else if (\spl_object_hash($item) !== \spl_object_hash($this->itemInstances[ $item->getKey() ])) {
378
+            $this->itemInstances[$item->getKey()] = $item;
379
+        } else if (\spl_object_hash($item) !== \spl_object_hash($this->itemInstances[$item->getKey()])) {
380 380
             throw new \RuntimeException('Spl object hash mismatches ! You probably tried to save a detached item which has been already retrieved from cache.');
381 381
         }
382 382
 
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
          */
388 388
         $this->eventManager->dispatch('CacheSaveDeferredItem', $this, $item);
389 389
 
390
-        return $this->deferredList[ $item->getKey() ] = $item;
390
+        return $this->deferredList[$item->getKey()] = $item;
391 391
     }
392 392
 
393 393
     /**
@@ -407,11 +407,11 @@  discard block
 block discarded – undo
407 407
         foreach ($this->deferredList as $key => $item) {
408 408
             $result = $this->save($item);
409 409
             if ($return !== false) {
410
-                unset($this->deferredList[ $key ]);
410
+                unset($this->deferredList[$key]);
411 411
                 $return = $result;
412 412
             }
413 413
         }
414 414
 
415
-        return (bool)$return;
415
+        return (bool) $return;
416 416
     }
417 417
 }
418 418
\ No newline at end of file
Please login to merge, or discard this patch.