Passed
Push — v7 ( 9a759d...c62002 )
by Georges
01:34
created
lib/Phpfastcache/CacheManager.php 2 patches
Indentation   +36 added lines, -36 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
-  PhpfastcacheDriverCheckException, PhpfastcacheDriverException, PhpfastcacheDriverNotFoundException, PhpfastcacheInstanceNotFoundException, PhpfastcacheInvalidArgumentException, PhpfastcacheInvalidConfigurationException, PhpfastcacheLogicException, PhpfastcacheUnsupportedOperationException
21
+    PhpfastcacheDriverCheckException, PhpfastcacheDriverException, PhpfastcacheDriverNotFoundException, PhpfastcacheInstanceNotFoundException, PhpfastcacheInvalidArgumentException, PhpfastcacheInvalidConfigurationException, PhpfastcacheLogicException, PhpfastcacheUnsupportedOperationException
22 22
 };
23 23
 use Phpfastcache\Util\ClassNamespaceResolverTrait;
24 24
 
@@ -115,8 +115,8 @@  discard block
 block discarded – undo
115 115
         if (\is_array($config)) {
116 116
             $config = new ConfigurationOption($config);
117 117
             \trigger_error(
118
-              'The CacheManager will drops the support of primitive configuration arrays, use a "\Phpfastcache\Config\ConfigurationOption" object instead',
119
-              E_USER_DEPRECATED
118
+                'The CacheManager will drops the support of primitive configuration arrays, use a "\Phpfastcache\Config\ConfigurationOption" object instead',
119
+                E_USER_DEPRECATED
120 120
             );
121 121
         } elseif ($config === null) {
122 122
             $config = self::getDefaultConfig();
@@ -138,9 +138,9 @@  discard block
 block discarded – undo
138 138
 
139 139
             if (!is_a($driverClass, ExtendedCacheItemPoolInterface::class, true)) {
140 140
                 throw new PhpfastcacheDriverException(\sprintf(
141
-                  'Class "%s" does not implement "%s"',
142
-                  $driverClass,
143
-                  ExtendedCacheItemPoolInterface::class
141
+                    'Class "%s" does not implement "%s"',
142
+                    $driverClass,
143
+                    ExtendedCacheItemPoolInterface::class
144 144
                 ));
145 145
             }
146 146
             try {
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
                         $fallback = $config->getFallback();
158 158
                         $config->setFallback('');
159 159
                         \trigger_error(\sprintf('The "%s" driver is unavailable at the moment, the fallback driver "%s" has been used instead.', $driver,
160
-                          $fallback), E_USER_WARNING);
160
+                            $fallback), E_USER_WARNING);
161 161
                         return self::getInstance($fallback, $config->getFallbackConfig());
162 162
                     } catch (PhpfastcacheInvalidArgumentException $e) {
163 163
                         throw new PhpfastcacheInvalidConfigurationException('Invalid fallback driver configuration', 0, $e);
@@ -332,29 +332,29 @@  discard block
 block discarded – undo
332 332
     public static function getStaticSystemDrivers(): array
333 333
     {
334 334
         \trigger_error(\sprintf('Method "%s" is deprecated as of the V7 and will be removed soon or later, use CacheManager::getDriverList() instead.',
335
-          __METHOD__), E_USER_DEPRECATED);
335
+            __METHOD__), E_USER_DEPRECATED);
336 336
         return [
337
-          'Apc',
338
-          'Apcu',
339
-          'Cassandra',
340
-          'Couchbase',
341
-          'Couchdb',
342
-          'Devnull',
343
-          'Files',
344
-          'Leveldb',
345
-          'Memcache',
346
-          'Memcached',
347
-          'Memstatic',
348
-          'Mongodb',
349
-          'Predis',
350
-          'Redis',
351
-          'Riak',
352
-          'Ssdb',
353
-          'Sqlite',
354
-          'Wincache',
355
-          'Xcache',
356
-          'Zenddisk',
357
-          'Zendshm',
337
+            'Apc',
338
+            'Apcu',
339
+            'Cassandra',
340
+            'Couchbase',
341
+            'Couchdb',
342
+            'Devnull',
343
+            'Files',
344
+            'Leveldb',
345
+            'Memcache',
346
+            'Memcached',
347
+            'Memstatic',
348
+            'Mongodb',
349
+            'Predis',
350
+            'Redis',
351
+            'Riak',
352
+            'Ssdb',
353
+            'Sqlite',
354
+            'Wincache',
355
+            'Xcache',
356
+            'Zenddisk',
357
+            'Zendshm',
358 358
         ];
