Passed
Push — v7 ( c76e96...311aed )
by Georges
01:40
created
lib/Phpfastcache/Drivers/Devnull/Driver.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\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
 
@@ -112,9 +112,9 @@  discard block
 block discarded – undo
112 112
     {
113 113
         $stat = new DriverStatistic();
114 114
         $stat->setInfo('[Devnull] A void info string')
115
-          ->setSize(0)
116
-          ->setData(\implode(', ', \array_keys($this->itemInstances)))
117
-          ->setRawData(null);
115
+            ->setSize(0)
116
+            ->setData(\implode(', ', \array_keys($this->itemInstances)))
117
+            ->setRawData(null);
118 118
 
119 119
         return $stat;
120 120
     }
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\Drivers\Devnull;
17 17
 
Please login to merge, or discard this patch.
lib/Phpfastcache/Drivers/Ssdb/Item.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
 use Phpfastcache\Core\Pool\ExtendedCacheItemPoolInterface;
20 20
 use Phpfastcache\Drivers\Ssdb\Driver as SsdbDriver;
21 21
 use Phpfastcache\Exceptions\{
22
-  phpFastCacheInvalidArgumentException, phpFastCacheInvalidArgumentTypeException
22
+    phpFastCacheInvalidArgumentException, phpFastCacheInvalidArgumentTypeException
23 23
 };
24 24
 
25 25
 /**
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\Drivers\Ssdb;
17 17
 
Please login to merge, or discard this patch.
lib/Phpfastcache/Drivers/Ssdb/Driver.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\Core\Pool\{DriverBaseTrait, ExtendedCacheItemPoolInterface};
19 19
 use Phpfastcache\Entities\DriverStatistic;
20 20
 use Phpfastcache\Exceptions\{
21
-  phpFastCacheInvalidArgumentException, phpFastCacheDriverCheckException, phpFastCacheDriverException
21
+    phpFastCacheInvalidArgumentException, phpFastCacheDriverCheckException, phpFastCacheDriverException
22 22
 };
23 23
 use Phpfastcache\Util\ArrayObject;
24 24
 use phpssdb\Core\{SimpleSSDB, SSDBException};
@@ -147,9 +147,9 @@  discard block
 block discarded – undo
147 147
          * using hardcoded offset of pair key-value :-(
148 148
          */
149 149
         $stat->setInfo(\sprintf("Ssdb-server v%s with a total of %s call(s).\n For more information see RawData.", $info[ 2 ], $info[ 6 ]))
150
-          ->setRawData($info)
151
-          ->setData(\implode(', ', \array_keys($this->itemInstances)))
152
-          ->setSize($this->instance->dbsize());
150
+            ->setRawData($info)
151
+            ->setData(\implode(', ', \array_keys($this->itemInstances)))
152
+            ->setSize($this->instance->dbsize());
153 153
 
154 154
         return $stat;
155 155
     }
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\Drivers\Ssdb;
17 17
 
@@ -57,9 +57,9 @@  discard block
 block discarded – undo
