@@ -91,66 +91,66 @@ discard block |
||
| 91 | 91 | final class Cacheer |
| 92 | 92 | { |
| 93 | 93 | /** |
| 94 | - * @var string |
|
| 95 | - */ |
|
| 94 | + * @var string |
|
| 95 | + */ |
|
| 96 | 96 | private string $message; |
| 97 | 97 | |
| 98 | 98 | /** |
| 99 | - * @var boolean |
|
| 100 | - */ |
|
| 99 | + * @var boolean |
|
| 100 | + */ |
|
| 101 | 101 | private bool $success; |
| 102 | 102 | |
| 103 | 103 | /** |
| 104 | - * @var boolean |
|
| 105 | - */ |
|
| 104 | + * @var boolean |
|
| 105 | + */ |
|
| 106 | 106 | private bool $formatted = false; |
| 107 | 107 | |
| 108 | 108 | /** |
| 109 | - * @var bool |
|
| 110 | - */ |
|
| 109 | + * @var bool |
|
| 110 | + */ |
|
| 111 | 111 | private bool $compression = false; |
| 112 | 112 | |
| 113 | 113 | /** |
| 114 | - * @var string|null |
|
| 115 | - */ |
|
| 114 | + * @var string|null |
|
| 115 | + */ |
|
| 116 | 116 | private ?string $encryptionKey = null; |
| 117 | 117 | |
| 118 | 118 | /** |
| 119 | - * @var FileCacheStore|DatabaseCacheStore|RedisCacheStore|ArrayCacheStore |
|
| 120 | - */ |
|
| 119 | + * @var FileCacheStore|DatabaseCacheStore|RedisCacheStore|ArrayCacheStore |
|
| 120 | + */ |
|
| 121 | 121 | public RedisCacheStore|DatabaseCacheStore|ArrayCacheStore|FileCacheStore $cacheStore; |
| 122 | 122 | |
| 123 | 123 | /** |
| 124 | - * @var array |
|
| 125 | - */ |
|
| 124 | + * @var array |
|
| 125 | + */ |
|
| 126 | 126 | public array $options = []; |
| 127 | 127 | |
| 128 | 128 | /** |
| 129 | - * @var CacheRetriever |
|
| 130 | - */ |
|
| 129 | + * @var CacheRetriever |
|
| 130 | + */ |
|
| 131 | 131 | private CacheRetriever $retriever; |
| 132 | 132 | |
| 133 | 133 | /** |
| 134 | - * @var CacheMutator |
|
| 135 | - */ |
|
| 134 | + * @var CacheMutator |
|
| 135 | + */ |
|
| 136 | 136 | private CacheMutator $mutator; |
| 137 | 137 | |
| 138 | 138 | /** |
| 139 | - * @var CacheConfig |
|
| 140 | - */ |
|
| 139 | + * @var CacheConfig |
|
| 140 | + */ |
|
| 141 | 141 | private CacheConfig $config; |
| 142 | 142 | |
| 143 | 143 | /** |
| 144 | - * @var Cacheer|null |
|
| 145 | - */ |
|
| 144 | + * @var Cacheer|null |
|
| 145 | + */ |
|
| 146 | 146 | private static ?Cacheer $staticInstance = null; |
| 147 | 147 | |
| 148 | 148 | /** |
| 149 | - * Cacheer constructor. |
|
| 150 | - * |
|
| 151 | - * @param array $options |
|
| 152 | - * @param bool $formatted |
|
| 153 | - * @throws RuntimeException|Exceptions\CacheFileException |
|
| 149 | + * Cacheer constructor. |
|
| 150 | + * |
|
| 151 | + * @param array $options |
|
| 152 | + * @param bool $formatted |
|
| 153 | + * @throws RuntimeException|Exceptions\CacheFileException |
|
| 154 | 154 | */ |
| 155 | 155 | public function __construct(array $options = [], bool $formatted = false) |
| 156 | 156 | { |
@@ -226,11 +226,11 @@ discard block |
||
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | /** |
| 229 | - * Enable encryption for cached data |
|
| 230 | - * |
|
| 231 | - * @param string $key |
|
| 232 | - * @return $this |
|
| 233 | - */ |
|
| 229 | + * Enable encryption for cached data |
|
| 230 | + * |
|
| 231 | + * @param string $key |
|
| 232 | + * @return $this |
|
| 233 | + */ |
|
| 234 | 234 | protected function useEncryption(string $key): Cacheer |
| 235 | 235 | { |
| 236 | 236 | $this->encryptionKey = $key; |
@@ -238,11 +238,11 @@ discard block |
||
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | /** |
| 241 | - * Enable or disable data compression |
|
| 242 | - * |
|
| 243 | - * @param bool $status |
|
| 244 | - * @return $this |
|
| 245 | - */ |
|
| 241 | + * Enable or disable data compression |
|
| 242 | + * |
|
| 243 | + * @param bool $status |
|
| 244 | + * @return $this |
|
| 245 | + */ |
|
| 246 | 246 | protected function useCompression(bool $status = true): Cacheer |
| 247 | 247 | { |
| 248 | 248 | $this->compression = $status; |
@@ -250,43 +250,43 @@ discard block |
||
| 250 | 250 | } |
| 251 | 251 | |
| 252 | 252 | /** |
| 253 | - * Enables or disables the formatter for cache data. |
|
| 254 | - * |
|
| 255 | - * @return void |
|
| 256 | - */ |
|
| 253 | + * Enables or disables the formatter for cache data. |
|
| 254 | + * |
|
| 255 | + * @return void |
|
| 256 | + */ |
|
| 257 | 257 | protected function useFormatter(): void |
| 258 | 258 | { |
| 259 | 259 | $this->formatted = !$this->formatted; |
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | /** |
| 263 | - * Validates the options provided for the Cacheer instance. |
|
| 264 | - * |
|
| 265 | - * @param array $options |
|
| 266 | - * @return void |
|
| 267 | - */ |
|
| 263 | + * Validates the options provided for the Cacheer instance. |
|
| 264 | + * |
|
| 265 | + * @param array $options |
|
| 266 | + * @return void |
|
| 267 | + */ |
|
| 268 | 268 | private function validateOptions(array $options): void |
| 269 | 269 | { |
| 270 | 270 | $this->options = $options; |
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | /** |
| 274 | - * Checks if the last operation was successful. |
|
| 275 | - * |
|
| 276 | - * @return bool |
|
| 277 | - */ |
|
| 274 | + * Checks if the last operation was successful. |
|
| 275 | + * |
|
| 276 | + * @return bool |
|
| 277 | + */ |
|
| 278 | 278 | protected function isSuccess(): bool |
| 279 | 279 | { |
| 280 | 280 | return $this->success; |
| 281 | 281 | } |
| 282 | 282 | |
| 283 | 283 | /** |
| 284 | - * Sets a message for the cache operation. |
|
| 285 | - * |
|
| 286 | - * @param string $message |
|
| 287 | - * @param boolean $success |
|
| 288 | - * @return void |
|
| 289 | - */ |
|
| 284 | + * Sets a message for the cache operation. |
|
| 285 | + * |
|
| 286 | + * @param string $message |
|
| 287 | + * @param boolean $success |
|
| 288 | + * @return void |
|
| 289 | + */ |
|
| 290 | 290 | private function setMessage(string $message, bool $success): void |
| 291 | 291 | { |
| 292 | 292 | $this->message = $message; |
@@ -294,10 +294,10 @@ discard block |
||
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | /** |
| 297 | - * Retrieves the message from the last operation. |
|
| 298 | - * |
|
| 299 | - * @return string |
|
| 300 | - */ |
|
| 297 | + * Retrieves the message from the last operation. |
|
| 298 | + * |
|
| 299 | + * @return string |
|
| 300 | + */ |
|
| 301 | 301 | protected function getMessage(): string |
| 302 | 302 | { |
| 303 | 303 | return $this->message; |