@@ -16,7 +16,6 @@ |
||
16 | 16 | |
17 | 17 | use PDO; |
18 | 18 | use PDOException; |
19 | -use phpFastCache\Core\Item\ExtendedCacheItemInterface; |
|
20 | 19 | use phpFastCache\Core\Pool\DriverBaseTrait; |
21 | 20 | use phpFastCache\Core\Pool\ExtendedCacheItemPoolInterface; |
22 | 21 | use phpFastCache\Core\Pool\IO\PathSeekerTrait; |
@@ -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; |
@@ -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()){ |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | $item->set($this->driverUnwrapData($driverArray)); |
62 | 62 | $item->expiresAt($this->driverUnwrapEdate($driverArray)); |
63 | 63 | |
64 | - if($this->config['itemDetailedDate']){ |
|
64 | + if ($this->config['itemDetailedDate']) { |
|
65 | 65 | |
66 | 66 | /** |
67 | 67 | * If the itemDetailedDate has been |
@@ -85,8 +85,8 @@ discard block |
||
85 | 85 | } else { |
86 | 86 | $item->setHit(true); |
87 | 87 | } |
88 | - }else{ |
|
89 | - $item->expiresAfter(abs((int) $this->getConfig()[ 'defaultTtl' ])); |
|
88 | + } else { |
|
89 | + $item->expiresAfter(abs((int) $this->getConfig()['defaultTtl'])); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | } |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | throw new \InvalidArgumentException(sprintf('$key must be a string, got type "%s" instead.', gettype($key))); |
95 | 95 | } |
96 | 96 | |
97 | - return $this->itemInstances[ $key ]; |
|
97 | + return $this->itemInstances[$key]; |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | /** |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | public function setItem(CacheItemInterface $item) |
106 | 106 | { |
107 | 107 | if ($this->getClassNamespace() . '\\Item' === get_class($item)) { |
108 | - $this->itemInstances[ $item->getKey() ] = $item; |
|
108 | + $this->itemInstances[$item->getKey()] = $item; |
|
109 | 109 | |
110 | 110 | return $this; |
111 | 111 | } else { |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | { |
123 | 123 | $collection = []; |
124 | 124 | foreach ($keys as $key) { |
125 | - $collection[ $key ] = $this->getItem($key); |
|
125 | + $collection[$key] = $this->getItem($key); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | return $collection; |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | * @var ExtendedCacheItemInterface $item |
204 | 204 | */ |
205 | 205 | if (!array_key_exists($item->getKey(), $this->itemInstances)) { |
206 | - $this->itemInstances[ $item->getKey() ] = $item; |
|
206 | + $this->itemInstances[$item->getKey()] = $item; |
|
207 | 207 | } |
208 | 208 | if ($this->driverWrite($item) && $this->driverWriteTags($item)) { |
209 | 209 | $item->setHit(true); |
@@ -222,10 +222,10 @@ discard block |
||
222 | 222 | public function saveDeferred(CacheItemInterface $item) |
223 | 223 | { |
224 | 224 | if (!array_key_exists($item->getKey(), $this->itemInstances)) { |
225 | - $this->itemInstances[ $item->getKey() ] = $item; |
|
225 | + $this->itemInstances[$item->getKey()] = $item; |
|
226 | 226 | } |
227 | 227 | |
228 | - return $this->deferredList[ $item->getKey() ] = $item; |
|
228 | + return $this->deferredList[$item->getKey()] = $item; |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | /** |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | foreach ($this->deferredList as $key => $item) { |
239 | 239 | $result = $this->save($item); |
240 | 240 | if ($return !== false) { |
241 | - unset($this->deferredList[ $key ]); |
|
241 | + unset($this->deferredList[$key]); |
|
242 | 242 | $return = $result; |
243 | 243 | } |
244 | 244 | } |