57 57
         try {
58 58
             $clientConfig = $this->getConfig();
59 59
 
60
-            $this->instance = new SimpleSSDB($clientConfig[ 'host' ], $clientConfig[ 'port' ], $clientConfig[ 'timeout' ]);
61
-            if (!empty($clientConfig[ 'password' ])) {
62
-                $this->instance->auth($clientConfig[ 'password' ]);
60
+            $this->instance = new SimpleSSDB($clientConfig['host'], $clientConfig['port'], $clientConfig['timeout']);
61
+            if (!empty($clientConfig['password'])) {
62
+                $this->instance->auth($clientConfig['password']);
63 63
             }
64 64
 
65 65
             if (!$this->instance) {
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
          * Data returned by Ssdb are very poorly formatted
147 147
          * using hardcoded offset of pair key-value :-(
148 148
          */
149
-        $stat->setInfo(\sprintf("Ssdb-server v%s with a total of %s call(s).\n For more information see RawData.", $info[ 2 ], $info[ 6 ]))
149
+        $stat->setInfo(\sprintf("Ssdb-server v%s with a total of %s call(s).\n For more information see RawData.", $info[2], $info[6]))
150 150
           ->setRawData($info)
151 151
           ->setData(\implode(', ', \array_keys($this->itemInstances)))
152 152
           ->setSize($this->instance->dbsize());
Please login to merge, or discard this patch.
lib/Phpfastcache/Drivers/Memstatic/Item.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
 use Phpfastcache\Core\Pool\ExtendedCacheItemPoolInterface;
20 20
 use Phpfastcache\Drivers\Memstatic\Driver as MemstaticDriver;
21 21
 use Phpfastcache\Exceptions\{
22
-  phpFastCacheInvalidArgumentException, phpFastCacheInvalidArgumentTypeException
22
+    phpFastCacheInvalidArgumentException, phpFastCacheInvalidArgumentTypeException
23 23
 };
24 24
 
25 25
 /**
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\Drivers\Memstatic;
17 17
 
Please login to merge, or discard this patch.
lib/Phpfastcache/Drivers/Memstatic/Driver.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\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
 
@@ -129,9 +129,9 @@  discard block
 block discarded – undo
129 129
     {
130 130
         $stat = new DriverStatistic();
131 131
         $stat->setInfo('[Memstatic] A memory static driver')
132
-          ->setSize(mb_strlen(\serialize($this->staticStack)))
133
-          ->setData(\implode(', ', \array_keys($this->itemInstances)))
134
-          ->setRawData($this->staticStack);
132
+            ->setSize(mb_strlen(\serialize($this->staticStack)))
133
+            ->setData(\implode(', ', \array_keys($this->itemInstances)))
134
+            ->setRawData($this->staticStack);
135 135
 
136 136
         return $stat;
137 137
     }
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\Memstatic;
17 17
 
@@ -60,8 +60,8 @@  discard block
 block discarded – undo
60 60
     protected function driverRead(CacheItemInterface $item)
61 61
     {
62 62
         $key = \md5($item->getKey());
63
-        if (isset($this->staticStack[ $key ])) {
64
-            return $this->staticStack[ $key ];
63
+        if (isset($this->staticStack[$key])) {
64
+            return $this->staticStack[$key];
65 65
         }
66 66
         return null;
67 67
     }
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
          * Check for Cross-Driver type confusion
78 78
          */
79 79
         if ($item instanceof Item) {
80
-            $this->staticStack[ \md5($item->getKey()) ] = $this->driverPreWrap($item);
80
+            $this->staticStack[\md5($item->getKey())] = $this->driverPreWrap($item);
81 81
             return true;
82 82
         }
83 83
 
@@ -96,8 +96,8 @@  discard block
 block discarded – undo
96 96
          */
97 97
         if ($item instanceof Item) {
98 98
             $key = \md5($item->getKey());
99
-            if (isset($this->staticStack[ $key ])) {
100
-                unset($this->staticStack[ $key ]);
99
+            if (isset($this->staticStack[$key])) {
100
+                unset($this->staticStack[$key]);
101 101
                 return true;
102 102
             }
103 103
             return false;
Please login to merge, or discard this patch.
lib/Phpfastcache/Drivers/Memcached/Item.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
 use Phpfastcache\Core\Pool\ExtendedCacheItemPoolInterface;
20 20
 use Phpfastcache\Drivers\Memcached\Driver as MemcachedDriver;
21 21
 use Phpfastcache\Exceptions\{
22
-  phpFastCacheInvalidArgumentException, phpFastCacheInvalidArgumentTypeException
22
+    phpFastCacheInvalidArgumentException, phpFastCacheInvalidArgumentTypeException
23 23
 };
24 24
 
25 25
 /**
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\Drivers\Memcached;
17 17
 
Please login to merge, or discard this patch.
lib/Phpfastcache/Drivers/Memcached/Driver.php 3 patches
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\Drivers\Memcached;
17 17
 
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
                 'path' => !empty($this->config->getOption('path')) ? $this->config->getOption('path') : false,
75 75
                 'port' => !empty($this->config->getOption('port')) ? $this->config->getOption('port') : 11211,
76 76
                 'saslUser' => !empty($this->config->getOption('saslUser')) ? $this->config->getOption('saslUser') : false,
77
-                'saslPassword' =>!empty($this->config->getOption('saslPassword')) ? $this->config->getOption('saslPassword'): false,
77
+                'saslPassword' =>!empty($this->config->getOption('saslPassword')) ? $this->config->getOption('saslPassword') : false,
78 78
               ],
79 79
             ];
80 80
         }
@@ -84,14 +84,14 @@  discard block
 block discarded – undo
84 84
                 /**
85 85
                  * If path is provided we consider it as an UNIX Socket
86 86
                  */
87
-                if(!empty($server[ 'path' ]) && !$this->instance->addServer($server[ 'path' ], 0)){
87
+                if (!empty($server['path']) && !$this->instance->addServer($server['path'], 0)) {
88 88
                     $this->fallback = true;
89
-                }else if (!empty($server[ 'host' ]) && !$this->instance->addServer($server[ 'host' ], $server[ 'port' ])) {
89
+                } else if (!empty($server['host']) && !$this->instance->addServer($server['host'], $server['port'])) {
90 90
                     $this->fallback = true;
91 91
                 }
92 92
 
93
-                if (!empty($server[ 'saslUser' ]) && !empty($server[ 'saslPassword' ])) {
94
-                    $this->instance->setSaslAuthData($server[ 'saslUser' ], $server[ 'saslPassword' ]);
93
+                if (!empty($server['saslUser']) && !empty($server['saslPassword'])) {
94
+                    $this->instance->setSaslAuthData($server['saslUser'], $server['saslPassword']);
95 95
                 }
96 96
 
97 97
             } catch (\Exception $e) {
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
          * any error if not connected ...
105 105
          */
106 106
         $version = $this->instance->getVersion();
107
-        if(!$version || $this->instance->getResultCode() !== MemcachedSoftware::RES_SUCCESS){
107
+        if (!$version || $this->instance->getResultCode() !== MemcachedSoftware::RES_SUCCESS) {
108 108
             throw new phpFastCacheDriverException('Memcached seems to not be connected');
109 109
         }
110 110
         return true;
@@ -187,16 +187,16 @@  discard block
 block discarded – undo
187 187
     public function getStats(): DriverStatistic
188 188
     {
189 189
         $stats = current($this->instance->getStats());
190
-        $stats[ 'uptime' ] = (isset($stats[ 'uptime' ]) ? $stats[ 'uptime' ] : 0);
191
-        $stats[ 'version' ] = (isset($stats[ 'version' ]) ? $stats[ 'version' ] : $this->instance->getVersion());
192
-        $stats[ 'bytes' ] = (isset($stats[ 'bytes' ]) ? $stats[ 'version' ] : 0);
190
+        $stats['uptime'] = (isset($stats['uptime']) ? $stats['uptime'] : 0);
191
+        $stats['version'] = (isset($stats['version']) ? $stats['version'] : $this->instance->getVersion());
192
+        $stats['bytes'] = (isset($stats['bytes']) ? $stats['version'] : 0);
193 193
 
194
-        $date = (new \DateTime())->setTimestamp(time() - $stats[ 'uptime' ]);
194
+        $date = (new \DateTime())->setTimestamp(time() - $stats['uptime']);
195 195
 
196 196
         return (new DriverStatistic())
197 197
           ->setData(\implode(', ', \array_keys($this->itemInstances)))
198
-          ->setInfo(\sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats[ 'version' ], $date->format(DATE_RFC2822)))
198
+          ->setInfo(\sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats['version'], $date->format(DATE_RFC2822)))
199 199
           ->setRawData($stats)
200
-          ->setSize((int)$stats[ 'bytes' ]);
200
+          ->setSize((int) $stats['bytes']);
201 201
     }
202 202
 }
203 203
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -152,7 +152,7 @@
 block discarded – undo
152 152
                  */
153 153
                 if(!empty($server[ 'path' ]) && !$this->instance->addServer($server[ 'path' ], 0)){
154 154
                     $this->fallback = true;
155
-                }else if (!empty($server[ 'host' ]) && !$this->instance->addServer($server[ 'host' ], $server[ 'port' ])) {
155
+                } else if (!empty($server[ 'host' ]) && !$this->instance->addServer($server[ 'host' ], $server[ 'port' ])) {
156 156
                     $this->fallback = true;
157 157
                 }
158 158
 
Please login to merge, or discard this patch.
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 use Phpfastcache\Core\Pool\{DriverBaseTrait, ExtendedCacheItemPoolInterface};
21 21
 use Phpfastcache\Entities\DriverStatistic;
22 22
 use Phpfastcache\Exceptions\{
23
-  phpFastCacheInvalidArgumentException, phpFastCacheDriverException
23
+    phpFastCacheInvalidArgumentException, phpFastCacheDriverException
24 24
 };
25 25
 use Phpfastcache\Util\{ArrayObject, MemcacheDriverCollisionDetectorTrait};
26 26
 use Psr\Cache\CacheItemInterface;
@@ -73,13 +73,13 @@  discard block
 block discarded – undo
73 73
         $servers = (!empty($this->config->getOption('servers')) && \is_array($this->config->getOption('servers')) ? $this->config->getOption('servers') : []);
74 74
         if (\count($servers) < 1) {
75 75
             $servers = [
76
-              [
76
+                [
77 77
                 'host' => !empty($this->config->getOption('host')) ? $this->config->getOption('host') : '127.0.0.1',
78 78
                 'path' => !empty($this->config->getOption('path')) ? $this->config->getOption('path') : false,
79 79
                 'port' => !empty($this->config->getOption('port')) ? $this->config->getOption('port') : 11211,
80 80
                 'saslUser' => !empty($this->config->getOption('saslUser')) ? $this->config->getOption('saslUser') : false,
81 81
                 'saslPassword' =>!empty($this->config->getOption('saslPassword')) ? $this->config->getOption('saslPassword'): false,
82
-              ],
82
+                ],
83 83
             ];
84 84
         }
85 85
 
@@ -196,9 +196,9 @@  discard block
 block discarded – undo
196 196
         $date = (new \DateTime())->setTimestamp(time() - $stats[ 'uptime' ]);
197 197
 
198 198
         return (new DriverStatistic())
199
-          ->setData(\implode(', ', \array_keys($this->itemInstances)))
200
-          ->setInfo(\sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats[ 'version' ], $date->format(DATE_RFC2822)))
201
-          ->setRawData($stats)
202
-          ->setSize((int)$stats[ 'bytes' ]);
199
+            ->setData(\implode(', ', \array_keys($this->itemInstances)))
200
+            ->setInfo(\sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats[ 'version' ], $date->format(DATE_RFC2822)))
201
+            ->setRawData($stats)
202
+            ->setSize((int)$stats[ 'bytes' ]);
203 203
     }
204 204
 }
205 205
\ No newline at end of file
Please login to merge, or discard this patch.
lib/Phpfastcache/Drivers/Mongodb/Item.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
 use Phpfastcache\Core\Pool\ExtendedCacheItemPoolInterface;
20 20
 use Phpfastcache\Drivers\Mongodb\Driver as MongodbDriver;
21 21
 use Phpfastcache\Exceptions\{
22
-  phpFastCacheInvalidArgumentException, phpFastCacheInvalidArgumentTypeException
22
+    phpFastCacheInvalidArgumentException, phpFastCacheInvalidArgumentTypeException
23 23
 };
24 24
 
25 25
 /**
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\Drivers\Mongodb;
17 17
 
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.