@@ -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\Exceptions; |
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\Exceptions; |
17 | 17 | |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | public function __construct($message = "", $code = 0, $previous = null) |
29 | 29 | { |
30 | 30 | $lastError = error_get_last(); |
31 | - if($lastError){ |
|
31 | + if ($lastError) { |
|
32 | 32 | $message .= "\n"; |
33 | 33 | $message .= "Additional information provided by error_get_last():\n"; |
34 | 34 | $message .= "{$lastError['message']} in {$lastError['file']} line {$lastError['line']}"; |
@@ -18,7 +18,7 @@ |
||
18 | 18 | use Phpfastcache\Core\Item\ExtendedCacheItemInterface; |
19 | 19 | use Phpfastcache\EventManager; |
20 | 20 | use Phpfastcache\Exceptions\{ |
21 | - PhpfastcacheInvalidArgumentException, PhpfastcacheLogicException |
|
21 | + PhpfastcacheInvalidArgumentException, PhpfastcacheLogicException |
|
22 | 22 | }; |
23 | 23 | use Psr\Cache\CacheItemInterface; |
24 | 24 |
@@ -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\Core\Pool; |
17 | 17 | |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | */ |
37 | 37 | public function getItemsAsJsonString(array $keys = [], $option = 0, $depth = 512): string |
38 | 38 | { |
39 | - $callback = function (CacheItemInterface $item) { |
|
39 | + $callback = function(CacheItemInterface $item) { |
|
40 | 40 | return $item->get(); |
41 | 41 | }; |
42 | 42 | return \json_encode(\array_map($callback, \array_values($this->getItems($keys))), $option, $depth); |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | if (\is_string($tagName)) { |
51 | 51 | $driverResponse = $this->getItem($this->getTagKey($tagName)); |
52 | 52 | if ($driverResponse->isHit()) { |
53 | - $items = (array)$driverResponse->get(); |
|
53 | + $items = (array) $driverResponse->get(); |
|
54 | 54 | |
55 | 55 | /** |
56 | 56 | * getItems() may provides expired item(s) |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | * |
63 | 63 | * #headache |
64 | 64 | */ |
65 | - return \array_filter($this->getItems(\array_unique(\array_keys($items))), function (ExtendedCacheItemInterface $item) { |
|
65 | + return \array_filter($this->getItems(\array_unique(\array_keys($items))), function(ExtendedCacheItemInterface $item) { |
|
66 | 66 | return $item->isHit(); |
67 | 67 | }); |
68 | 68 | } |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | |
100 | 100 | foreach ($items as $key => $item) { |
101 | 101 | if (\array_diff($tagNames, $item->getTags())) { |
102 | - unset($items[ $key ]); |
|
102 | + unset($items[$key]); |
|
103 | 103 | } |
104 | 104 | } |
105 | 105 | |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | */ |
113 | 113 | public function getItemsByTagsAsJsonString(array $tagNames, $option = 0, $depth = 512) |
114 | 114 | { |
115 | - $callback = function (CacheItemInterface $item) { |
|
115 | + $callback = function(CacheItemInterface $item) { |
|
116 | 116 | return $item->get(); |
117 | 117 | }; |
118 | 118 | |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | */ |
384 | 384 | public function detachItem(CacheItemInterface $item) |
385 | 385 | { |
386 | - if (isset($this->itemInstances[ $item->getKey() ])) { |
|
386 | + if (isset($this->itemInstances[$item->getKey()])) { |
|
387 | 387 | $this->deregisterItem($item); |
388 | 388 | } |
389 | 389 | } |
@@ -403,11 +403,11 @@ discard block |
||
403 | 403 | */ |
404 | 404 | public function attachItem(CacheItemInterface $item) |
405 | 405 | { |
406 | - if (isset($this->itemInstances[ $item->getKey() ]) && \spl_object_hash($item) !== \spl_object_hash($this->itemInstances[ $item->getKey() ])) { |
|
406 | + if (isset($this->itemInstances[$item->getKey()]) && \spl_object_hash($item) !== \spl_object_hash($this->itemInstances[$item->getKey()])) { |
|
407 | 407 | throw new PhpfastcacheLogicException('The item already exists and cannot be overwritten because the Spl object hash mismatches ! You probably tried to re-attach a detached item which has been already retrieved from cache.'); |
408 | 408 | } |
409 | 409 | |
410 | - $this->itemInstances[ $item->getKey() ] = $item; |
|
410 | + $this->itemInstances[$item->getKey()] = $item; |
|
411 | 411 | } |
412 | 412 | |
413 | 413 | |
@@ -419,10 +419,10 @@ discard block |
||
419 | 419 | protected function deregisterItem($item) |
420 | 420 | { |
421 | 421 | if ($item instanceof CacheItemInterface) { |
422 | - unset($this->itemInstances[ $item->getKey() ]); |
|
422 | + unset($this->itemInstances[$item->getKey()]); |
|
423 | 423 | |
424 | 424 | } else if (\is_string($item)) { |
425 | - unset($this->itemInstances[ $item ]); |
|
425 | + unset($this->itemInstances[$item]); |
|
426 | 426 | } else { |
427 | 427 | throw new PhpfastcacheInvalidArgumentException('Invalid type for $item variable'); |
428 | 428 | } |
@@ -449,8 +449,8 @@ discard block |
||
449 | 449 | */ |
450 | 450 | public function isAttached(CacheItemInterface $item) |
451 | 451 | { |
452 | - if (isset($this->itemInstances[ $item->getKey() ])) { |
|
453 | - return \spl_object_hash($item) === \spl_object_hash($this->itemInstances[ $item->getKey() ]); |
|
452 | + if (isset($this->itemInstances[$item->getKey()])) { |
|
453 | + return \spl_object_hash($item) === \spl_object_hash($this->itemInstances[$item->getKey()]); |
|
454 | 454 | } |
455 | 455 | return null; |
456 | 456 | } |
@@ -473,8 +473,8 @@ discard block |
||
473 | 473 | */ |
474 | 474 | public function saveMultiple(...$items): bool |
475 | 475 | { |
476 | - if (isset($items[ 0 ]) && \is_array($items[ 0 ])) { |
|
477 | - foreach ($items[ 0 ] as $item) { |
|
476 | + if (isset($items[0]) && \is_array($items[0])) { |
|
477 | + foreach ($items[0] as $item) { |
|
478 | 478 | $this->save($item); |
479 | 479 | } |
480 | 480 | return true; |
@@ -18,7 +18,7 @@ |
||
18 | 18 | use Phpfastcache\Core\Pool\ExtendedCacheItemPoolInterface; |
19 | 19 | use Phpfastcache\EventManager; |
20 | 20 | use Phpfastcache\Exceptions\{ |
21 | - PhpfastcacheInvalidArgumentException, PhpfastcacheInvalidArgumentTypeException, PhpfastcacheLogicException |
|
21 | + PhpfastcacheInvalidArgumentException, PhpfastcacheInvalidArgumentTypeException, PhpfastcacheLogicException |
|
22 | 22 | }; |
23 | 23 | |
24 | 24 | /** |
@@ -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\Core\Item; |
17 | 17 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | $this->driver = $driver; |
71 | 71 | $this->driver->setItem($this); |
72 | 72 | $this->expirationDate = new \DateTime(); |
73 | - if($this->driver->getConfig()->isItemDetailedDate()){ |
|
73 | + if ($this->driver->getConfig()->isItemDetailedDate()) { |
|
74 | 74 | $this->creationDate = new \DateTime(); |
75 | 75 | $this->modificationDate = new \DateTime(); |
76 | 76 | } |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | { |
225 | 225 | case 'array': |
226 | 226 | case 'object': |
227 | - if(\is_array($this->data) || $this->data instanceof \Countable){ |
|
227 | + if (\is_array($this->data) || $this->data instanceof \Countable) { |
|
228 | 228 | return \count($this->data); |
229 | 229 | } |
230 | 230 | break; |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | if (\is_array($this->data)) { |
283 | 283 | $this->data[] = $data; |
284 | 284 | } else if (\is_string($data)) { |
285 | - $this->data .= (string)$data; |
|
285 | + $this->data .= (string) $data; |
|
286 | 286 | } else { |
287 | 287 | throw new PhpfastcacheInvalidArgumentException('$data must be either array nor string.'); |
288 | 288 | } |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | if (\is_array($this->data)) { |
302 | 302 | \array_unshift($this->data, $data); |
303 | 303 | } else if (\is_string($data)) { |
304 | - $this->data = (string)$data . $this->data; |
|
304 | + $this->data = (string) $data . $this->data; |
|
305 | 305 | } else { |
306 | 306 | throw new PhpfastcacheInvalidArgumentException('$data must be either array nor string.'); |
307 | 307 | } |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | public function removeTag($tagName): ExtendedCacheItemInterface |
381 | 381 | { |
382 | 382 | if (($key = \array_search($tagName, $this->tags)) !== false) { |
383 | - unset($this->tags[ $key ]); |
|
383 | + unset($this->tags[$key]); |
|
384 | 384 | $this->removedTags[] = $tagName; |
385 | 385 | } |
386 | 386 | |
@@ -459,7 +459,7 @@ discard block |
||
459 | 459 | final public function __debugInfo() |
460 | 460 | { |
461 | 461 | $info = \get_object_vars($this); |
462 | - $info[ 'driver' ] = 'object(' . \get_class($info[ 'driver' ]) . ')'; |
|
462 | + $info['driver'] = 'object(' . \get_class($info['driver']) . ')'; |
|
463 | 463 | |
464 | 464 | return $info; |
465 | 465 | } |
@@ -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\Proxy; |
17 | 17 |
@@ -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\Exceptions; |
17 | 17 |
@@ -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\Exceptions; |
17 | 17 |
@@ -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\Exceptions; |
17 | 17 |
@@ -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\Exceptions; |
17 | 17 |