Passed
Push — master ( 2197c3...f519e1 )
by Brian
02:30
created

BaseAction::process()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 0
nc 1
nop 1
dl 0
loc 2
ccs 0
cts 0
cp 0
crap 2
rs 10
c 1
b 0
f 0
1
<?php
2
3
namespace Bmatovu\Ussd\Actions;
4
5
use Bmatovu\Ussd\Contracts\RenderableTag;
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 RenderableTag
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
    protected bool $isAnswerable = false;
22
23 2
    public function __construct(\DOMNode $node, CacheContract $cache, string $prefix, ?int $ttl = null)
24
    {
25 2
        $this->node = $node;
26 2
        $this->cache = $cache;
27 2
        $this->prefix = $prefix;
28 2
        $this->ttl = $ttl;
29
    }
30
31 1
    public function handle(): ?string
32
    {
33 1
        $this->shiftCursor();
34
35 1
        return '';
36
    }
37
38 1
    protected function shiftCursor(): void
39
    {
40 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...
41 1
        $exp = $this->fromCache('exp', $this->node->getNodePath());
42
43 1
        $this->toCache('pre', $exp);
44 1
        $this->toCache('exp', $this->incExp($exp));
45
    }
46
}
47