Completed
Pull Request — final (#306)
by Georges
03:20 queued 46s
created
src/phpFastCache/Drivers/Mongodb/Driver.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
      */
60 60
     public function driverCheck()
61 61
     {
62
-        if(class_exists('MongoDB\Driver\Manager')){
62
+        if (class_exists('MongoDB\Driver\Manager')) {
63 63
             trigger_error('PhpFastCache currently only support the pecl Mongo extension.<br />
64 64
             The Support for the MongoDB extension will be added coming soon.', E_USER_ERROR);
65 65
         }
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
                 return false;
95 95
             }
96 96
 
97
-            return isset($result[ 'ok' ]) ? $result[ 'ok' ] == 1 : true;
97
+            return isset($result['ok']) ? $result['ok'] == 1 : true;
98 98
         } else {
99 99
             throw new \InvalidArgumentException('Cross-Driver type confusion detected');
100 100
         }
@@ -112,9 +112,9 @@  discard block
 block discarded – undo
112 112
 
113 113
         if ($document) {
114 114
             return [
115
-              self::DRIVER_DATA_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_DATA_WRAPPER_INDEX ]->bin),
116
-              self::DRIVER_TIME_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_TIME_WRAPPER_INDEX ]->sec),
117
-              self::DRIVER_TAGS_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_TAGS_WRAPPER_INDEX ]->bin),
115
+              self::DRIVER_DATA_WRAPPER_INDEX => $this->decode($document[self::DRIVER_DATA_WRAPPER_INDEX]->bin),
116
+              self::DRIVER_TIME_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[self::DRIVER_TIME_WRAPPER_INDEX]->sec),
117
+              self::DRIVER_TAGS_WRAPPER_INDEX => $this->decode($document[self::DRIVER_TAGS_WRAPPER_INDEX]->bin),
118 118
             ];
119 119
         } else {
120 120
             return null;
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
         if ($item instanceof Item) {
135 135
             $deletionResult = (array) $this->getCollection()->remove(['_id' => $item->getKey()], ["w" => 1]);
136 136
 
137
-            return (int) $deletionResult[ 'ok' ] === 1 && !$deletionResult[ 'err' ];
137
+            return (int) $deletionResult['ok'] === 1 && !$deletionResult['err'];
138 138
         } else {
139 139
             throw new \InvalidArgumentException('Cross-Driver type confusion detected');
140 140
         }
@@ -158,11 +158,11 @@  discard block
 block discarded – undo
158 158
         if ($this->instance instanceof MongodbClient) {
159 159
             throw new LogicException('Already connected to Mongodb server');
160 160
         } else {
161
-            $host = isset($this->config[ 'host' ]) ? $this->config[ 'host' ] : '127.0.0.1';
162
-            $port = isset($server[ 'port' ]) ? $server[ 'port' ] : '27017';
163
-            $timeout = isset($server[ 'timeout' ]) ? $server[ 'timeout' ] : 3;
164
-            $password = isset($this->config[ 'password' ]) ? $this->config[ 'password' ] : '';
165
-            $username = isset($this->config[ 'username' ]) ? $this->config[ 'username' ] : '';
161
+            $host = isset($this->config['host']) ? $this->config['host'] : '127.0.0.1';
162
+            $port = isset($server['port']) ? $server['port'] : '27017';
163
+            $timeout = isset($server['timeout']) ? $server['timeout'] : 3;
164
+            $password = isset($this->config['password']) ? $this->config['password'] : '';
165
+            $username = isset($this->config['username']) ? $this->config['username'] : '';
166 166
 
167 167
 
168 168
             /**
@@ -210,8 +210,8 @@  discard block
 block discarded – undo
210 210
         ]);
211 211
 
212 212
         $stats = (new driverStatistic())
213
-          ->setInfo('MongoDB version ' . $serverStatus[ 'version' ] . ', Uptime (in days): ' . round($serverStatus[ 'uptime' ] / 86400, 1) . "\n For more information see RawData.")
214
-          ->setSize((int) @$collStats[ 'size' ])
213
+          ->setInfo('MongoDB version ' . $serverStatus['version'] . ', Uptime (in days): ' . round($serverStatus['uptime'] / 86400, 1) . "\n For more information see RawData.")
214
+          ->setSize((int) @$collStats['size'])
215 215
           ->setData(implode(', ', array_keys($this->itemInstances)))
216 216
           ->setRawData([
217 217
             'serverStatus' => $serverStatus,
Please login to merge, or discard this patch.