@@ -82,15 +82,15 @@ |
||
| 82 | 82 | return $ttl; |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - /** |
|
| 86 | - * Generates an array identifier for cache data. |
|
| 87 | - * |
|
| 88 | - * @param mixed $currentCacheData |
|
| 89 | - * @param mixed $cacheData |
|
| 90 | - * @return array |
|
| 91 | - */ |
|
| 92 | - public static function arrayIdentifier(mixed $currentCacheData, mixed $cacheData): array |
|
| 93 | - { |
|
| 85 | + /** |
|
| 86 | + * Generates an array identifier for cache data. |
|
| 87 | + * |
|
| 88 | + * @param mixed $currentCacheData |
|
| 89 | + * @param mixed $cacheData |
|
| 90 | + * @return array |
|
| 91 | + */ |
|
| 92 | + public static function arrayIdentifier(mixed $currentCacheData, mixed $cacheData): array |
|
| 93 | + { |
|
| 94 | 94 | return CacheerHelper::arrayIdentifier($currentCacheData, $cacheData); |
| 95 | - } |
|
| 95 | + } |
|
| 96 | 96 | } |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | * @return float|int |
| 21 | 21 | * @throws CacheFileException |
| 22 | 22 | */ |
| 23 | - public static function convertExpirationToSeconds(string $expiration): float|int |
|
| 23 | + public static function convertExpirationToSeconds(string $expiration): float | int |
|
| 24 | 24 | { |
| 25 | 25 | $units = [ |
| 26 | 26 | 'second' => 1, |
@@ -12,24 +12,24 @@ discard block |
||
| 12 | 12 | { |
| 13 | 13 | |
| 14 | 14 | /** |
| 15 | - * Gets the path to the SQLite database file. |
|
| 16 | - * |
|
| 17 | - * @param string $database |
|
| 18 | - * @param ?string $path |
|
| 19 | - * @return string |
|
| 20 | - */ |
|
| 15 | + * Gets the path to the SQLite database file. |
|
| 16 | + * |
|
| 17 | + * @param string $database |
|
| 18 | + * @param ?string $path |
|
| 19 | + * @return string |
|
| 20 | + */ |
|
| 21 | 21 | public static function database(string $database = 'database.sqlite', ?string $path = null): string |
| 22 | 22 | { |
| 23 | 23 | return self::getDynamicSqliteDbPath($database, $path); |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | - * Gets the path to the SQLite database file dynamically. |
|
| 28 | - * |
|
| 29 | - * @param string $database |
|
| 30 | - * @param ?string $path |
|
| 31 | - * @return string |
|
| 32 | - */ |
|
| 27 | + * Gets the path to the SQLite database file dynamically. |
|
| 28 | + * |
|
| 29 | + * @param string $database |
|
| 30 | + * @param ?string $path |
|
| 31 | + * @return string |
|
| 32 | + */ |
|
| 33 | 33 | private static function getDynamicSqliteDbPath(string $database, ?string $path = null): string |
| 34 | 34 | { |
| 35 | 35 | $rootPath = EnvHelper::getRootPath(); |
@@ -47,11 +47,11 @@ discard block |
||
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | /** |
| 50 | - * Creates the database directory if it does not exist. |
|
| 51 | - * |
|
| 52 | - * @param string $databaseDir |
|
| 53 | - * @return void |
|
| 54 | - */ |
|
| 50 | + * Creates the database directory if it does not exist. |
|
| 51 | + * |
|
| 52 | + * @param string $databaseDir |
|
| 53 | + * @return void |
|
| 54 | + */ |
|
| 55 | 55 | private static function createDatabaseDir(string $databaseDir): void |
| 56 | 56 | { |
| 57 | 57 | if (!is_dir($databaseDir)) { |
@@ -60,11 +60,11 @@ discard block |
||
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | /** |
| 63 | - * Creates the SQLite database file if it does not exist. |
|
| 64 | - * |
|
| 65 | - * @param string $dbFile |
|
| 66 | - * @return void |
|
| 67 | - */ |
|
| 63 | + * Creates the SQLite database file if it does not exist. |
|
| 64 | + * |
|
| 65 | + * @param string $dbFile |
|
| 66 | + * @return void |
|
| 67 | + */ |
|
| 68 | 68 | private static function createDatabaseFile(string $dbFile): void |
| 69 | 69 | { |
| 70 | 70 | if (!file_exists($dbFile)) { |
@@ -73,12 +73,12 @@ discard block |
||
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | /** |
| 76 | - * Checks if the database name has the correct extension. |
|
| 77 | - * If not, appends '.sqlite' to the name. |
|
| 78 | - * |
|
| 79 | - * @param string $database |
|
| 80 | - * @return string |
|
| 81 | - */ |
|
| 76 | + * Checks if the database name has the correct extension. |
|
| 77 | + * If not, appends '.sqlite' to the name. |
|
| 78 | + * |
|
| 79 | + * @param string $database |
|
| 80 | + * @return string |
|
| 81 | + */ |
|
| 82 | 82 | private static function checkExtension(string $database): string |
| 83 | 83 | { |
| 84 | 84 | if (!str_contains($database, '.sqlite')) { |
@@ -13,29 +13,29 @@ discard block |
||
| 13 | 13 | class CacheRedisHelper |
| 14 | 14 | { |
| 15 | 15 | |
| 16 | - /** |
|
| 17 | - * serializes or unserializes data based on the $serialize flag. |
|
| 18 | - * |
|
| 19 | - * @param mixed $data |
|
| 20 | - * @param bool $serialize |
|
| 21 | - * @return mixed |
|
| 22 | - */ |
|
| 23 | - public static function serialize(mixed $data, bool $serialize = true): mixed |
|
| 24 | - { |
|
| 16 | + /** |
|
| 17 | + * serializes or unserializes data based on the $serialize flag. |
|
| 18 | + * |
|
| 19 | + * @param mixed $data |
|
| 20 | + * @param bool $serialize |
|
| 21 | + * @return mixed |
|
| 22 | + */ |
|
| 23 | + public static function serialize(mixed $data, bool $serialize = true): mixed |
|
| 24 | + { |
|
| 25 | 25 | if($serialize) { |
| 26 | - return serialize($data); |
|
| 26 | + return serialize($data); |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | return unserialize($data); |
| 30 | 30 | |
| 31 | - } |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | 33 | /** |
| 34 | - * Validates a cache item. |
|
| 35 | - * |
|
| 36 | - * @param array $item |
|
| 37 | - * @return void |
|
| 38 | - */ |
|
| 34 | + * Validates a cache item. |
|
| 35 | + * |
|
| 36 | + * @param array $item |
|
| 37 | + * @return void |
|
| 38 | + */ |
|
| 39 | 39 | public static function validateCacheItem(array $item): void |
| 40 | 40 | { |
| 41 | 41 | CacheerHelper::validateCacheItem( |
@@ -55,17 +55,17 @@ discard block |
||
| 55 | 55 | return CacheerHelper::mergeCacheData($cacheData); |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - /** |
|
| 59 | - * Generates an array identifier for cache data. |
|
| 60 | - * |
|
| 61 | - * @param mixed $currentCacheData |
|
| 62 | - * @param mixed $cacheData |
|
| 63 | - * @return array |
|
| 64 | - */ |
|
| 65 | - public static function arrayIdentifier(mixed $currentCacheData, mixed $cacheData): array |
|
| 66 | - { |
|
| 67 | - return CacheerHelper::arrayIdentifier($currentCacheData, $cacheData); |
|
| 68 | - } |
|
| 58 | + /** |
|
| 59 | + * Generates an array identifier for cache data. |
|
| 60 | + * |
|
| 61 | + * @param mixed $currentCacheData |
|
| 62 | + * @param mixed $cacheData |
|
| 63 | + * @return array |
|
| 64 | + */ |
|
| 65 | + public static function arrayIdentifier(mixed $currentCacheData, mixed $cacheData): array |
|
| 66 | + { |
|
| 67 | + return CacheerHelper::arrayIdentifier($currentCacheData, $cacheData); |
|
| 68 | + } |
|
| 69 | 69 | |
| 70 | 70 | } |
| 71 | 71 | |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | */ |
| 23 | 23 | public static function serialize(mixed $data, bool $serialize = true): mixed |
| 24 | 24 | { |
| 25 | - if($serialize) { |
|
| 25 | + if ($serialize) { |
|
| 26 | 26 | return serialize($data); |
| 27 | 27 | } |
| 28 | 28 | |