Trait_RuleWithCache   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 38
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0
wmc 2
lcom 2
cbo 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A flushCache() 0 10 1
A flushStaticCache() 0 6 1
1
<?php
2
/**
3
 * Trait_RuleWithCache
4
 *
5
 * @package php-logical-filter
6
 * @author  Jean Claveau
7
 */
8
namespace JClaveau\LogicalFilter\Rule;
9
10
trait Trait_RuleWithCache
11
{
12
    /** @var array $cache */
13
    protected $cache = [
14
        'array'       => null,  // filled by toArray()
15
        'string'      => null,  // filled by toString()
16
        'semantic_id' => null,  // filled by getSemanticId()
17
    ];
18
19
    /** @var array $static_cache */
20
    protected static $static_cache = [
21
        'rules_generation' => [],
22
    ];
23
24
    /**
25
     */
26 305
    public function flushCache()
27
    {
28 305
        $this->cache = [
29 305
            'array'       => null,
30 305
            'string'      => null,
31 305
            'semantic_id' => null,
32
        ];
33
34 305
        return $this;
35
    }
36
37
    /**
38
     */
39 1
    public static function flushStaticCache()
40
    {
41 1
        static::$static_cache = [
42 1
            'rules_generation' => [],
43 1
        ];
44 1
    }
45
46
    /**/
47
}
48