359 359
     }
360 360
 
@@ -365,11 +365,11 @@  discard block
 block discarded – undo
365 365
     public static function getStaticAllDrivers(): array
366 366
     {
367 367
         \trigger_error(\sprintf('Method "%s" is deprecated as of the V7 and will be removed soon or later, use CacheManager::getDriverList() instead.',
368
-          __METHOD__), E_USER_DEPRECATED);
368
+            __METHOD__), E_USER_DEPRECATED);
369 369
         return \array_merge(self::getStaticSystemDrivers(), [
370
-          'Devtrue',
371
-          'Devfalse',
372
-          'Cookie',
370
+            'Devtrue',
371
+            'Devfalse',
372
+            'Cookie',
373 373
         ]);
374 374
     }
375 375
 
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
 
449 449
         if (!\class_exists($className)) {
450 450
             throw new PhpfastcacheInvalidArgumentException(
451
-              \sprintf("Can't add '%s' because the class '%s' does not exists", $driverName, $className)
451
+                \sprintf("Can't add '%s' because the class '%s' does not exists", $driverName, $className)
452 452
             );
453 453
         }
454 454
 
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
 
503 503
         if (!\class_exists($className)) {
504 504
             throw new PhpfastcacheInvalidArgumentException(
505
-              \sprintf("Can't override '%s' because the class '%s' does not exists", $driverName, $className)
505
+                \sprintf("Can't override '%s' because the class '%s' does not exists", $driverName, $className)
506 506
             );
507 507
         }
508 508
 
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
 
