Completed
Push — v5 ( a234cb...4f37c0 )
by Georges
02:54
created
src/phpFastCache/Drivers/Mongodb/Driver.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
                 return false;
93 93
             }
94 94
 
95
-            return isset($result[ 'ok' ]) ? $result[ 'ok' ] == 1 : true;
95
+            return isset($result['ok']) ? $result['ok'] == 1 : true;
96 96
         } else {
97 97
             throw new \InvalidArgumentException('Cross-Driver type confusion detected');
98 98
         }
@@ -108,9 +108,9 @@  discard block
 block discarded – undo
108 108
 
109 109
         if ($document) {
110 110
             return [
111
-              self::DRIVER_DATA_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_DATA_WRAPPER_INDEX ]->bin),
112
-              self::DRIVER_TIME_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_TIME_WRAPPER_INDEX ]->sec),
113
-              self::DRIVER_TAGS_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_TAGS_WRAPPER_INDEX ]->bin),
111
+              self::DRIVER_DATA_WRAPPER_INDEX => $this->decode($document[self::DRIVER_DATA_WRAPPER_INDEX]->bin),
112
+              self::DRIVER_TIME_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[self::DRIVER_TIME_WRAPPER_INDEX]->sec),
113
+              self::DRIVER_TAGS_WRAPPER_INDEX => $this->decode($document[self::DRIVER_TAGS_WRAPPER_INDEX]->bin),
114 114
             ];
