CacheDatabaseHelper   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 6
dl 0
loc 37
rs 10
c 1
b 0
f 1
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A mergeCacheData() 0 3 1
A arrayIdentifier() 0 3 1
A validateCacheItem() 0 5 1
1
<?php
2
3
namespace Silviooosilva\CacheerPhp\Helpers;
4
5
use Silviooosilva\CacheerPhp\Helpers\CacheerHelper;
6
use Silviooosilva\CacheerPhp\Exceptions\CacheDatabaseException;
7
8
/**
9
 * Class CacheDatabaseHelper
10
 * @author Sílvio Silva <https://github.com/silviooosilva>
11
 * @package Silviooosilva\CacheerPhp
12
 */
13
class CacheDatabaseHelper
14
{
15
    /**
16
     * Validates a cache item.
17
     * 
18
     * @param array $item
19
     * @return void
20
     */
21
    public static function validateCacheItem(array $item): void
22
    {
23
        CacheerHelper::validateCacheItem(
24
            $item,
25
            fn($msg) => CacheDatabaseException::create($msg)
26
        );
27
    }
28
29
    /**
30
     * Merges cache data with existing data.
31
     *
32
     * @param $cacheData
33
     * @return array
34
     */
35
    public static function mergeCacheData($cacheData): array
36
    {
37
        return CacheerHelper::mergeCacheData($cacheData);
38
    }
39
40
    /**
41
     * Generates an array identifier for cache data.
42
     * 
43
     * @param mixed $currentCacheData
44
     * @param mixed $cacheData
45
     * @return array
46
     */
47
    public static function arrayIdentifier(mixed $currentCacheData, mixed $cacheData): array
48
    {
49
        return CacheerHelper::arrayIdentifier($currentCacheData, $cacheData);
50
    }
51
}
52
53