Completed
Push — master ( e70d22...5bd967 )
by Kamil
12s
created

ApiTransactionTrait::exec()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
c 0
b 0
f 0
ccs 3
cts 3
cp 1
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Dazzle\Redis\Command\Compose;
4
5
use Dazzle\Redis\Command\Builder;
6
use Dazzle\Redis\Command\Enum;
7
use Dazzle\Redis\Driver\Request;
8
9
trait ApiTransactionTrait
10
{
11
    /**
12
     * @param Request $request
13
     * @return mixed
14
     */
15
    abstract function dispatch(Request $request);
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
16
17
    /**
18
     * @override
19
     * @inheritDoc
20
     */
21 2
    public function discard()
22
    {
23 2
        $command = Enum::DISCARD;
24
25 2
        return $this->dispatch(Builder::build($command));
26
    }
27
28
    /**
29
     * @override
30
     * @inheritDoc
31
     */
32 1
    public function exec()
33
    {
34 1
        $command = Enum::EXEC;
35
36 1
        return $this->dispatch(Builder::build($command));
37
    }
38
39
    /**
40
     * @override
41
     * @inheritDoc
42
     */
43 3
    public function multi()
44
    {
45 3
        $command = Enum::MULTI;
46
47 3
        return $this->dispatch(Builder::build($command));
48
    }
49
50
    /**
51
     * @override
52
     * @inheritDoc
53
     */
54 1
    public function unWatch()
55
    {
56 1
        $command = Enum::UNWATCH;
57
58 1
        return $this->dispatch(Builder::build($command));
59
    }
60
61
    /**
62
     * @override
63
     * @inheritDoc
64
     */
65 2
    public function watch($key, ...$keys)
66
    {
67 2
        $command = Enum::WATCH;
68 2
        $args = [$key];
69 2
        $args = array_merge($args, $keys);
70
71 2
        return $this->dispatch(Builder::build($command, $args));
72
    }
73
}
74