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

ApiSetTrait::sInter()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 8
c 0
b 0
f 0
ccs 0
cts 4
cp 0
rs 9.4285
nc 1
cc 1
eloc 4
nop 1
crap 2
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 ApiSetTrait
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 sScan($key, $cursor, array $options = [])
22
    {
23
        // TODO: Implement sScan() method.
24
        $command = Enum::SSCAN;
25
        $args = [$key, $cursor];
26
        $args = array_merge($args, $options);
27
28
        return $this->dispatch(Builder::build($command, $args));
29
    }
30
31
    /**
32
     * @override
33
     * @inheritDoc
34
     */
35
    public function sInter(...$keys)
36
    {
37
        // TODO: Implement sInter() method.
38
        $command = Enum::SINTER;
39
        $args = $keys;
40
41
        return $this->dispatch(Builder::build($command, $args));
42
    }
43
44
    /**
45
     * @override
46
     * @inheritDoc
47
     */
48
    public function sInterStore($dst, ...$keys)
49
    {
50
        // TODO: Implement sInterStore() method.
51
        $command = Enum::SINTERSTORE;
52
        $args = [$dst];
53
        $args = array_merge($args, $keys);
54
55
        return $this->dispatch(Builder::build($command, $args));
56
    }
57
58
    /**
59
     * @override
60
     * @inheritDoc
61
     */
62
    public function sIsMember($key, $member)
63
    {
64
        // TODO: Implement sIsMember() method.
65
        $command = Enum::SISMEMBER;
66
        $args = [$key ,$member];
67
68
        return $this->dispatch(Builder::build($command, $args));
69
    }
70
71
    /**
72
     * @override
73
     * @inheritDoc
74
     */
75
    public function sLowLog($command, array $args = [])
0 ignored issues
show
Unused Code introduced by
The parameter $command is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
76
    {
77
        // TODO: Implement sLowLog() method.
78
        $command = Enum::SLOWLOG;
79
        $args = array_merge([$command],$args);
80
81
        return $this->dispatch(Builder::build($command, $args));
82
    }
83
84
    /**
85
     * @override
86
     * @inheritDoc
87
     */
88 View Code Duplication
    public function sMembers($key)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
89
    {
90
        // TODO: Implement sMembers() method.
91
        $command = Enum::SMEMBERS;
92
        $args = [$key];
93
94
        return $this->dispatch(Builder::build($command, $args));
95
    }
96
97
    /**
98
     * @override
99
     * @inheritDoc
100
     */
101
    public function sMove($src, $dst, $members)
102
    {
103
        // TODO: Implement sMove() method.
104
        $command = Enum::SMOVE;
105
        $args = [$src, $dst];
106
        $args = array_merge( $args, $members);
107
108
        return $this->dispatch(Builder::build($command, $args));
109
    }
110
111
    /**
112
     * @override
113
     * @inheritDoc
114
     */
115 View Code Duplication
    public function sPop($key, $count)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
116
    {
117
        // TODO: Implement sPop() method.
118
        $command = Enum::SPOP;
119
        $args = [$key, $count];
120
121
        return $this->dispatch(Builder::build($command, $args));
122
    }
123
124
    /**
125
     * @override
126
     * @inheritDoc
127
     */
128 View Code Duplication
    public function sRandMember($key, $count)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
129
    {
130
        // TODO: Implement sRandMember() method.
131
        $command = Enum::SRANDMEMBER;
132
        $args = [$key, $count];
133
134
        return $this->dispatch(Builder::build($command, $args));
135
    }
136
137
    /**
138
     * @override
139
     * @inheritDoc
140
     */
141
    public function sRem($key, ...$members)
142
    {
143
        // TODO: Implement sRem() method.
144
        $command = Enum::SREM;
145
        $args = [$key];
146
        $args = array_merge($args, $members);
147
148
        return $this->dispatch(Builder::build($command, $args));
149
    }
150
151
    /**
152
     * @override
153
     * @inheritDoc
154
     */
155
    public function sUnion(...$keys)
156
    {
157
        // TODO: Implement sUnion() method.
158
        $command = Enum::SUNION;
159
        $args = $keys;
160
161
        return $this->dispatch(Builder::build($command, $args));
162
    }
163
164
    /**
165
     * @override
166
     * @inheritDoc
167
     */
168
    public function sUnionStore($dst, ...$keys)
169
    {
170
        // TODO: Implement sUnionStore() method.
171
        $command = Enum::SUNIONSTORE;
172
        $args = [$dst];
173
        $args = array_merge($args, $keys);
174
175
        return $this->dispatch(Builder::build($command, $args));
176
    }
177
178
    /**
179
     * @override
180
     * @inheritDoc
181
     */
182
    public function sWapBb($opt, $dst, ...$keys)
183
    {
184
        // TODO: Implement sWapBb() method.
185
        $command = Enum::SWAPDB;
186
        $args = [$opt, $dst];
187
        $args = array_merge($args, $keys);
188
189
        return $this->dispatch(Builder::build($command, $args));
190
    }
191
192
    /**
193
     * @override
194
     * @inheritDoc
195
     */
196
    public function sAdd($key, ...$members)
197
    {
198
        // TODO: Implement sAdd() method.
199
        $command = Enum::SADD;
200
        $args = [$key];
201
        $args = array_merge($args, $members);
202
203
        return $this->dispatch(Builder::build($command, $args));
204
    }
205
206
    /**
207
     * @override
208
     * @inheritDoc
209
     */
210 View Code Duplication
    public function sCard($key)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
211
    {
212
        // TODO: Implement sCard() method.
213
        $command = Enum::SCARD;
214
        $args = [$key];
215
216
        return $this->dispatch(Builder::build($command, $args));
217
    }
218
219
    /**
220
     * @override
221
     * @inheritDoc
222
     */
223
    public function sDiff(...$keys)
224
    {
225
        // TODO: Implement sDiff() method.
226
        $command = Enum::SDIFF;
227
        $args = $keys;
228
229
        return $this->dispatch(Builder::build($command, $args));
230
    }
231
232
    /**
233
     * @override
234
     * @inheritDoc
235
     */
236
    public function sDiffStore($dst, ...$keys)
237
    {
238
        // TODO: Implement sDiffStore() method.
239
        $command = Enum::SDIFFSTORE;
240
        $args = [$dst];
241
        $args = array_merge($args, $keys);
242
243
        return $this->dispatch(Builder::build($command, $args));
244
    }
245
}
246