@@ -162,12 +162,12 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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; |
@@ -16,10 +16,8 @@ |
||
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; |
@@ -72,7 +72,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -47,7 +47,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -305,9 +305,9 @@ |
||
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()){ |
@@ -42,10 +42,10 @@ |
||
42 | 42 | if (!is_object($driverInstance->getItem('test'))) { |
43 | 43 | echo '[FAIL] $driverInstance->getItem() returned an invalid var type:' . gettype($driverInstance) . "\n"; |
44 | 44 | $status = 1; |
45 | -}else if(!($driverInstance->getItem('test') instanceof ExtendedCacheItemInterface)){ |
|
45 | +} else if (!($driverInstance->getItem('test') instanceof ExtendedCacheItemInterface)) { |
|
46 | 46 | echo '[FAIL] $driverInstance->getItem() returned an invalid class that does not implements ExtendedCacheItemInterface: ' . get_class($driverInstance) . "\n"; |
47 | 47 | $status = 1; |
48 | -}else{ |
|
48 | +} else { |
|
49 | 49 | echo '[PASS] $driverInstance->getItem() returned a valid class that implements ExtendedCacheItemInterface: ' . get_class($driverInstance) . "\n"; |
50 | 50 | } |
51 | 51 |
@@ -42,10 +42,10 @@ |
||
42 | 42 | if (!is_object($driverInstance->getItem('test'))) { |
43 | 43 | echo '[FAIL] $driverInstance->getItem() returned an invalid var type:' . gettype($driverInstance) . "\n"; |
44 | 44 | $status = 1; |
45 | -}else if(!($driverInstance->getItem('test') instanceof ExtendedCacheItemInterface)){ |
|
45 | +} else if(!($driverInstance->getItem('test') instanceof ExtendedCacheItemInterface)){ |
|
46 | 46 | echo '[FAIL] $driverInstance->getItem() returned an invalid class that does not implements ExtendedCacheItemInterface: ' . get_class($driverInstance) . "\n"; |
47 | 47 | $status = 1; |
48 | -}else{ |
|
48 | +} else{ |
|
49 | 49 | echo '[PASS] $driverInstance->getItem() returned a valid class that implements ExtendedCacheItemInterface: ' . get_class($driverInstance) . "\n"; |
50 | 50 | } |
51 | 51 |