Completed
Push — master ( 9e125a...9a1e57 )
by Kamil
02:25
created

ApiTransactionTrait   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 58
c 0
b 0
f 0
wmc 4
lcom 1
cbo 1
ccs 0
cts 14
cp 0
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
dispatch() 0 1 ?
A discard() 0 7 1
A multi() 0 7 1
A unWatch() 0 7 1
A watch() 0 9 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
    public function discard()
22
    {
23
        // TODO: Implement discard() method.
24
        $command = Enum::DISCARD;
25
26
        return $this->dispatch(Builder::build($command));
27
    }
28
29
    /**
30
     * @override
31
     * @inheritDoc
32
     */
33
    public function multi()
34
    {
35
        // TODO: Implement multi() method.
36
        $command = Enum::MULTI;
37
38
        return $this->dispatch(Builder::build($command));
39
    }
40
41
    /**
42
     * @override
43
     * @inheritDoc
44
     */
45
    public function unWatch()
46
    {
47
        // TODO: Implement unWatch() method.
48
        $command = Enum::UNWATCH;
49
50
        return $this->dispatch(Builder::build($command));
51
    }
52
53
    /**
54
     * @override
55
     * @inheritDoc
56
     */
57
    public function watch($key, ...$keys)
58
    {
59
        // TODO: Implement watch() method.
60
        $command = Enum::WATCH;
61
        $args = [$key];
62
        $args = array_merge($args, $keys);
63
64
        return $this->dispatch(Builder::build($command, $args));
65
    }
66
}
67