115 115
         } else {
116 116
             return null;
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
         if ($item instanceof Item) {
131 131
             $deletionResult = (array) $this->getCollection()->remove(['_id' => $item->getKey()], ["w" => 1]);
132 132
 
133
-            return (int) $deletionResult[ 'ok' ] === 1 && !$deletionResult[ 'err' ];
133
+            return (int) $deletionResult['ok'] === 1 && !$deletionResult['err'];
134 134
         } else {
135 135
             throw new \InvalidArgumentException('Cross-Driver type confusion detected');
136 136
         }
@@ -154,11 +154,11 @@  discard block
 block discarded – undo
154 154
         if ($this->instance instanceof MongodbClient) {
155 155
             throw new LogicException('Already connected to Mongodb server');
156 156
         } else {
157
-            $host = isset($this->config[ 'host' ]) ? $this->config[ 'host' ] : '127.0.0.1';
158
-            $port = isset($server[ 'port' ]) ? $server[ 'port' ] : '27017';
159
-            $timeout = isset($server[ 'timeout' ]) ? $server[ 'timeout' ] : 3;
160
-            $password = isset($this->config[ 'password' ]) ? $this->config[ 'password' ] : '';
161
-            $username = isset($this->config[ 'username' ]) ? $this->config[ 'username' ] : '';
157
+            $host = isset($this->config['host']) ? $this->config['host'] : '127.0.0.1';
158
+            $port = isset($server['port']) ? $server['port'] : '27017';
159
+            $timeout = isset($server['timeout']) ? $server['timeout'] : 3;
160
+            $password = isset($this->config['password']) ? $this->config['password'] : '';
161
+            $username = isset($this->config['username']) ? $this->config['username'] : '';
162 162
 
163 163
 
164 164
             /**
@@ -206,8 +206,8 @@  discard block
 block discarded – undo
206 206
         ]);
207 207
 
208 208
         $stats = (new driverStatistic())
209
-          ->setInfo('MongoDB version ' . $serverStatus[ 'version' ] . ', Uptime (in days): ' . round($serverStatus[ 'uptime' ] / 86400, 1) . "\n For more information see RawData.")
210
-          ->setSize((int) $collStats[ 'size' ])
209
+          ->setInfo('MongoDB version ' . $serverStatus['version'] . ', Uptime (in days): ' . round($serverStatus['uptime'] / 86400, 1) . "\n For more information see RawData.")
210
+          ->setSize((int) $collStats['size'])
211 211
           ->setData(implode(', ', array_keys($this->itemInstances)))
212 212
           ->setRawData([
213 213
             'serverStatus' => $serverStatus,
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Sqlite/Driver.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -162,12 +162,12 @@  discard block
 block discarded – undo
162 162
             $stm = $this->indexing->prepare("SELECT MAX(`db`) as `db` FROM `balancing`");
163 163
             $stm->execute();
164 164
             $row = $stm->fetch(PDO::FETCH_ASSOC);
165
-            if (!isset($row[ 'db' ])) {
165
+            if (!isset($row['db'])) {
166 166
                 $db = 1;
167
-            } elseif ($row[ 'db' ] <= 1) {
167
+            } elseif ($row['db'] <= 1) {
168 168
                 $db = 1;
169 169
             } else {
170
-                $db = $row[ 'db' ];
170
+                $db = $row['db'];
171 171
             }
172 172
 
173 173
             // check file size
@@ -189,8 +189,8 @@  discard block
 block discarded – undo
189 189
           ':keyword' => $keyword,
190 190
         ]);
191 191
         $row = $stm->fetch(PDO::FETCH_ASSOC);
192
-        if (isset($row[ 'db' ]) && $row[ 'db' ] != '') {
193
-            $db = $row[ 'db' ];
192
+        if (isset($row['db']) && $row['db'] != '') {
193
+            $db = $row['db'];
194 194
         } else {
195 195
             /*
196 196
              * Insert new to Indexing
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
         /**
222 222
          * init instant
223 223
          */
224
-        if (!isset($this->instance[ $instant ])) {
224
+        if (!isset($this->instance[$instant])) {
225 225
             // check DB Files ready or not
226 226
             $createTable = false;
227 227
             if (!file_exists($this->SqliteDir . '/db' . $instant) || $reset == true) {
@@ -234,12 +234,12 @@  discard block
 block discarded – undo
234 234
                 $this->initDB($PDO);
235 235
             }
236 236
 
237
-            $this->instance[ $instant ] = $PDO;
237
+            $this->instance[$instant] = $PDO;
238 238
             unset($PDO);
239 239
 
240 240
         }
241 241
 
242
-        return $this->instance[ $instant ];
242
+        return $this->instance[$instant];
243 243
     }
244 244
 
245 245
     /**
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
          * Check for Cross-Driver type confusion
254 254
          */
255 255
         if ($item instanceof Item) {
256
-            $skipExisting = isset($this->config[ 'skipExisting' ]) ? $this->config[ 'skipExisting' ] : false;
256
+            $skipExisting = isset($this->config['skipExisting']) ? $this->config['skipExisting'] : false;
257 257
             $toWrite = true;
258 258
 
259 259
             // check in cache first
@@ -329,18 +329,18 @@  discard block
 block discarded – undo
329 329
             }
330 330
         }
331 331
 
332
-        if (isset($row[ 'id' ])) {
332
+        if (isset($row['id'])) {
333 333
             /**
334 334
              * @var $item ExtendedCacheItemInterface
335 335
              */
336
-            $item = $this->decode($row[ 'object' ]);
336
+            $item = $this->decode($row['object']);
337 337
             if ($item instanceof ExtendedCacheItemInterface && $item->isExpired()) {
338 338
                 $this->driverDelete($item);
339 339
 
340 340
                 return null;
341 341
             }
342 342
 
343
-            return $this->decode($row[ 'object' ]);
343
+            return $this->decode($row['object']);
344 344
         }
345 345
 
346 346
         return null;
Please login to merge, or discard this patch.
src/phpFastCache/Cache/ItemBaseTrait.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -114,10 +114,10 @@  discard block
 block discarded – undo
114 114
      */
115 115
     public function setHit($isHit)
116 116
     {
117
-        if(is_bool($isHit)){
117
+        if (is_bool($isHit)) {
118 118
             $this->isHit = $isHit;
119 119
             return $this;
120
-        }else{
120
+        } else {
121 121
             throw new \InvalidArgumentException('$isHit must be a boolean');
122 122
         }
123 123
     }
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
     public function removeTag($tagName)
370 370
     {
371 371
         if (($key = array_search($tagName, $this->tags)) !== false) {
372
-            unset($this->tags[ $key ]);
372
+            unset($this->tags[$key]);
373 373
             $this->removedTags[] = $tagName;
374 374
         }
375 375
 
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
     final public function __debugInfo()
416 416
     {
417 417
         $info = get_object_vars($this);
418
-        $info[ 'driver' ] = 'object(' . get_class($info[ 'driver' ]) . ')';
418
+        $info['driver'] = 'object(' . get_class($info['driver']) . ')';
419 419
 
420 420
         return (array) $info;
421 421
     }
Please login to merge, or discard this patch.
src/phpFastCache/Core/StandardPsr6StructureTrait.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
                          * getItem() call in delete() method
66 66
                          */
67 67
                         $this->driverDelete($item);
68
-                    }else{
68
+                    } else {
69 69
                         $item->setHit(true);
70 70
                     }
71 71
                 }
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
             throw new \InvalidArgumentException(sprintf('$key must be a string, got type "%s" instead.', gettype($key)));
76 76
         }
77 77
 
78
-        return $this->itemInstances[ $key ];
78
+        return $this->itemInstances[$key];
79 79
     }
