Completed
Push — v7 ( 304a1c...9a5d8c )
by Georges
02:15
created
lib/Phpfastcache/Exceptions/PhpfastcacheDriverCheckException.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\Exceptions;
17 17
 
Please login to merge, or discard this patch.
lib/Phpfastcache/Helper/TestHelper.php 2 patches
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\Helper;
17 17
 
Please login to merge, or discard this patch.
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -221,11 +221,11 @@  discard block
 block discarded – undo
221 221
             $this->printSkipText('A driver could not be initialized due to missing requirement: ' . $exception->getMessage());
222 222
         } else {
223 223
             $this->printFailText(\sprintf(
224
-              'Uncaught exception "%s" in "%s" line %d with message: "%s"',
225
-              \get_class($exception),
226
-              $exception->getFile(),
227
-              $exception->getLine(),
228
-              $exception->getMessage()
224
+                'Uncaught exception "%s" in "%s" line %d with message: "%s"',
225
+                \get_class($exception),
226
+                $exception->getFile(),
227
+                $exception->getLine(),
228
+                $exception->getMessage()
229 229
             ));
230 230
         }
231 231
         $this->terminateTest();
@@ -272,17 +272,17 @@  discard block
 block discarded – undo
272 272
 
273 273
         if ($errorType === '[FATAL ERROR]') {
274 274
             $this->printFailText(\sprintf(
275
-              "A critical error has been caught: \"%s\" in %s line %d",
276
-              "$errorType $errstr",
277
-              $errfile,
278
-              $errline
275
+                "A critical error has been caught: \"%s\" in %s line %d",
276
+                "$errorType $errstr",
277
+                $errfile,
278
+                $errline
279 279
             ));
280 280
         } else {
281 281
             $this->printDebugText(\sprintf(
282
-              "A non-critical error has been caught: \"%s\" in %s line %d",
283
-              "$errorType $errstr",
284
-              $errfile,
285
-              $errline
282
+                "A non-critical error has been caught: \"%s\" in %s line %d",
283
+                "$errorType $errstr",
284
+                $errfile,
285
+                $errline
286 286
             ));
287 287
         }
288 288
     }
Please login to merge, or discard this patch.
lib/Phpfastcache/Exceptions/PhpfastcacheUnsupportedOperationException.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\Exceptions;
17 17
 
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;
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
                     if ($driverArray) {
91 91
                         if (!\is_array($driverArray)) {
92 92
                             throw new PhpfastcacheCoreException(\sprintf('The driverRead method returned an unexpected variable type: %s',
93
-                              \gettype($driverArray)));
93
+                                \gettype($driverArray)));
94 94
                         }
95 95
                         $driverData = $this->driverUnwrapData($driverArray);
96 96
 
@@ -155,9 +155,9 @@  discard block
 block discarded – undo
155 155
                              * Reset the Item
156 156
                              */
157 157
                             $item->set(null)
