@@ -11,7 +11,7 @@ |
||
11 | 11 | * @author Georges.L (Geolim4) <[email protected]> |
12 | 12 | * |
13 | 13 | */ |
14 | -declare(strict_types=1); |
|
14 | +declare(strict_types = 1); |
|
15 | 15 | |
16 | 16 | namespace Phpfastcache\Entities; |
17 | 17 |
@@ -135,10 +135,10 @@ |
||
135 | 135 | public function getPublicDesc(): array |
136 | 136 | { |
137 | 137 | return [ |
138 | - 'Info' => 'Cache Information', |
|
139 | - 'Size' => 'Cache Size', |
|
140 | - 'Data' => 'Cache items keys', |
|
141 | - 'RawData' => 'Cache raw data', |
|
138 | + 'Info' => 'Cache Information', |
|
139 | + 'Size' => 'Cache Size', |
|
140 | + 'Data' => 'Cache items keys', |
|
141 | + 'RawData' => 'Cache raw data', |
|
142 | 142 | ]; |
143 | 143 | } |
144 | 144 | } |
145 | 145 | \ No newline at end of file |
@@ -11,7 +11,7 @@ |
||
11 | 11 | * @author Georges.L (Geolim4) <[email protected]> |
12 | 12 | * |
13 | 13 | */ |
14 | -declare(strict_types=1); |
|
14 | +declare(strict_types = 1); |
|
15 | 15 | |
16 | 16 | namespace Phpfastcache\Entities; |
17 | 17 |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * @author Georges.L (Geolim4) <[email protected]> |
12 | 12 | * |
13 | 13 | */ |
14 | -declare(strict_types=1); |
|
14 | +declare(strict_types = 1); |
|
15 | 15 | |
16 | 16 | namespace phpFastCache; |
17 | 17 | |
@@ -76,8 +76,8 @@ discard block |
||
76 | 76 | * due to performance issue on huge |
77 | 77 | * loop dispatching operations |
78 | 78 | */ |
79 | - if (isset($this->events[ $eventName ])) { |
|
80 | - foreach ($this->events[ $eventName ] as $event) { |
|
79 | + if (isset($this->events[$eventName])) { |
|
80 | + foreach ($this->events[$eventName] as $event) { |
|
81 | 81 | call_user_func_array($event, $args); |
82 | 82 | } |
83 | 83 | } |
@@ -93,14 +93,14 @@ discard block |
||
93 | 93 | { |
94 | 94 | if (\strpos($name, 'on') === 0) { |
95 | 95 | $name = \substr($name, 2); |
96 | - if (\is_callable($arguments[ 0 ])) { |
|
97 | - if (isset($arguments[ 1 ]) && \is_string($arguments[ 0 ])) { |
|
98 | - $this->events[ $name ][ $arguments[ 1 ] ] = $arguments[ 0 ]; |
|
96 | + if (\is_callable($arguments[0])) { |
|
97 | + if (isset($arguments[1]) && \is_string($arguments[0])) { |
|
98 | + $this->events[$name][$arguments[1]] = $arguments[0]; |
|
99 | 99 | } else { |
100 | - $this->events[ $name ][] = $arguments[ 0 ]; |
|
100 | + $this->events[$name][] = $arguments[0]; |
|
101 | 101 | } |
102 | 102 | } else { |
103 | - throw new phpFastCacheInvalidArgumentException(sprintf('Expected Callable, got "%s"', \gettype($arguments[ 0 ]))); |
|
103 | + throw new phpFastCacheInvalidArgumentException(sprintf('Expected Callable, got "%s"', \gettype($arguments[0]))); |
|
104 | 104 | } |
105 | 105 | } else { |
106 | 106 | throw new \BadMethodCallException('An event must start with "on" such as "onCacheGetItem"'); |
@@ -114,8 +114,8 @@ discard block |
||
114 | 114 | */ |
115 | 115 | public function unbindEventCallback($eventName, $callbackName): bool |
116 | 116 | { |
117 | - $return = isset($this->events[ $eventName ][ $callbackName ]); |
|
118 | - unset($this->events[ $eventName ][ $callbackName ]); |
|
117 | + $return = isset($this->events[$eventName][$callbackName]); |
|
118 | + unset($this->events[$eventName][$callbackName]); |
|
119 | 119 | |
120 | 120 | return $return; |
121 | 121 | } |
@@ -19,7 +19,7 @@ |
||
19 | 19 | use Phpfastcache\Core\Pool\ExtendedCacheItemPoolInterface; |
20 | 20 | use Phpfastcache\Drivers\Devtrue\Driver as DevtrueDriver; |
21 | 21 | use Phpfastcache\Exceptions\{ |
22 | - phpFastCacheInvalidArgumentException, phpFastCacheInvalidArgumentTypeException |
|
22 | + phpFastCacheInvalidArgumentException, phpFastCacheInvalidArgumentTypeException |
|
23 | 23 | }; |
24 | 24 | |
25 | 25 | /** |
@@ -11,7 +11,7 @@ |
||
11 | 11 | * @author Georges.L (Geolim4) <[email protected]> |
12 | 12 | * |
13 | 13 | */ |
14 | -declare(strict_types=1); |
|
14 | +declare(strict_types = 1); |
|
15 | 15 | |
16 | 16 | namespace Phpfastcache\Drivers\Devtrue; |
17 | 17 |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | use Phpfastcache\Core\Pool\{DriverBaseTrait, ExtendedCacheItemPoolInterface}; |
19 | 19 | use Phpfastcache\Entities\DriverStatistic; |
20 | 20 | use Phpfastcache\Exceptions\{ |
21 | - phpFastCacheInvalidArgumentException |
|
21 | + phpFastCacheInvalidArgumentException |
|
22 | 22 | }; |
23 | 23 | use Psr\Cache\CacheItemInterface; |
24 | 24 | |
@@ -64,9 +64,9 @@ discard block |
||
64 | 64 | protected function driverRead(CacheItemInterface $item): array |
65 | 65 | { |
66 | 66 | return [ |
67 | - self::DRIVER_DATA_WRAPPER_INDEX => true, |
|
68 | - self::DRIVER_TAGS_WRAPPER_INDEX => [], |
|
69 | - self::DRIVER_EDATE_WRAPPER_INDEX => new \DateTime(), |
|
67 | + self::DRIVER_DATA_WRAPPER_INDEX => true, |
|
68 | + self::DRIVER_TAGS_WRAPPER_INDEX => [], |
|
69 | + self::DRIVER_EDATE_WRAPPER_INDEX => new \DateTime(), |
|
70 | 70 | ]; |
71 | 71 | } |
72 | 72 | |
@@ -116,9 +116,9 @@ discard block |
||
116 | 116 | { |
117 | 117 | $stat = new DriverStatistic(); |
118 | 118 | $stat->setInfo('[Devtrue] A void info string') |
119 | - ->setSize(0) |
|
120 | - ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
121 | - ->setRawData(true); |
|
119 | + ->setSize(0) |
|
120 | + ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
121 | + ->setRawData(true); |
|
122 | 122 | |
123 | 123 | return $stat; |
124 | 124 | } |
@@ -11,7 +11,7 @@ |
||
11 | 11 | * @author Georges.L (Geolim4) <[email protected]> |
12 | 12 | * |
13 | 13 | */ |
14 | -declare(strict_types=1); |
|
14 | +declare(strict_types = 1); |
|
15 | 15 | |
16 | 16 | namespace Phpfastcache\Drivers\Devtrue; |
17 | 17 |
@@ -19,7 +19,7 @@ |
||
19 | 19 | use Phpfastcache\Core\Pool\ExtendedCacheItemPoolInterface; |
20 | 20 | use Phpfastcache\Drivers\Riak\Driver as RiakDriver; |
21 | 21 | use Phpfastcache\Exceptions\{ |
22 | - phpFastCacheInvalidArgumentException, phpFastCacheInvalidArgumentTypeException |
|
22 | + phpFastCacheInvalidArgumentException, phpFastCacheInvalidArgumentTypeException |
|
23 | 23 | }; |
24 | 24 | |
25 | 25 | /** |
@@ -11,7 +11,7 @@ |
||
11 | 11 | * @author Georges.L (Geolim4) <[email protected]> |
12 | 12 | * |
13 | 13 | */ |
14 | -declare(strict_types=1); |
|
14 | +declare(strict_types = 1); |
|
15 | 15 | |
16 | 16 | namespace Phpfastcache\Drivers\Riak; |
17 | 17 |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | use Phpfastcache\Core\Pool\{DriverBaseTrait, ExtendedCacheItemPoolInterface}; |
20 | 20 | use Phpfastcache\Entities\DriverStatistic; |
21 | 21 | use Phpfastcache\Exceptions\{ |
22 | - phpFastCacheInvalidArgumentException, phpFastCacheLogicException |
|
22 | + phpFastCacheInvalidArgumentException, phpFastCacheLogicException |
|
23 | 23 | }; |
24 | 24 | use Phpfastcache\Util\ArrayObject; |
25 | 25 | use Psr\Cache\CacheItemInterface; |
@@ -89,9 +89,9 @@ discard block |
||
89 | 89 | */ |
90 | 90 | if ($item instanceof Item) { |
91 | 91 | $this->instance |
92 | - ->bucket($this->bucketName) |
|
93 | - ->newBinary($item->getKey(), $this->encode($this->driverPreWrap($item))) |
|
94 | - ->store(); |
|
92 | + ->bucket($this->bucketName) |
|
93 | + ->newBinary($item->getKey(), $this->encode($this->driverPreWrap($item))) |
|
94 | + ->store(); |
|
95 | 95 | return true; |
96 | 96 | } |
97 | 97 | |
@@ -142,9 +142,9 @@ discard block |
||
142 | 142 | $info = $this->instance->bucket($this->bucketName)->getProperties(); |
143 | 143 | |
144 | 144 | return (new DriverStatistic()) |
145 | - ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
146 | - ->setRawData($info) |
|
147 | - ->setSize(false) |
|
148 | - ->setInfo('Riak does not provide size/date information att all :('); |
|
145 | + ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
146 | + ->setRawData($info) |
|
147 | + ->setSize(false) |
|
148 | + ->setInfo('Riak does not provide size/date information att all :('); |
|
149 | 149 | } |
150 | 150 | } |
151 | 151 | \ No newline at end of file |
@@ -11,7 +11,7 @@ |
||
11 | 11 | * @author Georges.L (Geolim4) <[email protected]> |
12 | 12 | * |
13 | 13 | */ |
14 | -declare(strict_types=1); |
|
14 | +declare(strict_types = 1); |
|
15 | 15 | |
16 | 16 | namespace Phpfastcache\Drivers\Riak; |
17 | 17 |
@@ -19,7 +19,7 @@ |
||
19 | 19 | use Phpfastcache\Core\Pool\ExtendedCacheItemPoolInterface; |
20 | 20 | use Phpfastcache\Drivers\Sqlite\Driver as SqliteDriver; |
21 | 21 | use Phpfastcache\Exceptions\{ |
22 | - phpFastCacheInvalidArgumentException, phpFastCacheInvalidArgumentTypeException |
|
22 | + phpFastCacheInvalidArgumentException, phpFastCacheInvalidArgumentTypeException |
|
23 | 23 | }; |
24 | 24 | |
25 | 25 | /** |
@@ -11,7 +11,7 @@ |
||
11 | 11 | * @author Georges.L (Geolim4) <[email protected]> |
12 | 12 | * |
13 | 13 | */ |
14 | -declare(strict_types=1); |
|
14 | +declare(strict_types = 1); |
|
15 | 15 | |
16 | 16 | namespace Phpfastcache\Drivers\Sqlite; |
17 | 17 |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | use PDOException; |
20 | 20 | use Phpfastcache\Core\Pool\{DriverBaseTrait, ExtendedCacheItemPoolInterface, IO\IOHelperTrait}; |
21 | 21 | use Phpfastcache\Exceptions\{ |
22 | - phpFastCacheInvalidArgumentException, phpFastCacheIOException |
|
22 | + phpFastCacheInvalidArgumentException, phpFastCacheIOException |
|
23 | 23 | }; |
24 | 24 | use Psr\Cache\CacheItemInterface; |
25 | 25 | |
@@ -108,18 +108,18 @@ discard block |
||
108 | 108 | { |
109 | 109 | try { |
110 | 110 | $stm = $this->getDb($item->getKey()) |
111 | - ->prepare("SELECT * FROM `caching` WHERE `keyword`=:keyword LIMIT 1"); |
|
111 | + ->prepare("SELECT * FROM `caching` WHERE `keyword`=:keyword LIMIT 1"); |
|
112 | 112 | $stm->execute([ |
113 | - ':keyword' => $item->getKey(), |
|
113 | + ':keyword' => $item->getKey(), |
|
114 | 114 | ]); |
115 | 115 | $row = $stm->fetch(PDO::FETCH_ASSOC); |
116 | 116 | |
117 | 117 | } catch (PDOException $e) { |
118 | 118 | try { |
119 | 119 | $stm = $this->getDb($item->getKey(), true) |
120 | - ->prepare("SELECT * FROM `caching` WHERE `keyword`=:keyword LIMIT 1"); |
|
120 | + ->prepare("SELECT * FROM `caching` WHERE `keyword`=:keyword LIMIT 1"); |
|
121 | 121 | $stm->execute([ |
122 | - ':keyword' => $item->getKey(), |
|
122 | + ':keyword' => $item->getKey(), |
|
123 | 123 | ]); |
124 | 124 | $row = $stm->fetch(PDO::FETCH_ASSOC); |
125 | 125 | } catch (PDOException $e) { |
@@ -162,11 +162,11 @@ discard block |
||
162 | 162 | if ($toWrite == true) { |
163 | 163 | try { |
164 | 164 | $stm = $this->getDb($item->getKey()) |
165 | - ->prepare("INSERT OR REPLACE INTO `caching` (`keyword`,`object`,`exp`) values(:keyword,:object,:exp)"); |
|
165 | + ->prepare("INSERT OR REPLACE INTO `caching` (`keyword`,`object`,`exp`) values(:keyword,:object,:exp)"); |
|
166 | 166 | $stm->execute([ |
167 | - ':keyword' => $item->getKey(), |
|
168 | - ':object' => $this->encode($this->driverPreWrap($item)), |
|
169 | - ':exp' => $item->getExpirationDate()->getTimestamp(), |
|
167 | + ':keyword' => $item->getKey(), |
|
168 | + ':object' => $this->encode($this->driverPreWrap($item)), |
|
169 | + ':exp' => $item->getExpirationDate()->getTimestamp(), |
|
170 | 170 | ]); |
171 | 171 | |
172 | 172 | return true; |
@@ -174,11 +174,11 @@ discard block |
||
174 | 174 | |
175 | 175 | try { |
176 | 176 | $stm = $this->getDb($item->getKey(), true) |
177 | - ->prepare("INSERT OR REPLACE INTO `caching` (`keyword`,`object`,`exp`) values(:keyword,:object,:exp)"); |
|
177 | + ->prepare("INSERT OR REPLACE INTO `caching` (`keyword`,`object`,`exp`) values(:keyword,:object,:exp)"); |
|
178 | 178 | $stm->execute([ |
179 | - ':keyword' => $item->getKey(), |
|
180 | - ':object' => $this->encode($this->driverPreWrap($item)), |
|
181 | - ':exp' => $item->getExpirationDate()->getTimestamp(), |
|
179 | + ':keyword' => $item->getKey(), |
|
180 | + ':object' => $this->encode($this->driverPreWrap($item)), |
|
181 | + ':exp' => $item->getExpirationDate()->getTimestamp(), |
|
182 | 182 | ]); |
183 | 183 | } catch (PDOException $e) { |
184 | 184 | return false; |
@@ -205,11 +205,11 @@ discard block |
||
205 | 205 | if ($item instanceof Item) { |
206 | 206 | try { |
207 | 207 | $stm = $this->getDb($item->getKey()) |
208 | - ->prepare("DELETE FROM `caching` WHERE (`exp` <= :U) OR (`keyword`=:keyword) "); |
|
208 | + ->prepare("DELETE FROM `caching` WHERE (`exp` <= :U) OR (`keyword`=:keyword) "); |
|
209 | 209 | |
210 | 210 | return $stm->execute([ |
211 | - ':keyword' => $item->getKey(), |
|
212 | - ':U' => time(), |
|
211 | + ':keyword' => $item->getKey(), |
|
212 | + ':U' => time(), |
|
213 | 213 | ]); |
214 | 214 | } catch (PDOException $e) { |
215 | 215 | return false; |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | |
290 | 290 | $PDO = new PDO("sqlite:" . $this->SqliteDir . '/' . self::INDEXING_FILE); |
291 | 291 | $PDO->setAttribute(PDO::ATTR_ERRMODE, |
292 | - PDO::ERRMODE_EXCEPTION); |
|
292 | + PDO::ERRMODE_EXCEPTION); |
|
293 | 293 | |
294 | 294 | if ($createTable == true) { |
295 | 295 | $this->initIndexing($PDO); |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | // look for keyword |
325 | 325 | $stm = $this->indexing->prepare("SELECT * FROM `balancing` WHERE `keyword`=:keyword LIMIT 1"); |
326 | 326 | $stm->execute([ |
327 | - ':keyword' => $keyword, |
|
327 | + ':keyword' => $keyword, |
|
328 | 328 | ]); |
329 | 329 | $row = $stm->fetch(PDO::FETCH_ASSOC); |
330 | 330 | if (isset($row[ 'db' ]) && $row[ 'db' ] != '') { |
@@ -336,8 +336,8 @@ discard block |
||
336 | 336 | $db = $this->currentDB; |
337 | 337 | $stm = $this->indexing->prepare("INSERT INTO `balancing` (`keyword`,`db`) VALUES(:keyword, :db)"); |
338 | 338 | $stm->execute([ |
339 | - ':keyword' => $keyword, |
|
340 | - ':db' => $db, |
|
339 | + ':keyword' => $keyword, |
|
340 | + ':db' => $db, |
|
341 | 341 | ]); |
342 | 342 | } |
343 | 343 |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * @author Georges.L (Geolim4) <[email protected]> |
12 | 12 | * |
13 | 13 | */ |
14 | -declare(strict_types=1); |
|
14 | +declare(strict_types = 1); |
|
15 | 15 | |
16 | 16 | namespace Phpfastcache\Drivers\Sqlite; |
17 | 17 | |
@@ -127,8 +127,8 @@ discard block |
||
127 | 127 | } |
128 | 128 | } |
129 | 129 | |
130 | - if (isset($row[ 'object' ])) { |
|
131 | - return $this->decode($row[ 'object' ]); |
|
130 | + if (isset($row['object'])) { |
|
131 | + return $this->decode($row['object']); |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | return null; |
@@ -300,12 +300,12 @@ discard block |
||
300 | 300 | $stm = $this->indexing->prepare("SELECT MAX(`db`) as `db` FROM `balancing`"); |
301 | 301 | $stm->execute(); |
302 | 302 | $row = $stm->fetch(PDO::FETCH_ASSOC); |
303 | - if (!isset($row[ 'db' ])) { |
|
303 | + if (!isset($row['db'])) { |
|
304 | 304 | $db = 1; |
305 | - } elseif ($row[ 'db' ] <= 1) { |
|
305 | + } elseif ($row['db'] <= 1) { |
|
306 | 306 | $db = 1; |
307 | 307 | } else { |
308 | - $db = $row[ 'db' ]; |
|
308 | + $db = $row['db']; |
|
309 | 309 | } |
310 | 310 | |
311 | 311 | // check file size |
@@ -327,8 +327,8 @@ discard block |
||
327 | 327 | ':keyword' => $keyword, |
328 | 328 | ]); |
329 | 329 | $row = $stm->fetch(PDO::FETCH_ASSOC); |
330 | - if (isset($row[ 'db' ]) && $row[ 'db' ] != '') { |
|
331 | - $db = $row[ 'db' ]; |
|
330 | + if (isset($row['db']) && $row['db'] != '') { |
|
331 | + $db = $row['db']; |
|
332 | 332 | } else { |
333 | 333 | /* |
334 | 334 | * Insert new to Indexing |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | /** |
360 | 360 | * init instant |
361 | 361 | */ |
362 | - if (!isset($this->instance[ $instant ])) { |
|
362 | + if (!isset($this->instance[$instant])) { |
|
363 | 363 | // check DB Files ready or not |
364 | 364 | $createTable = false; |
365 | 365 | if (!\file_exists($this->SqliteDir . '/db' . $instant) || $reset == true) { |
@@ -372,12 +372,12 @@ discard block |
||
372 | 372 | $this->initDB($PDO); |
373 | 373 | } |
374 | 374 | |
375 | - $this->instance[ $instant ] = $PDO; |
|
375 | + $this->instance[$instant] = $PDO; |
|
376 | 376 | unset($PDO); |
377 | 377 | |
378 | 378 | } |
379 | 379 | |
380 | - return $this->instance[ $instant ]; |
|
380 | + return $this->instance[$instant]; |
|
381 | 381 | } |
382 | 382 | |
383 | 383 | /** |