Passed
Push — master ( c94b56...122110 )
by Brian
12:02
created

BaseAction::shiftCursor()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 7
ccs 5
cts 5
cp 1
crap 1
rs 10
c 1
b 0
f 0
1
<?php
2
3
namespace Bmatovu\Ussd\Actions;
4
5
use Bmatovu\Ussd\Contracts\Tag;
6
use Bmatovu\Ussd\Traits\Attributes;
7
use Bmatovu\Ussd\Traits\CacheStore;
8
use Bmatovu\Ussd\Traits\Expressions;
9
use Illuminate\Contracts\Cache\Repository as CacheContract;
10
11
class BaseAction implements Tag
12
{
13
    use Attributes;
0 ignored issues
show
introduced by
The trait Bmatovu\Ussd\Traits\Attributes requires some properties which are not provided by Bmatovu\Ussd\Actions\BaseAction: $nodeValue, $attributes
Loading history...
14
    use CacheStore;
15
    use Expressions;
16
17
    protected \DOMNode $node;
18
    protected CacheContract $cache;
19
    protected string $prefix;
20
    protected int $ttl;
21
22 2
    public function __construct(\DOMNode $node, CacheContract $cache, string $prefix, ?int $ttl = null)
23
    {
24 2
        $this->node = $node;
25 2
        $this->cache = $cache;
26 2
        $this->prefix = $prefix;
27 2
        $this->ttl = $ttl;
28
    }
29
30 1
    public function handle(): ?string
31
    {
32 1
        $this->shiftCursor();
33
34 1
        return '';
35
    }
36
37
    public function process(?string $answer): void
38
    {
39
    }
40
41 1
    protected function shiftCursor(): void
42
    {
43 1
        $pre = $this->fromCache('pre');
0 ignored issues
show
Unused Code introduced by
The assignment to $pre is dead and can be removed.
Loading history...
44 1
        $exp = $this->fromCache('exp', $this->node->getNodePath());
45
46 1
        $this->toCache('pre', $exp);
47 1
        $this->toCache('exp', $this->incExp($exp));
48
    }
49
}
50