158
-                              ->expiresAfter(\abs((int)$this->getConfig()[ 'defaultTtl' ]))
159
-                              ->setHit(false)
160
-                              ->setTags([]);
158
+                                ->expiresAfter(\abs((int)$this->getConfig()[ 'defaultTtl' ]))
159
+                                ->setHit(false)
160
+                                ->setTags([]);
161 161
                             if ($this->getConfigOption( 'itemDetailedDate')) {
162 162
 
163 163
                                 /**
@@ -341,8 +341,8 @@  discard block
 block discarded – undo
341 341
             $class = new \ReflectionClass((new \ReflectionObject($this))->getNamespaceName() . '\Item');
342 342
             $itemBatch = $class->newInstanceArgs([$this, $item->getKey()]);
343 343
             $itemBatch->setEventManager($this->eventManager)
344
-              ->set(new ItemBatch($item->getKey(), new \DateTime()))
345
-              ->expiresAfter($this->getConfigOption('cacheSlamsTimeout'));
344
+                ->set(new ItemBatch($item->getKey(), new \DateTime()))
345
+                ->expiresAfter($this->getConfigOption('cacheSlamsTimeout'));
346 346
 
347 347
             /**
348 348
              * To avoid SPL mismatches
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 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
 
@@ -71,9 +71,9 @@  discard block
 block discarded – undo
71 71
              * due to performance issue on huge
72 72
              * loop dispatching operations
73 73
              */
74
-            if (!isset($this->itemInstances[ $key ])) {
74
+            if (!isset($this->itemInstances[$key])) {
75 75
                 if (\preg_match('~([' . \preg_quote(self::$unsupportedKeyChars, '~') . ']+)~', $key, $matches)) {
76
-                    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
+                    throw new PhpfastcacheInvalidArgumentException('Unsupported key character detected: "' . $matches[1] . '". Please check: https://github.com/PHPSocialNetwork/phpfastcache/wiki/%5BV6%5D-Unsupported-characters-in-key-identifiers');
77 77
                 }
78 78
 
79 79
                 CacheManager::$ReadHits++;
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
                         }
95 95
                         $driverData = $this->driverUnwrapData($driverArray);
96 96
 
97
-                        if ($this->getConfig()[ 'preventCacheSlams' ]) {
97
+                        if ($this->getConfig()['preventCacheSlams']) {
98 98
                             while ($driverData instanceof ItemBatch) {
99 99
                                 if ($driverData->getItemDate()->getTimestamp() + $this->getConfigOption('cacheSlamsTimeout') < \time()) {
100 100
                                     /**
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
                         $item->set($driverData);
129 129
                         $item->expiresAt($this->driverUnwrapEdate($driverArray));
130 130
 
131
-                        if ($this->getConfigOption( 'itemDetailedDate')) {
131
+                        if ($this->getConfigOption('itemDetailedDate')) {
132 132
                             /**
133 133
                              * If the itemDetailedDate has been
134 134
                              * set after caching, we MUST inject
@@ -155,10 +155,10 @@  discard block
 block discarded – undo
155 155
                              * Reset the Item
156 156
                              */
157 157
                             $item->set(null)
158
-                              ->expiresAfter(\abs((int)$this->getConfig()[ 'defaultTtl' ]))
158
+                              ->expiresAfter(\abs((int) $this->getConfig()['defaultTtl']))
159 159
                               ->setHit(false)
160 160
                               ->setTags([]);
161
-                            if ($this->getConfigOption( 'itemDetailedDate')) {
161
+                            if ($this->getConfigOption('itemDetailedDate')) {
162 162
 
163 163
                                 /**
164 164
                                  * If the itemDetailedDate has been
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
                             $item->setHit(true);
173 173
                         }
174 174
                     } else {
175
-                        $item->expiresAfter(abs((int)$this->getConfig()[ 'defaultTtl' ]));
175
+                        $item->expiresAfter(abs((int) $this->getConfig()['defaultTtl']));
176 176
                     }
177 177
                 }
178 178
             }
@@ -185,9 +185,9 @@  discard block
 block discarded – undo
185 185
          * @param $this ExtendedCacheItemPoolInterface
186 186
          * @param $this ExtendedCacheItemInterface
187 187
          */
188
-        $this->eventManager->dispatch('CacheGetItem', $this, $this->itemInstances[ $key ]);
188
+        $this->eventManager->dispatch('CacheGetItem', $this, $this->itemInstances[$key]);
189 189
 
190
-        return $this->itemInstances[ $key ];
190
+        return $this->itemInstances[$key];
191 191
     }
192 192
 
193 193
     /**
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
     public function setItem(CacheItemInterface $item)
199 199
     {
200 200
         if ($this->getClassNamespace() . '\\Item' === \get_class($item)) {
201
-            $this->itemInstances[ $item->getKey() ] = $item;
201
+            $this->itemInstances[$item->getKey()] = $item;
202 202
 
203 203
             return $this;
204 204
         }
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
     {
216 216
         $collection = [];
217 217
         foreach ($keys as $key) {
218
-            $collection[ $key ] = $this->getItem($key);
218
+            $collection[$key] = $this->getItem($key);
219 219
         }
220 220
 
221 221
         return $collection;
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
             }
303 303
         }
304 304
 
305
-        return (bool)$return;
305
+        return (bool) $return;
306 306
     }
307 307
 
308 308
     /**
@@ -320,9 +320,9 @@  discard block
 block discarded – undo
320 320
          * due to performance issue on huge
321 321
          * loop dispatching operations
322 322
          */
323
-        if (!isset($this->itemInstances[ $item->getKey() ])) {
324
-            $this->itemInstances[ $item->getKey() ] = $item;
325
-        } else if (\spl_object_hash($item) !== \spl_object_hash($this->itemInstances[ $item->getKey() ])) {
323
+        if (!isset($this->itemInstances[$item->getKey()])) {
324
+            $this->itemInstances[$item->getKey()] = $item;
325
+        } else if (\spl_object_hash($item) !== \spl_object_hash($this->itemInstances[$item->getKey()])) {
326 326
             throw new \RuntimeException('Spl object hash mismatches ! You probably tried to save a detached item which has been already retrieved from cache.');
327 327
         }
328 328
 
@@ -374,8 +374,8 @@  discard block
 block discarded – undo
374 374
     public function saveDeferred(CacheItemInterface $item)
375 375
     {
376 376
         if (!\array_key_exists($item->getKey(), $this->itemInstances)) {
377
-            $this->itemInstances[ $item->getKey() ] = $item;
378
-        } else if (\spl_object_hash($item) !== \spl_object_hash($this->itemInstances[ $item->getKey() ])) {
377
+            $this->itemInstances[$item->getKey()] = $item;
378
+        } else if (\spl_object_hash($item) !== \spl_object_hash($this->itemInstances[$item->getKey()])) {
379 379
             throw new \RuntimeException('Spl object hash mismatches ! You probably tried to save a detached item which has been already retrieved from cache.');
380 380
         }
381 381
 
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
          */
387 387
         $this->eventManager->dispatch('CacheSaveDeferredItem', $this, $item);
388 388
 
389
-        return $this->deferredList[ $item->getKey() ] = $item;
389
+        return $this->deferredList[$item->getKey()] = $item;
390 390
     }
391 391
 
392 392
     /**
@@ -406,11 +406,11 @@  discard block
 block discarded – undo
406 406
         foreach ($this->deferredList as $key => $item) {
407 407
             $result = $this->save($item);
408 408
             if ($return !== false) {
409
-                unset($this->deferredList[ $key ]);
409
+                unset($this->deferredList[$key]);
410 410
                 $return = $result;
411 411
             }
412 412
         }
413 413
 
414
-        return (bool)$return;
414
+        return (bool) $return;
415 415
     }
416 416
 }
417 417
\ No newline at end of file
Please login to merge, or discard this patch.
lib/Phpfastcache/Util/ClassNamespaceResolverTrait.php 1 patch
Spacing   +18 added lines, -18 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\Util;
17 17
 
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
         }
56 56
         $map = [];
57 57
 
58
-        if(\is_array($dir) || $dir instanceof \Traversable){
58
+        if (\is_array($dir) || $dir instanceof \Traversable) {
59 59
             foreach ($dir as $file) {
60 60
                 if (!$file->isFile()) {
61 61
                     continue;
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
                     \gc_mem_caches();
71 71
                 }
72 72
                 foreach ($classes as $class) {
73
-                    $map[ $class ] = $path;
73
+                    $map[$class] = $path;
74 74
                 }
75 75
             }
76 76
         }
@@ -94,19 +94,19 @@  discard block
 block discarded – undo
94 94
         $tokens = \token_get_all($contents);
95 95
         $classes = [];
96 96
         $namespace = '';
97
-        for ($i = 0; isset($tokens[ $i ]); ++$i) {
98
-            $token = $tokens[ $i ];
99
-            if (!isset($token[ 1 ])) {
97
+        for ($i = 0; isset($tokens[$i]); ++$i) {
98
+            $token = $tokens[$i];
99
+            if (!isset($token[1])) {
100 100
                 continue;
101 101
             }
102 102
             $class = '';
103
-            switch ($token[ 0 ]) {
103
+            switch ($token[0]) {
104 104
                 case T_NAMESPACE:
105 105
                     $namespace = '';
106 106
                     // If there is a namespace, extract it
107
-                    while (isset($tokens[ ++$i ][ 1 ])) {
108
-                        if (\in_array($tokens[ $i ][ 0 ], [T_STRING, T_NS_SEPARATOR])) {
109
-                            $namespace .= $tokens[ $i ][ 1 ];
107
+                    while (isset($tokens[ ++$i][1])) {
108
+                        if (\in_array($tokens[$i][0], [T_STRING, T_NS_SEPARATOR])) {
109
+                            $namespace .= $tokens[$i][1];
110 110
                         }
111 111
                     }
112 112
                     $namespace .= '\\';
@@ -117,13 +117,13 @@  discard block
 block discarded – undo
117 117
                     // Skip usage of ::class constant
118 118
                     $isClassConstant = false;
119 119
                     for ($j = $i - 1; $j > 0; --$j) {
120
-                        if (!isset($tokens[ $j ][ 1 ])) {
120
+                        if (!isset($tokens[$j][1])) {
121 121
                             break;
122 122
                         }
123
-                        if (T_DOUBLE_COLON === $tokens[ $j ][ 0 ]) {
123
+                        if (T_DOUBLE_COLON === $tokens[$j][0]) {
124 124
                             $isClassConstant = true;
125 125
                             break;
126
-                        } elseif (!\in_array($tokens[ $j ][ 0 ], [T_WHITESPACE, T_DOC_COMMENT, T_COMMENT], false)) {
126
+                        } elseif (!\in_array($tokens[$j][0], [T_WHITESPACE, T_DOC_COMMENT, T_COMMENT], false)) {
127 127
                             break;
128 128
                         }
129 129
                     }
@@ -131,11 +131,11 @@  discard block
 block discarded – undo
131 131
                         break;
132 132
                     }
133 133
                     // Find the classname
134
-                    while (isset($tokens[ ++$i ][ 1 ])) {
135
-                        $t = $tokens[ $i ];
136
-                        if (T_STRING === $t[ 0 ]) {
137
-                            $class .= $t[ 1 ];
138
-                        } elseif ('' !== $class && T_WHITESPACE === $t[ 0 ]) {
134
+                    while (isset($tokens[ ++$i][1])) {
135
+                        $t = $tokens[$i];
136
+                        if (T_STRING === $t[0]) {
137
+                            $class .= $t[1];
138
+                        } elseif ('' !== $class && T_WHITESPACE === $t[0]) {
139 139
                             break;
140 140
                         }
141 141
                     }
Please login to merge, or discard this patch.
lib/Phpfastcache/Drivers/Mongodb/Driver.php 2 patches
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -18,14 +18,14 @@  discard block
 block discarded – undo
18 18
 
19 19
 use LogicException;
20 20
 use MongoDB\{
21
-  BSON\Binary, BSON\UTCDateTime, Collection, DeleteResult, Driver\Command, Driver\Exception\Exception as MongoDBException, Driver\Manager as MongodbManager
21
+    BSON\Binary, BSON\UTCDateTime, Collection, DeleteResult, Driver\Command, Driver\Exception\Exception as MongoDBException, Driver\Manager as MongodbManager
22 22
 };
23 23
 use Phpfastcache\Core\Pool\{
24
-  DriverBaseTrait, ExtendedCacheItemPoolInterface
24
+    DriverBaseTrait, ExtendedCacheItemPoolInterface
25 25
 };
26 26
 use Phpfastcache\Entities\DriverStatistic;
27 27
 use Phpfastcache\Exceptions\{
28
-  PhpfastcacheDriverException, PhpfastcacheInvalidArgumentException
28
+    PhpfastcacheDriverException, PhpfastcacheInvalidArgumentException
29 29
 };
30 30
 use Phpfastcache\Util\ArrayObject;
31 31
 use Psr\Cache\CacheItemInterface;
@@ -71,16 +71,16 @@  discard block
 block discarded – undo
71 71
 
72 72
         if ($document) {
73 73
             $return = [
74
-              self::DRIVER_DATA_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_DATA_WRAPPER_INDEX ]->getData()),
75
-              self::DRIVER_TAGS_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_TAGS_WRAPPER_INDEX ]->getData()),
76
-              self::DRIVER_EDATE_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_EDATE_WRAPPER_INDEX ]->toDateTime()->getTimestamp()),
74
+                self::DRIVER_DATA_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_DATA_WRAPPER_INDEX ]->getData()),
75
+                self::DRIVER_TAGS_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_TAGS_WRAPPER_INDEX ]->getData()),
76
+                self::DRIVER_EDATE_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_EDATE_WRAPPER_INDEX ]->toDateTime()->getTimestamp()),
77 77
             ];
78 78
 
79 79
             if(!empty($this->getConfigOption('itemDetailedDate'))){
80 80
                 $return += [
81
-                  self::DRIVER_MDATE_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_MDATE_WRAPPER_INDEX ]->toDateTime()
81
+                    self::DRIVER_MDATE_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_MDATE_WRAPPER_INDEX ]->toDateTime()
82 82
                     ->getTimestamp()),
83
-                  self::DRIVER_CDATE_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_CDATE_WRAPPER_INDEX ]->toDateTime()
83
+                    self::DRIVER_CDATE_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_CDATE_WRAPPER_INDEX ]->toDateTime()
84 84
                     ->getTimestamp()),
85 85
                 ];
86 86
             }
@@ -105,23 +105,23 @@  discard block
 block discarded – undo
105 105
         if ($item instanceof Item) {
106 106
             try {
107 107
                 $set = [
108
-                  self::DRIVER_DATA_WRAPPER_INDEX => new Binary($this->encode($item->get()), Binary::TYPE_GENERIC),
109
-                  self::DRIVER_TAGS_WRAPPER_INDEX => new Binary($this->encode($item->getTags()), Binary::TYPE_GENERIC),
110
-                  self::DRIVER_EDATE_WRAPPER_INDEX => ($item->getTtl() > 0 ? new UTCDateTime((\time() + $item->getTtl()) * 1000) : new UTCDateTime(\time() * 1000)),
108
+                    self::DRIVER_DATA_WRAPPER_INDEX => new Binary($this->encode($item->get()), Binary::TYPE_GENERIC),
109
+                    self::DRIVER_TAGS_WRAPPER_INDEX => new Binary($this->encode($item->getTags()), Binary::TYPE_GENERIC),
110
+                    self::DRIVER_EDATE_WRAPPER_INDEX => ($item->getTtl() > 0 ? new UTCDateTime((\time() + $item->getTtl()) * 1000) : new UTCDateTime(\time() * 1000)),
111 111
                 ];
112 112
 
113 113
                 if(!empty($this->getConfigOption('itemDetailedDate'))){
114 114
                     $set += [
115
-                      self::DRIVER_MDATE_WRAPPER_INDEX => ($item->getModificationDate() ? new UTCDateTime(($item->getModificationDate()->getTimestamp()) * 1000) : new UTCDateTime(\time() * 1000)),
116
-                      self::DRIVER_CDATE_WRAPPER_INDEX => ($item->getCreationDate() ? new UTCDateTime(($item->getCreationDate()->getTimestamp()) * 1000) : new UTCDateTime(\time() * 1000)),
115
+                        self::DRIVER_MDATE_WRAPPER_INDEX => ($item->getModificationDate() ? new UTCDateTime(($item->getModificationDate()->getTimestamp()) * 1000) : new UTCDateTime(\time() * 1000)),
116
+                        self::DRIVER_CDATE_WRAPPER_INDEX => ($item->getCreationDate() ? new UTCDateTime(($item->getCreationDate()->getTimestamp()) * 1000) : new UTCDateTime(\time() * 1000)),
117 117
                     ];
118 118
                 }
119 119
                 $result = (array)$this->getCollection()->updateOne(
120
-                  ['_id' => $item->getEncodedKey()],
121
-                  [
120
+                    ['_id' => $item->getEncodedKey()],
121
+                    [
122 122
                     '$set' => $set,
123
-                  ],
124
-                  ['upsert' => true, 'multiple' => false]
123
+                    ],
124
+                    ['upsert' => true, 'multiple' => false]
125 125
                 );
126 126
             } catch (MongoDBException $e) {
127 127
                 throw new PhpfastcacheDriverException('Got an exception while trying to write data to MongoDB server', null, $e);
@@ -191,10 +191,10 @@  discard block
 block discarded – undo
191 191
          * @todo make an url builder
192 192
          */
193 193
         $this->instance = $this->instance ?: (new MongodbManager('mongodb://' .
194
-          ($clientConfig[ 'username' ] ?: '') .
195
-          ($clientConfig[ 'password' ] ? ":{$clientConfig['password']}" : '') .
196
-          ($clientConfig[ 'username' ] ? '@' : '') . "{$clientConfig['host']}" .
197
-          ($clientConfig[ 'port' ] != 27017 ? ":{$clientConfig['port']}" : ''), ['connectTimeoutMS' => $clientConfig[ 'timeout' ] * 1000]));
194
+            ($clientConfig[ 'username' ] ?: '') .
195
+            ($clientConfig[ 'password' ] ? ":{$clientConfig['password']}" : '') .
196
+            ($clientConfig[ 'username' ] ? '@' : '') . "{$clientConfig['host']}" .
197
+            ($clientConfig[ 'port' ] != 27017 ? ":{$clientConfig['port']}" : ''), ['connectTimeoutMS' => $clientConfig[ 'timeout' ] * 1000]));
198 198
         $this->collection = $this->collection ?: new Collection($this->instance, $clientConfig[ 'databaseName' ], $clientConfig[ 'collectionName' ]);
199 199
 
200 200
         return true;
@@ -221,15 +221,15 @@  discard block
 block discarded – undo
221 221
     public function getStats(): DriverStatistic
222 222
     {
223 223
         $serverStats = $this->instance->executeCommand($this->getConfigOption('databaseName'), new Command([
224
-          'serverStatus' => 1,
225
-          'recordStats' => 0,
226
-          'repl' => 0,
227
-          'metrics' => 0,
224
+            'serverStatus' => 1,
225
+            'recordStats' => 0,
226
+            'repl' => 0,
227
+            'metrics' => 0,
228 228
         ]))->toArray()[ 0 ];
229 229
 
230 230
         $collectionStats = $this->instance->executeCommand($this->getConfigOption('databaseName'), new Command([
231
-          'collStats' => ($this->config->getOption('collectionName') !== null ? $this->config->getOption('collectionName') : 'Cache'),
232
-          'verbose' => true,
231
+            'collStats' => ($this->config->getOption('collectionName') !== null ? $this->config->getOption('collectionName') : 'Cache'),
232
+            'verbose' => true,
233 233
         ]))->toArray()[ 0 ];
234 234
 
235 235
         $array_filter_recursive = function ($array, callable $callback = null) use (&$array_filter_recursive) {
@@ -258,14 +258,14 @@  discard block
 block discarded – undo
258 258
         $collectionStats = $array_filter_recursive($collectionStats, $callback);
259 259
 
260 260
         $stats = (new DriverStatistic())
261
-          ->setInfo('MongoDB version ' . $serverStats->version . ', Uptime (in days): ' . round($serverStats->uptime / 86400,
262
-              1) . "\n For more information see RawData.")
263
-          ->setSize($collectionStats->size)
264
-          ->setData(\implode(', ', \array_keys($this->itemInstances)))
265
-          ->setRawData([
261
+            ->setInfo('MongoDB version ' . $serverStats->version . ', Uptime (in days): ' . round($serverStats->uptime / 86400,
262
+                1) . "\n For more information see RawData.")
263
+            ->setSize($collectionStats->size)
264
+            ->setData(\implode(', ', \array_keys($this->itemInstances)))
265
+            ->setRawData([
266 266
             'serverStatus' => $serverStats,
267 267
             'collStats' => $collectionStats,
268
-          ]);
268
+            ]);
269 269
 
270 270
         return $stats;
271 271
     }
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  * @author Fabio Covolo Mazzo (fabiocmazzo) <[email protected]>
13 13
  *
14 14
  */
15
-declare(strict_types=1);
15
+declare(strict_types = 1);
16 16
 
17 17
 namespace Phpfastcache\Drivers\Mongodb;
18 18
 
@@ -71,16 +71,16 @@  discard block
 block discarded – undo
71 71
 
72 72
         if ($document) {
73 73
             $return = [
74
-              self::DRIVER_DATA_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_DATA_WRAPPER_INDEX ]->getData()),
75
-              self::DRIVER_TAGS_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_TAGS_WRAPPER_INDEX ]->getData()),
76
-              self::DRIVER_EDATE_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_EDATE_WRAPPER_INDEX ]->toDateTime()->getTimestamp()),
74
+              self::DRIVER_DATA_WRAPPER_INDEX => $this->decode($document[self::DRIVER_DATA_WRAPPER_INDEX]->getData()),
75
+              self::DRIVER_TAGS_WRAPPER_INDEX => $this->decode($document[self::DRIVER_TAGS_WRAPPER_INDEX]->getData()),
76
+              self::DRIVER_EDATE_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[self::DRIVER_EDATE_WRAPPER_INDEX]->toDateTime()->getTimestamp()),
77 77
             ];
78 78
 
79
-            if(!empty($this->getConfigOption('itemDetailedDate'))){
79
+            if (!empty($this->getConfigOption('itemDetailedDate'))) {
80 80
                 $return += [
81
-                  self::DRIVER_MDATE_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_MDATE_WRAPPER_INDEX ]->toDateTime()
81
+                  self::DRIVER_MDATE_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[self::DRIVER_MDATE_WRAPPER_INDEX]->toDateTime()
82 82
                     ->getTimestamp()),
83
-                  self::DRIVER_CDATE_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_CDATE_WRAPPER_INDEX ]->toDateTime()
83
+                  self::DRIVER_CDATE_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[self::DRIVER_CDATE_WRAPPER_INDEX]->toDateTime()
84 84
                     ->getTimestamp()),