80 80
 
81 81
     /**
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
     public function setItem(CacheItemInterface $item)
87 87
     {
88 88
         if ($this->getClassNamespace() . '\\Item' === get_class($item)) {
89
-            $this->itemInstances[ $item->getKey() ] = $item;
89
+            $this->itemInstances[$item->getKey()] = $item;
90 90
 
91 91
             return $this;
92 92
         } else {
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
     {
104 104
         $collection = [];
105 105
         foreach ($keys as $key) {
106
-            $collection[ $key ] = $this->getItem($key);
106
+            $collection[$key] = $this->getItem($key);
107 107
         }
108 108
 
109 109
         return $collection;
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
         if ($this->hasItem($key) && $this->driverDelete($item)) {
147 147
             $item->setHit(false);
148 148
             CacheManager::$WriteHits++;
149
-            unset($this->itemInstances[ $key ]);
149
+            unset($this->itemInstances[$key]);
150 150
 
151 151
             return true;
152 152
         }
@@ -183,9 +183,9 @@  discard block
 block discarded – undo
183 183
          * @var ExtendedCacheItemInterface $item
184 184
          */
185 185
         if (!array_key_exists($item->getKey(), $this->itemInstances)) {
186
-            $this->itemInstances[ $item->getKey() ] = $item;
186
+            $this->itemInstances[$item->getKey()] = $item;
187 187
         }
188
-        if($this->driverWrite($item) && $this->driverWriteTags($item))
188
+        if ($this->driverWrite($item) && $this->driverWriteTags($item))
189 189
         {
190 190
             $item->setHit(true);
191 191
             CacheManager::$WriteHits++;
@@ -202,10 +202,10 @@  discard block
 block discarded – undo
202 202
     public function saveDeferred(CacheItemInterface $item)
203 203
     {
204 204
         if (!array_key_exists($item->getKey(), $this->itemInstances)) {
205
-            $this->itemInstances[ $item->getKey() ] = $item;
205
+            $this->itemInstances[$item->getKey()] = $item;
206 206
         }
207 207
 
208
-        return $this->deferredList[ $item->getKey() ] = $item;
208
+        return $this->deferredList[$item->getKey()] = $item;
209 209
     }
210 210
 
211 211
     /**
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
         foreach ($this->deferredList as $key => $item) {
219 219
             $result = $this->save($item);
220 220
             if ($return !== false) {
221
-                unset($this->deferredList[ $key ]);
221
+                unset($this->deferredList[$key]);
222 222
                 $return = $result;
223 223
             }
224 224
         }
Please login to merge, or discard this patch.