Completed
Pull Request — final (#320)
by Georges
05:45 queued 02:37
created
src/phpFastCache/Drivers/Sqlite/Driver.php 2 patches
Spacing   +11 added lines, -11 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,8 +329,8 @@  discard block
 block discarded – undo
329 329
             }
330 330
         }
331 331
 
332
-        if (isset($row[ 'object' ])) {
333
-            return $this->decode($row[ 'object' ]);
332
+        if (isset($row['object'])) {
333
+            return $this->decode($row['object']);
334 334
         }
335 335
 
336 336
         return null;
Please login to merge, or discard this patch.
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -16,10 +16,8 @@
 block discarded – undo
16 16
 
17 17
 use PDO;
18 18
 use PDOException;
19
-use phpFastCache\Cache\ExtendedCacheItemInterface;
20 19
 use phpFastCache\Core\DriverAbstract;
21 20
 use phpFastCache\Core\PathSeekerTrait;
22
-use phpFastCache\Core\StandardPsr6StructureTrait;
23 21
 use phpFastCache\Entities\driverStatistic;
24 22
 use phpFastCache\Exceptions\phpFastCacheDriverCheckException;
25 23
 use phpFastCache\Exceptions\phpFastCacheDriverException;
Please login to merge, or discard this patch.
src/phpFastCache/Core/StandardPsr6StructureTrait.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
                         $item->setHit(true);
73 73
                     }
74 74
                 } else {
75
-                    $item->expiresAfter(abs((int) $this->getConfig()[ 'defaultTtl' ]));
75
+                    $item->expiresAfter(abs((int) $this->getConfig()['defaultTtl']));
76 76
                 }
77 77
 
78 78
             }
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
             throw new \InvalidArgumentException(sprintf('$key must be a string, got type "%s" instead.', gettype($key)));
81 81
         }
82 82
 
83
-        return $this->itemInstances[ $key ];
83
+        return $this->itemInstances[$key];
84 84
     }
85 85
 
86 86
     /**
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
     public function setItem(CacheItemInterface $item)
92 92
     {
93 93
         if ($this->getClassNamespace() . '\\Item' === get_class($item)) {
94
-            $this->itemInstances[ $item->getKey() ] = $item;
94
+            $this->itemInstances[$item->getKey()] = $item;
95 95
 
96 96
             return $this;
97 97
         } else {
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
     {
109 109
         $collection = [];
110 110
         foreach ($keys as $key) {
111
-            $collection[ $key ] = $this->getItem($key);
111
+            $collection[$key] = $this->getItem($key);
112 112
         }
113 113
 
114 114
         return $collection;
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
          * @var ExtendedCacheItemInterface $item
190 190
          */
191 191
         if (!array_key_exists($item->getKey(), $this->itemInstances)) {
192
-            $this->itemInstances[ $item->getKey() ] = $item;
192
+            $this->itemInstances[$item->getKey()] = $item;
193 193
         }
194 194
         if ($this->driverWrite($item) && $this->driverWriteTags($item)) {
195 195
             $item->setHit(true);
@@ -208,10 +208,10 @@  discard block
 block discarded – undo
208 208
     public function saveDeferred(CacheItemInterface $item)
209 209
     {
210 210
         if (!array_key_exists($item->getKey(), $this->itemInstances)) {
211
-            $this->itemInstances[ $item->getKey() ] = $item;
211
+            $this->itemInstances[$item->getKey()] = $item;
212 212
         }
213 213
 
214
-        return $this->deferredList[ $item->getKey() ] = $item;
214
+        return $this->deferredList[$item->getKey()] = $item;
215 215
     }
216 216
 
217 217
     /**
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
         foreach ($this->deferredList as $key => $item) {
225 225
             $result = $this->save($item);
226 226
             if ($return !== false) {
227
-                unset($this->deferredList[ $key ]);
227
+                unset($this->deferredList[$key]);
228 228
                 $return = $result;
229 229
             }
230 230
         }
Please login to merge, or discard this patch.
src/phpFastCache/Core/ExtendedCacheItemPoolTrait.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
      */
48 48
     public function getItemsAsJsonString(array $keys = [], $option = 0, $depth = 512)
49 49
     {
50
-        $callback = function(CacheItemInterface $item){
50
+        $callback = function(CacheItemInterface $item) {
51 51
             return $item->get();
52 52
         };
53 53
         return json_encode(array_map($callback, array_values($this->getItems($keys))), $option, $depth);
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
                  *
76 76
                  * #headache
77 77
                  */
78
-                return array_filter($this->getItems(array_unique(array_keys($items))), function(ExtendedCacheItemInterface $item){
78
+                return array_filter($this->getItems(array_unique(array_keys($items))), function(ExtendedCacheItemInterface $item) {
79 79
                     return $item->isHit();
80 80
                 });
81 81
             } else {
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
      */
118 118
     public function getItemsByTagsAsJsonString(array $tagNames, $option = 0, $depth = 512)
119 119
     {
120
-        $callback = function(CacheItemInterface $item){
120
+        $callback = function(CacheItemInterface $item) {
121 121
             return $item->get();
122 122
         };
123 123
 
@@ -302,15 +302,15 @@  discard block
 block discarded – undo
302 302
      */
303 303
     protected function deregisterItem($item)
304 304
     {
305
-        if($item instanceof CacheItemInterface){
306
-            unset($this->itemInstances[ $item->getKey() ]);
305
+        if ($item instanceof CacheItemInterface) {
306
+            unset($this->itemInstances[$item->getKey()]);
307 307
 
308
-        }else if(is_string($item)){
309
-            unset($this->itemInstances[ $item ]);
310
-        }else{
308
+        } else if (is_string($item)) {
309
+            unset($this->itemInstances[$item]);
310
+        } else {
311 311
             throw new \InvalidArgumentException('Invalid type for $item variable');
312 312
         }
313
-        if(gc_enabled()){
313
+        if (gc_enabled()) {
314 314
             gc_collect_cycles();
315 315
         }
316 316
     }
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -305,9 +305,9 @@
 block discarded – undo
305 305
         if($item instanceof CacheItemInterface){
306 306
             unset($this->itemInstances[ $item->getKey() ]);
307 307
 
308
-        }else if(is_string($item)){
308
+        } else if(is_string($item)){
309 309
             unset($this->itemInstances[ $item ]);
310
-        }else{
310
+        } else{
311 311
             throw new \InvalidArgumentException('Invalid type for $item variable');
312 312
         }
313 313
         if(gc_enabled()){
Please login to merge, or discard this patch.