85 85
                 ];
86 86
             }
@@ -110,13 +110,13 @@  discard block
 block discarded – undo
110 110
                   self::DRIVER_EDATE_WRAPPER_INDEX => ($item->getTtl() > 0 ? new UTCDateTime((\time() + $item->getTtl()) * 1000) : new UTCDateTime(\time() * 1000)),
111 111
                 ];
112 112
 
113
-                if(!empty($this->getConfigOption('itemDetailedDate'))){
113
+                if (!empty($this->getConfigOption('itemDetailedDate'))) {
114 114
                     $set += [
115 115
                       self::DRIVER_MDATE_WRAPPER_INDEX => ($item->getModificationDate() ? new UTCDateTime(($item->getModificationDate()->getTimestamp()) * 1000) : new UTCDateTime(\time() * 1000)),
116 116
                       self::DRIVER_CDATE_WRAPPER_INDEX => ($item->getCreationDate() ? new UTCDateTime(($item->getCreationDate()->getTimestamp()) * 1000) : new UTCDateTime(\time() * 1000)),
117 117
                     ];
118 118
                 }
119
-                $result = (array)$this->getCollection()->updateOne(
119
+                $result = (array) $this->getCollection()->updateOne(
120 120
                   ['_id' => $item->getEncodedKey()],
121 121
                   [
122 122
                     '$set' => $set,
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
                 throw new PhpfastcacheDriverException('Got an exception while trying to write data to MongoDB server', null, $e);
128 128
             }
129 129
 
130
-            return isset($result[ 'ok' ]) ? $result[ 'ok' ] == 1 : true;
130
+            return isset($result['ok']) ? $result['ok'] == 1 : true;
131 131
         }
132 132
 
133 133
         throw new PhpfastcacheInvalidArgumentException('Cross-Driver type confusion detected');
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
          */
172 172
         $this->save($this->getItem('__PFC_CACHE_CLEARED__')->set(true));
173 173
 
174
-        return !empty($result[ 'ok' ]);
174
+        return !empty($result['ok']);
175 175
     }
176 176
 
177 177
     /**
@@ -191,11 +191,11 @@  discard block
 block discarded – undo
191 191
          * @todo make an url builder
192 192
          */
193 193
         $this->instance = $this->instance ?: (new MongodbManager('mongodb://' .
194
-          ($clientConfig[ 'username' ] ?: '') .
195
-          ($clientConfig[ 'password' ] ? ":{$clientConfig['password']}" : '') .
196
-          ($clientConfig[ 'username' ] ? '@' : '') . "{$clientConfig['host']}" .
197
-          ($clientConfig[ 'port' ] != 27017 ? ":{$clientConfig['port']}" : ''), ['connectTimeoutMS' => $clientConfig[ 'timeout' ] * 1000]));
198
-        $this->collection = $this->collection ?: new Collection($this->instance, $clientConfig[ 'databaseName' ], $clientConfig[ 'collectionName' ]);
194
+          ($clientConfig['username'] ?: '') .
195
+          ($clientConfig['password'] ? ":{$clientConfig['password']}" : '') .
196
+          ($clientConfig['username'] ? '@' : '') . "{$clientConfig['host']}" .
197
+          ($clientConfig['port'] != 27017 ? ":{$clientConfig['port']}" : ''), ['connectTimeoutMS' => $clientConfig['timeout'] * 1000]));
198
+        $this->collection = $this->collection ?: new Collection($this->instance, $clientConfig['databaseName'], $clientConfig['collectionName']);
199 199
 
