Trait_RuleWithCache::flushCache()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 10
ccs 6
cts 6
cp 1
crap 1
rs 9.9332
c 0
b 0
f 0
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