CacheTrait   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 20
ccs 0
cts 10
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A resolveCache() 0 12 3
1
<?php
2
3
/**
4
 * @copyright  Copyright (c) Flipbox Digital Limited
5
 * @license    https://flipboxfactory.com/software/hubspot/license
6
 * @link       https://www.flipboxfactory.com/software/hubspot/
7
 */
8
9
namespace flipbox\craft\hubspot\criteria;
10
11
use flipbox\craft\hubspot\HubSpot;
12
use Psr\SimpleCache\CacheInterface;
13
14
/**
15
 * @author Flipbox Factory <[email protected]>
16
 * @since 1.0.0
17
 */
18
trait CacheTrait
19
{
20
    use \Flipbox\HubSpot\Criteria\CacheTrait;
21
22
    /**
23
     * @inheritdoc
24
     */
25
    protected function resolveCache($cache): CacheInterface
26
    {
27
        if ($cache instanceof CacheInterface) {
28
            return $cache;
29
        }
30
31
        if ($cache === null) {
32
            $cache = HubSpot::getInstance()->getSettings()->getDefaultCache();
33
        }
34
35
        return HubSpot::getInstance()->getCache()->get($cache);
36
    }
37
}
38