Variable   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
eloc 7
c 1
b 0
f 0
dl 0
loc 27
ccs 11
cts 11
cp 1
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A set() 0 4 1
A exists() 0 3 1
A init() 0 2 1
A clear() 0 3 1
A get() 0 3 1
1
<?php
2
3
namespace kalanis\kw_cache\Simple;
4
5
6
use kalanis\kw_cache\Interfaces\ICache;
7
8
9
/**
10
 * Class Variable
11
 * @package kalanis\kw_cache\Simple
12
 * Caching content in variable
13
 */
14
class Variable implements ICache
15
{
16
    protected ?string $content = null;
17
18 4
    public function init(array $what): void
19
    {
20 4
    }
21
22 6
    public function exists(): bool
23
    {
24 6
        return !is_null($this->content);
25
    }
26
27 7
    public function set(string $content): bool
28
    {
29 7
        $this->content = $content;
30 7
        return true;
31
    }
32
33 5
    public function get(): string
34
    {
35 5
        return strval($this->content);
36
    }
37
38 4
    public function clear(): void
39
    {
40 4
        $this->content = null;
41 4
    }
42
}
43