@@ -21,7 +21,6 @@ |
||
21 | 21 | use Phpfastcache\Exceptions\{ |
22 | 22 | phpFastCacheInvalidArgumentException, phpFastCacheDriverException |
23 | 23 | }; |
24 | -use Phpfastcache\Util\ArrayObject; |
|
25 | 24 | use Predis\Client as PredisClient; |
26 | 25 | use Predis\Connection\ConnectionException as PredisConnectionException; |
27 | 26 | use Psr\Cache\CacheItemInterface; |
@@ -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, phpFastCacheDriverException |
|
22 | + phpFastCacheInvalidArgumentException, phpFastCacheDriverException |
|
23 | 23 | }; |
24 | 24 | use Phpfastcache\Util\ArrayObject; |
25 | 25 | use Predis\Client as PredisClient; |
@@ -57,8 +57,8 @@ discard block |
||
57 | 57 | { |
58 | 58 | if(!empty($this->config->getOption('path'))){ |
59 | 59 | $this->instance = new PredisClient([ |
60 | - 'scheme' => 'unix', |
|
61 | - 'path' => $this->config->getOption('path') |
|
60 | + 'scheme' => 'unix', |
|
61 | + 'path' => $this->config->getOption('path') |
|
62 | 62 | ]); |
63 | 63 | }else{ |
64 | 64 | var_dump($this->getConfig()->getPredisConfigArray()); |
@@ -172,10 +172,10 @@ discard block |
||
172 | 172 | $date = (isset($info[ 'Server' ][ 'uptime_in_seconds' ]) ? (new \DateTime())->setTimestamp(time() - $info[ 'Server' ][ 'uptime_in_seconds' ]) : 'unknown date'); |
173 | 173 | |
174 | 174 | return (new DriverStatistic()) |
175 | - ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
176 | - ->setRawData($info) |
|
177 | - ->setSize((int) $size) |
|
178 | - ->setInfo(\sprintf("The Redis daemon v%s is up since %s.\n For more information see RawData. \n Driver size includes the memory allocation size.", |
|
175 | + ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
176 | + ->setRawData($info) |
|
177 | + ->setSize((int) $size) |
|
178 | + ->setInfo(\sprintf("The Redis daemon v%s is up since %s.\n For more information see RawData. \n Driver size includes the memory allocation size.", |
|
179 | 179 | $version, $date->format(DATE_RFC2822))); |
180 | 180 | } |
181 | 181 | } |
182 | 182 | \ No newline at end of file |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | * @author Georges.L (Geolim4) <[email protected]> |
13 | 13 | * |
14 | 14 | */ |
15 | -declare(strict_types=1); |
|
15 | +declare(strict_types = 1); |
|
16 | 16 | |
17 | 17 | namespace Phpfastcache\Drivers\Predis; |
18 | 18 | |
@@ -55,12 +55,12 @@ discard block |
||
55 | 55 | */ |
56 | 56 | protected function driverConnect(): bool |
57 | 57 | { |
58 | - if(!empty($this->config->getOption('path'))){ |
|
58 | + if (!empty($this->config->getOption('path'))) { |
|
59 | 59 | $this->instance = new PredisClient([ |
60 | 60 | 'scheme' => 'unix', |
61 | 61 | 'path' => $this->config->getOption('path') |
62 | 62 | ]); |
63 | - }else{ |
|
63 | + } else { |
|
64 | 64 | var_dump($this->getConfig()->getPredisConfigArray()); |
65 | 65 | $this->instance = new PredisClient($this->getConfig()->getPredisConfigArray()); |
66 | 66 | } |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | * @see https://redis.io/commands/expire |
108 | 108 | */ |
109 | 109 | if ($ttl <= 0) { |
110 | - return (bool)$this->instance->expire($item->getKey(), 0); |
|
110 | + return (bool) $this->instance->expire($item->getKey(), 0); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | return $this->instance->setex($item->getKey(), $ttl, $this->encode($this->driverPreWrap($item)))->getPayload() === 'OK'; |
@@ -167,9 +167,9 @@ discard block |
||
167 | 167 | public function getStats(): DriverStatistic |
168 | 168 | { |
169 | 169 | $info = $this->instance->info(); |
170 | - $size = (isset($info[ 'Memory' ][ 'used_memory' ]) ? $info[ 'Memory' ][ 'used_memory' ] : 0); |
|
171 | - $version = (isset($info[ 'Server' ][ 'redis_version' ]) ? $info[ 'Server' ][ 'redis_version' ] : 0); |
|
172 | - $date = (isset($info[ 'Server' ][ 'uptime_in_seconds' ]) ? (new \DateTime())->setTimestamp(time() - $info[ 'Server' ][ 'uptime_in_seconds' ]) : 'unknown date'); |
|
170 | + $size = (isset($info['Memory']['used_memory']) ? $info['Memory']['used_memory'] : 0); |
|
171 | + $version = (isset($info['Server']['redis_version']) ? $info['Server']['redis_version'] : 0); |
|
172 | + $date = (isset($info['Server']['uptime_in_seconds']) ? (new \DateTime())->setTimestamp(time() - $info['Server']['uptime_in_seconds']) : 'unknown date'); |
|
173 | 173 | |
174 | 174 | return (new DriverStatistic()) |
175 | 175 | ->setData(\implode(', ', \array_keys($this->itemInstances))) |
@@ -60,7 +60,7 @@ |
||
60 | 60 | 'scheme' => 'unix', |
61 | 61 | 'path' => $this->config->getOption('path') |
62 | 62 | ]); |
63 | - }else{ |
|
63 | + } else{ |
|
64 | 64 | var_dump($this->getConfig()->getPredisConfigArray()); |
65 | 65 | $this->instance = new PredisClient($this->getConfig()->getPredisConfigArray()); |
66 | 66 | } |
@@ -42,7 +42,7 @@ |
||
42 | 42 | |
43 | 43 | /** |
44 | 44 | * @param \Psr\Cache\CacheItemInterface $item |
45 | - * @return mixed |
|
45 | + * @return boolean |
|
46 | 46 | * @throws phpFastCacheInvalidArgumentException |
47 | 47 | */ |
48 | 48 | protected function driverWrite(CacheItemInterface $item): bool |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | |
137 | 137 | /** |
138 | 138 | * @param \Psr\Cache\CacheItemInterface $item |
139 | - * @return mixed |
|
139 | + * @return boolean |
|
140 | 140 | * @throws phpFastCacheInvalidArgumentException |
141 | 141 | */ |
142 | 142 | protected function driverWrite(CacheItemInterface $item): bool |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | } |
346 | 346 | |
347 | 347 | /** |
348 | - * @param $keyword |
|
348 | + * @param string $keyword |
|
349 | 349 | * @param bool $reset |
350 | 350 | * @return PDO |
351 | 351 | */ |
@@ -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 | /** |
@@ -20,7 +20,6 @@ |
||
20 | 20 | use Phpfastcache\Exceptions\{ |
21 | 21 | phpFastCacheInvalidArgumentException, phpFastCacheDriverCheckException, phpFastCacheDriverException |
22 | 22 | }; |
23 | -use Phpfastcache\Util\ArrayObject; |
|
24 | 23 | use phpssdb\Core\{SimpleSSDB, SSDBException}; |
25 | 24 | use Psr\Cache\CacheItemInterface; |
26 | 25 |
@@ -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, phpFastCacheDriverCheckException, phpFastCacheDriverException |
|
21 | + phpFastCacheInvalidArgumentException, phpFastCacheDriverCheckException, phpFastCacheDriverException |
|
22 | 22 | }; |
23 | 23 | use Phpfastcache\Util\ArrayObject; |
24 | 24 | use phpssdb\Core\{SimpleSSDB, SSDBException}; |
@@ -147,9 +147,9 @@ discard block |
||
147 | 147 | * using hardcoded offset of pair key-value :-( |
148 | 148 | */ |
149 | 149 | $stat->setInfo(\sprintf("Ssdb-server v%s with a total of %s call(s).\n For more information see RawData.", $info[ 2 ], $info[ 6 ])) |
150 | - ->setRawData($info) |
|
151 | - ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
152 | - ->setSize($this->instance->dbsize()); |
|
150 | + ->setRawData($info) |
|
151 | + ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
152 | + ->setSize($this->instance->dbsize()); |
|
153 | 153 | |
154 | 154 | return $stat; |
155 | 155 | } |
@@ -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\Ssdb; |
17 | 17 | |
@@ -57,9 +57,9 @@ discard block |
||
57 | 57 | try { |
58 | 58 | $clientConfig = $this->getConfig(); |
59 | 59 | |
60 | - $this->instance = new SimpleSSDB($clientConfig[ 'host' ], $clientConfig[ 'port' ], $clientConfig[ 'timeout' ]); |
|
61 | - if (!empty($clientConfig[ 'password' ])) { |
|
62 | - $this->instance->auth($clientConfig[ 'password' ]); |
|
60 | + $this->instance = new SimpleSSDB($clientConfig['host'], $clientConfig['port'], $clientConfig['timeout']); |
|
61 | + if (!empty($clientConfig['password'])) { |
|
62 | + $this->instance->auth($clientConfig['password']); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | if (!$this->instance) { |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | * Data returned by Ssdb are very poorly formatted |
147 | 147 | * using hardcoded offset of pair key-value :-( |
148 | 148 | */ |
149 | - $stat->setInfo(\sprintf("Ssdb-server v%s with a total of %s call(s).\n For more information see RawData.", $info[ 2 ], $info[ 6 ])) |
|
149 | + $stat->setInfo(\sprintf("Ssdb-server v%s with a total of %s call(s).\n For more information see RawData.", $info[2], $info[6])) |
|
150 | 150 | ->setRawData($info) |
151 | 151 | ->setData(\implode(', ', \array_keys($this->itemInstances))) |
152 | 152 | ->setSize($this->instance->dbsize()); |
@@ -42,7 +42,7 @@ |
||
42 | 42 | |
43 | 43 | /** |
44 | 44 | * @param \Psr\Cache\CacheItemInterface $item |
45 | - * @return mixed |
|
45 | + * @return boolean |
|
46 | 46 | * @throws phpFastCacheInvalidArgumentException |
47 | 47 | */ |
48 | 48 | protected function driverWrite(CacheItemInterface $item): bool |
@@ -23,6 +23,7 @@ |
||
23 | 23 | { |
24 | 24 | /** |
25 | 25 | * @inheritdoc |
26 | + * @param phpFastCacheIOException $previous |
|
26 | 27 | */ |
27 | 28 | public function __construct($message = "", $code = 0, $previous = null) |
28 | 29 | { |
@@ -27,7 +27,7 @@ |
||
27 | 27 | public function __construct($message = "", $code = 0, $previous = null) |
28 | 28 | { |
29 | 29 | $lastError = error_get_last(); |
30 | - if($lastError){ |
|
30 | + if ($lastError) { |
|
31 | 31 | $message .= "\n"; |
32 | 32 | $message .= "Additional information provided by error_get_last():\n"; |
33 | 33 | $message .= "{$lastError['message']} in {$lastError['file']} line {$lastError['line']}"; |
@@ -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 | } |
@@ -42,7 +42,7 @@ |
||
42 | 42 | |
43 | 43 | /** |
44 | 44 | * @param \Psr\Cache\CacheItemInterface $item |
45 | - * @return mixed |
|
45 | + * @return boolean |
|
46 | 46 | * @throws phpFastCacheInvalidArgumentException |
47 | 47 | */ |
48 | 48 | protected function driverWrite(CacheItemInterface $item): bool |
@@ -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 |