200 200
         return true;
201 201
     }
@@ -225,14 +225,14 @@  discard block
 block discarded – undo
225 225
           'recordStats' => 0,
226 226
           'repl' => 0,
227 227
           'metrics' => 0,
228
-        ]))->toArray()[ 0 ];
228
+        ]))->toArray()[0];
229 229
 
230 230
         $collectionStats = $this->instance->executeCommand($this->getConfigOption('databaseName'), new Command([
231 231
           'collStats' => ($this->config->getOption('collectionName') !== null ? $this->config->getOption('collectionName') : 'Cache'),
232 232
           'verbose' => true,
233
-        ]))->toArray()[ 0 ];
233
+        ]))->toArray()[0];
234 234
 
235
-        $array_filter_recursive = function ($array, callable $callback = null) use (&$array_filter_recursive) {
235
+        $array_filter_recursive = function($array, callable $callback = null) use (&$array_filter_recursive) {
236 236
             $array = $callback($array);
237 237
 
238 238
             if (\is_object($array) || \is_array($array)) {
@@ -244,12 +244,12 @@  discard block
 block discarded – undo
244 244
             return $array;
245 245
         };
246 246
 
247
-        $callback = function ($item) {
247
+        $callback = function($item) {
248 248
             /**
249 249
              * Remove unserializable properties
250 250
              */
251 251
             if ($item instanceof \MongoDB\BSON\UTCDateTime) {
252
-                return (string)$item;
252
+                return (string) $item;
253 253
             }
254 254
             return $item;
255 255
         };
Please login to merge, or discard this patch.
lib/Phpfastcache/Drivers/Wincache/Driver.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 use Phpfastcache\Core\Pool\{DriverBaseTrait, ExtendedCacheItemPoolInterface};
19 19
 use Phpfastcache\Entities\DriverStatistic;
20 20
 use Phpfastcache\Exceptions\{
21
-  PhpfastcacheInvalidArgumentException
21
+    PhpfastcacheInvalidArgumentException
22 22
 };
23 23
 use Psr\Cache\CacheItemInterface;
24 24
 
@@ -121,9 +121,9 @@  discard block
 block discarded – undo
121 121
         $date = (new \DateTime())->setTimestamp(\time() - $info[ 'total_cache_uptime' ]);
122 122
 
123 123
         return (new DriverStatistic())
124
-          ->setInfo(\sprintf("The Wincache daemon is up since %s.\n For more information see RawData.", $date->format(DATE_RFC2822)))
125
-          ->setSize($memInfo[ 'memory_free' ] - $memInfo[ 'memory_total' ])
126
-          ->setData(\implode(', ', \array_keys($this->itemInstances)))
127
-          ->setRawData($memInfo);
124
+            ->setInfo(\sprintf("The Wincache daemon is up since %s.\n For more information see RawData.", $date->format(DATE_RFC2822)))
125
+            ->setSize($memInfo[ 'memory_free' ] - $memInfo[ 'memory_total' ])
126
+            ->setData(\implode(', ', \array_keys($this->itemInstances)))
127
+            ->setRawData($memInfo);
128 128
     }
129 129
 }
130 130
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 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\Drivers\Wincache;
17 17
 
@@ -118,11 +118,11 @@  discard block
 block discarded – undo
118 118
     {
119 119
         $memInfo = wincache_ucache_meminfo();
120 120
         $info = wincache_ucache_info();
121
-        $date = (new \DateTime())->setTimestamp(\time() - $info[ 'total_cache_uptime' ]);
121
+        $date = (new \DateTime())->setTimestamp(\time() - $info['total_cache_uptime']);
122 122
 
123 123
         return (new DriverStatistic())
124 124
           ->setInfo(\sprintf("The Wincache daemon is up since %s.\n For more information see RawData.", $date->format(DATE_RFC2822)))
125
-          ->setSize($memInfo[ 'memory_free' ] - $memInfo[ 'memory_total' ])
125
+          ->setSize($memInfo['memory_free'] - $memInfo['memory_total'])
126 126
           ->setData(\implode(', ', \array_keys($this->itemInstances)))
127 127
           ->setRawData($memInfo);
128 128
     }
Please login to merge, or discard this patch.
lib/Phpfastcache/Drivers/Redis/Driver.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -17,11 +17,11 @@  discard block
 block discarded – undo
17 17
 
18 18
 use Phpfastcache\Config\ConfigurationOption;
19 19
 use Phpfastcache\Core\Pool\{
20
-  DriverBaseTrait, ExtendedCacheItemPoolInterface
20
+    DriverBaseTrait, ExtendedCacheItemPoolInterface
21 21
 };
22 22
 use Phpfastcache\Entities\DriverStatistic;
23 23
 use Phpfastcache\Exceptions\{
24
-  PhpfastcacheInvalidArgumentException, PhpfastcacheLogicException
24
+    PhpfastcacheInvalidArgumentException, PhpfastcacheLogicException
25 25
 };
26 26
 use Phpfastcache\Util\ArrayObject;
27 27
 use Psr\Cache\CacheItemInterface;
@@ -162,10 +162,10 @@  discard block
 block discarded – undo
162 162
         $date = (new \DateTime())->setTimestamp(\time() - $info[ 'uptime_in_seconds' ]);
163 163
 
164 164
         return (new DriverStatistic())
165
-          ->setData(\implode(', ', \array_keys($this->itemInstances)))
166
-          ->setRawData($info)
167
-          ->setSize((int)$info[ 'used_memory' ])
168
-          ->setInfo(\sprintf("The Redis daemon v%s is up since %s.\n For more information see RawData. \n Driver size includes the memory allocation size.",
165
+            ->setData(\implode(', ', \array_keys($this->itemInstances)))
166
+            ->setRawData($info)
167
+            ->setSize((int)$info[ 'used_memory' ])
168
+            ->setInfo(\sprintf("The Redis daemon v%s is up since %s.\n For more information see RawData. \n Driver size includes the memory allocation size.",
169 169
             $info[ 'redis_version' ], $date->format(DATE_RFC2822)));
170 170
     }
171 171
 }
172 172
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 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\Drivers\Redis;
17 17
 
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
         if ($this->config->getOption('path')) {
64 64
             $isConnected = $this->instance->connect($this->config->getOption('path'));
65 65
         } else {
66
-            $isConnected = $this->instance->connect($this->config->getOption('host'), $this->config->getOption('port'), (int)$this->config->getOption('timeout'));
66
+            $isConnected = $this->instance->connect($this->config->getOption('host'), $this->config->getOption('port'), (int) $this->config->getOption('timeout'));
67 67
         }
68 68
 
69 69
         if (!$isConnected && $this->config->getOption('path')) {
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
          * Check for Cross-Driver type confusion
133 133
          */
134 134
         if ($item instanceof Item) {
135
-            return (bool)$this->instance->del($item->getKey());
135
+            return (bool) $this->instance->del($item->getKey());
136 136
         }
137 137
 
138 138
         throw new PhpfastcacheInvalidArgumentException('Cross-Driver type confusion detected');
@@ -159,13 +159,13 @@  discard block
 block discarded – undo
159 159
     {
160 160
         // used_memory
161 161
         $info = $this->instance->info();
162
-        $date = (new \DateTime())->setTimestamp(\time() - $info[ 'uptime_in_seconds' ]);
162
+        $date = (new \DateTime())->setTimestamp(\time() - $info['uptime_in_seconds']);
163 163
 
164 164
         return (new DriverStatistic())
165 165
           ->setData(\implode(', ', \array_keys($this->itemInstances)))
166 166
           ->setRawData($info)
167
-          ->setSize((int)$info[ 'used_memory' ])
167
+          ->setSize((int) $info['used_memory'])
168 168
           ->setInfo(\sprintf("The Redis daemon v%s is up since %s.\n For more information see RawData. \n Driver size includes the memory allocation size.",
169
-            $info[ 'redis_version' ], $date->format(DATE_RFC2822)));
169
+            $info['redis_version'], $date->format(DATE_RFC2822)));
170 170
     }