517 517
         if (!\is_subclass_of($className, self::CORE_DRIVER_NAMESPACE . $driverName . '\\Driver', true)) {
518 518
             throw new PhpfastcacheLogicException(
519
-              \sprintf("Can't override '%s' because the class '%s' MUST extend '%s'", $driverName, $className,
519
+                \sprintf("Can't override '%s' because the class '%s' MUST extend '%s'", $driverName, $className,
520 520
                 self::CORE_DRIVER_NAMESPACE . $driverName . '\\Driver')
521 521
             );
522 522
         }
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 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
 
@@ -132,8 +132,8 @@  discard block
 block discarded – undo
132 132
 
133 133
         $instance = $instanceId ?: \md5($driver . \serialize($config->toArray()));
134 134
 
135
-        if (!isset(self::$instances[ $instance ])) {
136
-            self::$badPracticeOmeter[ $driver ] = 1;
135
+        if (!isset(self::$instances[$instance])) {
136
+            self::$badPracticeOmeter[$driver] = 1;
137 137
             $driverClass = self::getDriverClass($driver);
138 138
 
139 139
             if (!is_a($driverClass, ExtendedCacheItemPoolInterface::class, true)) {
@@ -146,8 +146,8 @@  discard block
 block discarded – undo
146 146
             try {
147 147
                 if (\class_exists($driverClass)) {
148 148
                     $configClass = $driverClass::getConfigClass();
149
-                    self::$instances[ $instance ] = new $driverClass(new $configClass($config->toArray()), $instance);
150
-                    self::$instances[ $instance ]->setEventManager(EventManager::getInstance());
149
+                    self::$instances[$instance] = new $driverClass(new $configClass($config->toArray()), $instance);
150
+                    self::$instances[$instance]->setEventManager(EventManager::getInstance());
151 151
                 } else {
152 152
                     throw new PhpfastcacheDriverNotFoundException(\sprintf('The driver "%s" does not exists', $driver));
153 153
                 }
@@ -166,14 +166,14 @@  discard block
 block discarded – undo
166 166
                     throw new PhpfastcacheDriverCheckException($e->getMessage(), $e->getCode(), $e);
167 167
                 }
168 168
             }
169
-        } else if (self::$badPracticeOmeter[ $driver ] >= 2) {
169
+        } else if (self::$badPracticeOmeter[$driver] >= 2) {
170 170
             \trigger_error('[' . $driver . '] Calling many times CacheManager::getInstance() for already instanced drivers is a bad practice and have a significant impact on performances.
171 171
            See https://github.com/PHPSocialNetwork/phpfastcache/wiki/[V5]-Why-calling-getInstance%28%29-each-time-is-a-bad-practice-%3F');
172 172
         }
173 173
 
174
-        self::$badPracticeOmeter[ $driver ]++;
174
+        self::$badPracticeOmeter[$driver]++;
175 175
 
176
-        return self::$instances[ $instance ];
176
+        return self::$instances[$instance];
177 177
     }
178 178
 
179 179
     /**
@@ -190,8 +190,8 @@  discard block
 block discarded – undo
190 190
             throw new PhpfastcacheInvalidArgumentException('The Instance ID must be a string');
191 191
         }
192 192
 
193
-        if (isset(self::$instances[ $instanceId ])) {
194
-            return self::$instances[ $instanceId ];
193
+        if (isset(self::$instances[$instanceId])) {
194
+            return self::$instances[$instanceId];
195 195
         }
196 196
 
197 197
         throw new PhpfastcacheInstanceNotFoundException(\sprintf('Instance ID %s not found', $instanceId));
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
             throw new PhpfastcacheLogicException('Unable to find out a valid driver automatically');
256 256
         }
257 257
 
258
-        self::$badPracticeOmeter[ $autoDriver ]--;
258
+        self::$badPracticeOmeter[$autoDriver]--;
259 259
 
260 260
         return $autoDriver;
261 261
     }
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
      */
268 268
     public static function __callStatic(string $name, array $arguments): ExtendedCacheItemPoolInterface
269 269
     {
270
-        $options = (\array_key_exists(0, $arguments) && \is_array($arguments) ? $arguments[ 0 ] : []);
270
+        $options = (\array_key_exists(0, $arguments) && \is_array($arguments) ? $arguments[0] : []);
271 271
 
272 272
         return self::getInstance($name, $options);
273 273
     }
@@ -419,10 +419,10 @@  discard block
 block discarded – undo
419 419
      */
420 420
     public static function getDriverClass(string $driverName): string
421 421
     {
422
-        if (!empty(self::$driverCustoms[ $driverName ])) {
423
-            $driverClass = self::$driverCustoms[ $driverName ];
424
-        } else if (!empty(self::$driverOverrides[ $driverName ])) {
425
-            $driverClass = self::$driverOverrides[ $driverName ];
422
+        if (!empty(self::$driverCustoms[$driverName])) {
423
+            $driverClass = self::$driverCustoms[$driverName];
424
+        } else if (!empty(self::$driverOverrides[$driverName])) {
425
+            $driverClass = self::$driverOverrides[$driverName];
426 426
         } else {
427 427
             $driverClass = self::getNamespacePath() . $driverName . '\Driver';
428 428
         }
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
             );
453 453
         }
454 454
 
455
-        if (!empty(self::$driverCustoms[ $driverName ])) {
455
+        if (!empty(self::$driverCustoms[$driverName])) {
456 456
             throw new PhpfastcacheLogicException(\sprintf("Driver '%s' has been already added", $driverName));
457 457
         }
458 458
 
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
             throw new PhpfastcacheLogicException(\sprintf("Driver '%s' is already a part of the PhpFastCache core", $driverName));
461 461
         }
462 462
 
463
-        self::$driverCustoms[ $driverName ] = $className;
463
+        self::$driverCustoms[$driverName] = $className;
464 464
     }
465 465
 
466 466
     /**
@@ -477,11 +477,11 @@  discard block
 block discarded – undo
477 477
             throw new PhpfastcacheInvalidArgumentException("Can't remove a custom driver because its name is empty");
478 478
         }
479 479
 
480
-        if (!isset(self::$driverCustoms[ $driverName ])) {
480
+        if (!isset(self::$driverCustoms[$driverName])) {
481 481
             throw new PhpfastcacheLogicException(\sprintf("Driver '%s' does not exists", $driverName));
482 482
         }
483 483
 
484
-        unset(self::$driverCustoms[ $driverName ]);
484
+        unset(self::$driverCustoms[$driverName]);
485 485
     }
486 486
 
487 487
     /**
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
             );
507 507
         }
508 508
 
509
-        if (!empty(self::$driverOverrides[ $driverName ])) {
509
+        if (!empty(self::$driverOverrides[$driverName])) {
510 510
             throw new PhpfastcacheLogicException(\sprintf("Driver '%s' has been already overridden", $driverName));
511 511
         }
512 512
 
@@ -521,7 +521,7 @@  discard block
 block discarded – undo
521 521
             );
522 522
         }
523 523
 
524
-        self::$driverOverrides[ $driverName ] = $className;
524
+        self::$driverOverrides[$driverName] = $className;
525 525
     }
526 526
 
527 527
     /**
@@ -538,10 +538,10 @@  discard block
 block discarded – undo
538 538
             throw new PhpfastcacheInvalidArgumentException("Can't remove a core driver override because its name is empty");
539 539
         }
540 540
 
541
-        if (!isset(self::$driverOverrides[ $driverName ])) {
541
+        if (!isset(self::$driverOverrides[$driverName])) {
542 542
             throw new PhpfastcacheLogicException(\sprintf("Driver '%s' were not overridden", $driverName));
543 543
         }
544 544
 
545
-        unset(self::$driverOverrides[ $driverName ]);
545
+        unset(self::$driverOverrides[$driverName]);
546 546
     }
547 547
 }
Please login to merge, or discard this patch.
lib/Phpfastcache/Helper/Psr16Adapter.php 3 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 use Phpfastcache\Core\Item\ExtendedCacheItemInterface;
20 20
 use Phpfastcache\Core\Pool\ExtendedCacheItemPoolInterface;
21 21
 use Phpfastcache\Exceptions\{
22
-  PhpfastcacheDriverCheckException, PhpfastcacheInvalidArgumentException, PhpfastcacheLogicException, PhpfastcacheRootException, PhpfastcacheSimpleCacheException
22
+    PhpfastcacheDriverCheckException, PhpfastcacheInvalidArgumentException, PhpfastcacheLogicException, PhpfastcacheRootException, PhpfastcacheSimpleCacheException
23 23
 };
24 24
 use Psr\SimpleCache\CacheInterface;
25 25
 
@@ -84,8 +84,8 @@  discard block
 block discarded – undo
84 84
     {
85 85
         try {
86 86
             $cacheItem = $this->internalCacheInstance
87
-              ->getItem($key)
88
-              ->set($value);
87
+                ->getItem($key)
88
+                ->set($value);
89 89
             if (\is_int($ttl) && $ttl <= 0) {
90 90
                 $cacheItem->expiresAt((new \DateTime('@0')));
91 91
             } elseif (\is_int($ttl) || $ttl instanceof \DateInterval) {
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\Helper;
17 17
 
@@ -43,12 +43,12 @@  discard block
 block discarded – undo
43 43
      */
44 44
     public function __construct($driver, $config = null)
45 45
     {
46
-        if($driver instanceof ExtendedCacheItemPoolInterface){
47
-            if($config !== null){
46
+        if ($driver instanceof ExtendedCacheItemPoolInterface) {
47
+            if ($config !== null) {
48 48
                 throw new PhpfastcacheLogicException("You can't pass a config parameter along with an non-string '\$driver' parameter.");
49 49
             }
50 50
             $this->internalCacheInstance = $driver;
51
-        }else{
51
+        } else {
52 52
             $this->internalCacheInstance = CacheManager::getInstance($driver, $config);
53 53
         }
54 54
     }
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
     public function getMultiple($keys, $default = null)
134 134
     {
135 135
         try {
136
-            return array_map(function (ExtendedCacheItemInterface $item) {
136
+            return array_map(function(ExtendedCacheItemInterface $item) {
137 137
                 return $item->get();
138 138
             }, $this->internalCacheInstance->getItems($keys));
139 139
         } catch (PhpfastcacheInvalidArgumentException $e) {
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@
 block discarded – undo
48 48
                 throw new PhpfastcacheLogicException("You can't pass a config parameter along with an non-string '\$driver' parameter.");
49 49
             }
50 50
             $this->internalCacheInstance = $driver;
51
-        }else{
51
+        } else{
52 52
             $this->internalCacheInstance = CacheManager::getInstance($driver, $config);
53 53
         }
54 54
     }
Please login to merge, or discard this patch.