| Total Complexity | 12 |
| Total Lines | 59 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 12 | class CacheRedisHelper |
||
| 13 | { |
||
| 14 | |||
| 15 | /** |
||
| 16 | * @param mixed $data |
||
| 17 | * @param bool $serialize |
||
| 18 | * @return string |
||
| 19 | */ |
||
| 20 | public static function serialize(mixed $data, bool $serialize = true) |
||
| 27 | |||
| 28 | } |
||
| 29 | |||
| 30 | /** |
||
| 31 | * @param array $item |
||
| 32 | * @return void |
||
| 33 | */ |
||
| 34 | public static function validateCacheItem(array $item) |
||
| 35 | { |
||
| 36 | if (!isset($item['cacheKey']) || !isset($item['cacheData'])) { |
||
| 37 | throw CacheRedisException::create("Each item must contain 'cacheKey' and 'cacheData'"); |
||
| 38 | } |
||
| 39 | } |
||
| 40 | |||
| 41 | /** |
||
| 42 | * @param array $options |
||
| 43 | * @return array |
||
| 44 | */ |
||
| 45 | public static function mergeCacheData($cacheData) |
||
| 46 | { |
||
| 47 | if (is_array($cacheData) && is_array(reset($cacheData))) { |
||
| 48 | $merged = []; |
||
| 49 | foreach ($cacheData as $data) { |
||
| 50 | $merged[] = $data; |
||
| 51 | } |
||
| 52 | return $merged; |
||
| 53 | } |
||
| 54 | return (array)$cacheData; |
||
| 55 | } |
||
| 56 | |||
| 57 | /** |
||
| 58 | * @param mixed $currentCacheData |
||
| 59 | * @param mixed $cacheData |
||
| 60 | * @return array |
||
| 61 | */ |
||
| 62 | public static function arrayIdentifier(mixed $currentCacheData, mixed $cacheData) |
||
| 71 | } |
||
| 72 | |||
| 73 | } |
||
| 75 |