171 171
 }
172 172
\ No newline at end of file
Please login to merge, or discard this patch.
lib/Phpfastcache/EventManager.php 1 patch
Spacing   +10 added lines, -10 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
 
@@ -76,8 +76,8 @@  discard block
 block discarded – undo
76 76
          * due to performance issue on huge
77 77
          * loop dispatching operations
78 78
          */
79
-        if (isset($this->events[ $eventName ])) {
80
-            foreach ($this->events[ $eventName ] as $event) {
79
+        if (isset($this->events[$eventName])) {
80
+            foreach ($this->events[$eventName] as $event) {
81 81
                 call_user_func_array($event, $args);
82 82
             }
83 83
         }
@@ -93,14 +93,14 @@  discard block
 block discarded – undo
93 93
     {
94 94
         if (\strpos($name, 'on') === 0) {
95 95
             $name = \substr($name, 2);
96
-            if (\is_callable($arguments[ 0 ])) {
97
-                if (isset($arguments[ 1 ]) && \is_string($arguments[ 0 ])) {
98
-                    $this->events[ $name ][ $arguments[ 1 ] ] = $arguments[ 0 ];
96
+            if (\is_callable($arguments[0])) {
97
+                if (isset($arguments[1]) && \is_string($arguments[0])) {
98
+                    $this->events[$name][$arguments[1]] = $arguments[0];
99 99
                 } else {
100
-                    $this->events[ $name ][] = $arguments[ 0 ];
100
+                    $this->events[$name][] = $arguments[0];
101 101
                 }
102 102
             } else {
103
-                throw new PhpfastcacheInvalidArgumentException(\sprintf('Expected Callable, got "%s"', \gettype($arguments[ 0 ])));
103
+                throw new PhpfastcacheInvalidArgumentException(\sprintf('Expected Callable, got "%s"', \gettype($arguments[0])));
104 104
             }
105 105
         } else {
106 106
             throw new \BadMethodCallException('An event must start with "on" such as "onCacheGetItem"');
@@ -114,8 +114,8 @@  discard block
 block discarded – undo
114 114
      */
115 115
     public function unbindEventCallback($eventName, $callbackName): bool
116 116
     {
117
-        $return = isset($this->events[ $eventName ][ $callbackName ]);
118
-        unset($this->events[ $eventName ][ $callbackName ]);
117
+        $return = isset($this->events[$eventName][$callbackName]);
118
+        unset($this->events[$eventName][$callbackName]);
119 119
 
120 120
         return $return;
121 121
     }
Please login to merge, or discard this patch.