@@ -9,7 +9,7 @@ |
||
| 9 | 9 | public function __construct( |
| 10 | 10 | string $key, |
| 11 | 11 | public readonly mixed $value |
| 12 | - ) { |
|
| 12 | + ){ |
|
| 13 | 13 | parent::__construct($key); |
| 14 | 14 | } |
| 15 | 15 | } |
@@ -7,7 +7,7 @@ |
||
| 7 | 7 | public function __construct( |
| 8 | 8 | string $key, |
| 9 | 9 | public readonly mixed $value, |
| 10 | - ) { |
|
| 10 | + ){ |
|
| 11 | 11 | parent::__construct($key); |
| 12 | 12 | } |
| 13 | 13 | } |
@@ -7,7 +7,7 @@ |
||
| 7 | 7 | public function __construct( |
| 8 | 8 | string $key, |
| 9 | 9 | public readonly mixed $value, |
| 10 | - ) { |
|
| 10 | + ){ |
|
| 11 | 11 | parent::__construct($key); |
| 12 | 12 | } |
| 13 | 13 | } |
@@ -7,7 +7,7 @@ |
||
| 7 | 7 | public function __construct( |
| 8 | 8 | string $key, |
| 9 | 9 | public readonly mixed $value, |
| 10 | - ) { |
|
| 10 | + ){ |
|
| 11 | 11 | parent::__construct($key); |
| 12 | 12 | } |
| 13 | 13 | } |
@@ -36,7 +36,8 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | $value = $this->storage->get($key); |
| 38 | 38 | |
| 39 | - if ($value === null) { |
|
| 39 | + if ($value === null) |
|
| 40 | + { |
|
| 40 | 41 | $this->dispatcher?->dispatch(new CacheMissed($key)); |
| 41 | 42 | |
| 42 | 43 | return $default; |
@@ -90,7 +91,8 @@ discard block |
||
| 90 | 91 | { |
| 91 | 92 | $result = []; |
| 92 | 93 | |
| 93 | - foreach ($keys as $key) { |
|
| 94 | + foreach ($keys as $key) |
|
| 95 | + { |
|
| 94 | 96 | $result[$key] = $this->get($key, $default); |
| 95 | 97 | } |
| 96 | 98 | |
@@ -101,7 +103,8 @@ discard block |
||
| 101 | 103 | { |
| 102 | 104 | $state = null; |
| 103 | 105 | |
| 104 | - foreach ($values as $key => $value) { |
|
| 106 | + foreach ($values as $key => $value) |
|
| 107 | + { |
|
| 105 | 108 | $result = $this->set($key, $value, $ttl); |
| 106 | 109 | $state = \is_null($state) ? $result : $result && $state; |
| 107 | 110 | } |
@@ -112,7 +115,8 @@ discard block |
||
| 112 | 115 | public function deleteMultiple(iterable $keys): bool |
| 113 | 116 | { |
| 114 | 117 | $state = null; |
| 115 | - foreach ($keys as $key) { |
|
| 118 | + foreach ($keys as $key) |
|
| 119 | + { |
|
| 116 | 120 | $result = $this->delete($key); |
| 117 | 121 | $state = \is_null($state) ? $result : $result && $state; |
| 118 | 122 | } |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | protected CacheInterface $storage, |
| 26 | 26 | protected ?EventDispatcherInterface $dispatcher = null, |
| 27 | 27 | protected ?string $prefix = null |
| 28 | - ) { |
|
| 28 | + ){ |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | public function get(string $key, mixed $default = null): mixed |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | $value = $this->storage->get($key); |
| 38 | 38 | |
| 39 | - if ($value === null) { |
|
| 39 | + if ($value === null){ |
|
| 40 | 40 | $this->dispatcher?->dispatch(new CacheMissed($key)); |
| 41 | 41 | |
| 42 | 42 | return $default; |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | return $value; |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - public function set(string $key, mixed $value, \DateInterval|int|null $ttl = null): bool |
|
| 50 | + public function set(string $key, mixed $value, \DateInterval | int | null $ttl = null): bool |
|
| 51 | 51 | { |
| 52 | 52 | $key = $this->resolveKey($key); |
| 53 | 53 | |
@@ -90,18 +90,18 @@ discard block |
||
| 90 | 90 | { |
| 91 | 91 | $result = []; |
| 92 | 92 | |
| 93 | - foreach ($keys as $key) { |
|
| 93 | + foreach ($keys as $key){ |
|
| 94 | 94 | $result[$key] = $this->get($key, $default); |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | return $result; |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - public function setMultiple(iterable $values, \DateInterval|int|null $ttl = null): bool |
|
| 100 | + public function setMultiple(iterable $values, \DateInterval | int | null $ttl = null): bool |
|
| 101 | 101 | { |
| 102 | 102 | $state = null; |
| 103 | 103 | |
| 104 | - foreach ($values as $key => $value) { |
|
| 104 | + foreach ($values as $key => $value){ |
|
| 105 | 105 | $result = $this->set($key, $value, $ttl); |
| 106 | 106 | $state = \is_null($state) ? $result : $result && $state; |
| 107 | 107 | } |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | public function deleteMultiple(iterable $keys): bool |
| 113 | 113 | { |
| 114 | 114 | $state = null; |
| 115 | - foreach ($keys as $key) { |
|
| 115 | + foreach ($keys as $key){ |
|
| 116 | 116 | $result = $this->delete($key); |
| 117 | 117 | $state = \is_null($state) ? $result : $result && $state; |
| 118 | 118 | } |
@@ -132,6 +132,6 @@ discard block |
||
| 132 | 132 | |
| 133 | 133 | private function resolveKey(string $key): string |
| 134 | 134 | { |
| 135 | - return $this->prefix . $key; |
|
| 135 | + return $this->prefix.$key; |
|
| 136 | 136 | } |
| 137 | 137 | } |