Completed
Push — master ( 9eab6b...93ca92 )
by Kamil
10s
created

ApiKeyValTrait::bitField()   B

Complexity

Conditions 5
Paths 5

Size

Total Lines 34
Code Lines 24

Duplication

Lines 10
Ratio 29.41 %

Code Coverage

Tests 8
CRAP Score 11.4436

Importance

Changes 0
Metric Value
dl 10
loc 34
ccs 8
cts 22
cp 0.3636
rs 8.439
c 0
b 0
f 0
cc 5
eloc 24
nc 5
nop 3
crap 11.4436
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 ApiKeyValTrait
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 1 View Code Duplication
    public function append($key, $value)
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...
22
    {
23 1
        $command = Enum::APPEND;
24 1
        $args = [$key, $value];
25
26 1
        return $this->dispatch(Builder::build($command, $args));
27
    }
28
29
    /**
30
     * @override
31
     * @inheritDoc
32
     */
33 1 View Code Duplication
    public function bitCount($key, $start = 0, $end = -1)
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...
34
    {
35 1
        $command = Enum::BITCOUNT;
36 1
        $args = [$key, $start, $end];
37
38 1
        return $this->dispatch(Builder::build($command, $args));
39
    }
40
41
    /**
42
     * @override
43
     * @inheritDoc
44
     */
45 1
    public function bitField($key, $subCommand, ...$param)
46
    {
47 1
        $command = Enum::BITFIELD;
48 1
        $subCommand = strtoupper($subCommand);
49
        //TODO: control flow improvement
50
        switch ($subCommand) {
51 1 View Code Duplication
            case 'GET' : {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across 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...
Coding Style introduced by
case statements should be defined using a colon.

As per the PSR-2 coding standard, case statements should not be wrapped in curly braces. There is no need for braces, since each case is terminated by the next break.

There is also the option to use a semicolon instead of a colon, this is discouraged because many programmers do not even know it works and the colon is universal between programming languages.

switch ($expr) {
    case "A": { //wrong
        doSomething();
        break;
    }
    case "B"; //wrong
        doSomething();
        break;
    case "C": //right
        doSomething();
        break;
}

To learn more about the PSR-2 coding standard, please refer to the PHP-Fig.

Loading history...
52 1
                @list ($type, $offset) = $param;
0 ignored issues
show
Security Best Practice introduced by
It seems like you do not handle an error condition here. This can introduce security issues, and is generally not recommended.

If you suppress an error, we recommend checking for the error condition explicitly:

// For example instead of
@mkdir($dir);

// Better use
if (@mkdir($dir) === false) {
    throw new \RuntimeException('The directory '.$dir.' could not be created.');
}
Loading history...
53 1
                $args = [$key, $subCommand, $type, $offset];
54 1
                break;
55
            }
56 View Code Duplication
            case 'SET' : {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across 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...
Coding Style introduced by
case statements should be defined using a colon.

As per the PSR-2 coding standard, case statements should not be wrapped in curly braces. There is no need for braces, since each case is terminated by the next break.

There is also the option to use a semicolon instead of a colon, this is discouraged because many programmers do not even know it works and the colon is universal between programming languages.

switch ($expr) {
    case "A": { //wrong
        doSomething();
        break;
    }
    case "B"; //wrong
        doSomething();
        break;
    case "C": //right
        doSomething();
        break;
}

To learn more about the PSR-2 coding standard, please refer to the PHP-Fig.

Loading history...
57
                @list ($type, $offset, $value) = $param;
0 ignored issues
show
Security Best Practice introduced by
It seems like you do not handle an error condition here. This can introduce security issues, and is generally not recommended.

If you suppress an error, we recommend checking for the error condition explicitly:

// For example instead of
@mkdir($dir);

// Better use
if (@mkdir($dir) === false) {
    throw new \RuntimeException('The directory '.$dir.' could not be created.');
}
Loading history...
58
                $args = [$key, $subCommand, $type, $offset, $value];
59
                break;
60
            }
61
            case 'INCRBY' : {
0 ignored issues
show
Coding Style introduced by
case statements should be defined using a colon.

As per the PSR-2 coding standard, case statements should not be wrapped in curly braces. There is no need for braces, since each case is terminated by the next break.

There is also the option to use a semicolon instead of a colon, this is discouraged because many programmers do not even know it works and the colon is universal between programming languages.

switch ($expr) {
    case "A": { //wrong
        doSomething();
        break;
    }
    case "B"; //wrong
        doSomething();
        break;
    case "C": //right
        doSomething();
        break;
}

To learn more about the PSR-2 coding standard, please refer to the PHP-Fig.

Loading history...
62
                @list ($type, $offset, $increment) = $param;
0 ignored issues
show
Security Best Practice introduced by
It seems like you do not handle an error condition here. This can introduce security issues, and is generally not recommended.

If you suppress an error, we recommend checking for the error condition explicitly:

// For example instead of
@mkdir($dir);

// Better use
if (@mkdir($dir) === false) {
    throw new \RuntimeException('The directory '.$dir.' could not be created.');
}
Loading history...
63
                $args = [$key, $type, $offset, $increment];
64
                break;
65
            }
66
            case 'OVERFLOW' : {
0 ignored issues
show
Coding Style introduced by
case statements should be defined using a colon.

As per the PSR-2 coding standard, case statements should not be wrapped in curly braces. There is no need for braces, since each case is terminated by the next break.

There is also the option to use a semicolon instead of a colon, this is discouraged because many programmers do not even know it works and the colon is universal between programming languages.

switch ($expr) {
    case "A": { //wrong
        doSomething();
        break;
    }
    case "B"; //wrong
        doSomething();
        break;
    case "C": //right
        doSomething();
        break;
}

To learn more about the PSR-2 coding standard, please refer to the PHP-Fig.

Loading history...
67
                @list ($behavior) = $param;
0 ignored issues
show
Security Best Practice introduced by
It seems like you do not handle an error condition here. This can introduce security issues, and is generally not recommended.

If you suppress an error, we recommend checking for the error condition explicitly:

// For example instead of
@mkdir($dir);

// Better use
if (@mkdir($dir) === false) {
    throw new \RuntimeException('The directory '.$dir.' could not be created.');
}
Loading history...
68
                $args = [$key, $subCommand, $behavior];
69
                break;
70
            }
71
            default : {
0 ignored issues
show
Coding Style introduced by
DEFAULT statements must be defined using a colon

As per the PSR-2 coding standard, default statements should not be wrapped in curly braces.

switch ($expr) {
    default: { //wrong
        doSomething();
        break;
    }
}

switch ($expr) {
    default: //right
        doSomething();
        break;
}

To learn more about the PSR-2 coding standard, please refer to the PHP-Fig.

Loading history...
72
                $args = [];
73
                break;
74
            }
75
        }
76
77 1
        return $this->dispatch(Builder::build($command, $args));
78
    }
79
80
    /**
81
     * @override
82
     * @inheritDoc
83
     */
84 1 View Code Duplication
    public function bitOp($operation, $dstKey, $srcKey, ...$keys)
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...
85
    {
86 1
        $command = Enum::BITOP;
87 1
        $args = [$operation, $dstKey, $srcKey];
88 1
        $args = array_merge($args, $keys);
89
90 1
        return $this->dispatch(Builder::build($command, $args));
91
    }
92
93
    /**
94
     * @override
95
     * @inheritDoc
96
     */
97 1 View Code Duplication
    public function bitPos($key, $bit, $start = 0, $end = -1)
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...
98
    {
99 1
        $command = Enum::BITPOS;
100 1
        $args = [$key, $bit, $start, $end];
101
102 1
        return $this->dispatch(Builder::build($command, $args));
103
    }
104
105
    /**
106
     * @override
107
     * @inheritDoc
108
     */
109 1 View Code Duplication
    public function decr($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...
110
    {
111 1
        $command = Enum::DECR;
112 1
        $args = [$key];
113
114 1
        return $this->dispatch(Builder::build($command, $args));
115
    }
116
117
    /**
118
     * @override
119
     * @inheritDoc
120
     */
121 1
    public function decrBy($key, $decrement)
122
    {
123 1
        $command = Enum::DECRBY;
124 1
        $args = [$key, $decrement];
125
126 1
        return $this->dispatch(Builder::build($command, $args));
127
    }
128
129
    /**
130
     * @override
131
     * @inheritDoc
132
     */
133 3 View Code Duplication
    public function get($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...
134
    {
135 3
        $command = Enum::GET;
136 3
        $args = [$key];
137
138 3
        return $this->dispatch(Builder::build($command, $args));
139
    }
140
141
    /**
142
     * @override
143
     * @inheritDoc
144
     */
145 2
    public function getBit($key, $offset)
146
    {
147 2
        $command = Enum::GETBIT;
148 2
        $args = [$key, $offset];
149
150 2
        return $this->dispatch(Builder::build($command, $args));
151
    }
152
153
    /**
154
     * @override
155
     * @inheritDoc
156
     */
157 1
    public function getRange($key, $start, $end)
158
    {
159 1
        $command = Enum::GETRANGE;
160 1
        $args = [$key, $start, $end];
161
162 1
        return $this->dispatch(Builder::build($command, $args));
163
    }
164
165
    /**
166
     * @override
167
     * @inheritDoc
168
     */
169 1
    public function getSet($key, $value)
170
    {
171 1
        $command = Enum::GETSET;
172 1
        $args = [$key, $value];
173
174 1
        return $this->dispatch(Builder::build($command, $args));
175
    }
176
177
    /**
178
     * @override
179
     * @inheritDoc
180
     */
181 1 View Code Duplication
    public function incr($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...
182
    {
183 1
        $command = Enum::INCR;
184 1
        $args = [$key];
185
186 1
        return $this->dispatch(Builder::build($command, $args));
187
    }
188
189
    /**
190
     * @override
191
     * @inheritDoc
192
     */
193 1
    public function incrBy($key, $increment)
194
    {
195 1
        $command = Enum::INCRBY;
196 1
        $args = [$key, $increment];
197
198 1
        return $this->dispatch(Builder::build($command, $args));
199
    }
200
201
    /**
202
     * @override
203
     * @inheritDoc
204
     */
205 1
    public function incrByFloat($key, $increment)
206
    {
207 1
        $command = Enum::INCRBYFLOAT;
208 1
        $args = [$key, $increment];
209
210 1
        return $this->dispatch(Builder::build($command, $args));
211
    }
212
213
    /**
214
     * @override
215
     * @inheritDoc
216
     */
217 26
    public function set($key, $value, array $options = [])
218
    {
219 26
        $command = Enum::SET;
220 26
        array_unshift($options, $key, $value);
221 26
        $args = $options;
222
223 26
        return $this->dispatch(Builder::build($command, $args));
224
    }
225
226
    /**
227
     * @override
228
     * @inheritDoc
229
     */
230 2
    public function setBit($key, $offset, $value)
231
    {
232 2
        $command = Enum::SETBIT;
233 2
        $args = [$key, $offset, $value];
234
235 2
        return $this->dispatch(Builder::build($command, $args));
236
    }
237
238
    /**
239
     * @override
240
     * @inheritDoc
241
     */
242 3
    public function setEx($key, $seconds, $value)
243
    {
244 3
        $command = Enum::SETEX;
245 3
        $args = [$key, $seconds, $value];
246
247 3
        return $this->dispatch(Builder::build($command, $args));
248
    }
249
250
    /**
251
     * @override
252
     * @inheritDoc
253
     */
254 1
    public function setNx($key, $value)
255
    {
256 1
        $command = Enum::SETNX;
257 1
        $args = [$key, $value];
258
259 1
        return $this->dispatch(Builder::build($command, $args));
260
    }
261
262
    /**
263
     * @override
264
     * @inheritDoc
265
     */
266 1
    public function setRange($key, $offset, $value)
267
    {
268 1
        $command = Enum::SETRANGE;
269 1
        $args = [$key, $offset, $value];
270
271 1
        return $this->dispatch(Builder::build($command, $args));
272
    }
273
274
    /**
275
     * @override
276
     * @inheritDoc
277
     */
278 1
    public function pSetEx($key, $milliseconds, $value)
279
    {
280 1
        $command = Enum::PSETEX;
281 1
        $args = [$key, $milliseconds, $value];
282
283 1
        return $this->dispatch(Builder::build($command, $args));
284
    }
285
286
    /**
287
     * @override
288
     * @inheritDoc
289
     */
290 3 View Code Duplication
    public function mGet($key, ...$keys)
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...
291
    {
292 3
        $command = Enum::MGET;
293 3
        $args = [$key];
294 3
        $args = array_merge($args, $keys);
295
296 3
        return $this->dispatch(Builder::build($command, $args));
297
    }
298
299
    /**
300
     * @override
301
     * @inheritDoc
302
     */
303 2 View Code Duplication
    public function mSet(array $kvMap)
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...
304
    {
305 2
        $command = Enum::MSET;
306 2
        $args = [];
307 2
        if (!empty($kvMap)) {
308 2
            foreach ($kvMap as $key => $val) {
309 2
                $args[] = $key;
310 2
                $args[] = $val;
311
            }
312
        }
313
314 2
        return $this->dispatch(Builder::build($command, $args));
315
    }
316
317
    /**
318
     * @override
319
     * @inheritDoc
320
     */
321 1 View Code Duplication
    public function mSetNx($kvMap)
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...
322
    {
323 1
        $command = Enum::MSETNX;
324 1
        $args = [];
325 1
        if (!empty($kvMap)) {
326 1
            foreach ($kvMap as $key => $val) {
327 1
                $args[] = $key;
328 1
                $args[] = $val;
329
            }
330
        }
331
332 1
        return $this->dispatch(Builder::build($command, $args));
333
    }
334
335
    /**
336
     * @override
337
     * @inheritDoc
338
     */
339 1 View Code Duplication
    public function strLen($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...
340
    {
341 1
        $command = Enum::STRLEN;
342 1
        $args = [$key];
343
344 1
        return $this->dispatch(Builder::build($command, $args));
345
    }
346
347
    /**
348
     * @override
349
     * @inheritDoc
350
     */
351 2 View Code Duplication
    public function del($key,...$keys)
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...
352
    {
353 2
        $command = Enum::DEL;
354 2
        $keys[] = $key;
355 2
        $args = $keys;
356
357 2
        return $this->dispatch(Builder::build($command, $args));
358
    }
359
360
    /**
361
     * @override
362
     * @inheritDoc
363
     */
364 2 View Code Duplication
    public function dump($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...
365
    {
366
        // TODO: Implement dump() method.
367 2
        $command = Enum::DUMP;
368 2
        $args = [$key];
369
370 2
        return $this->dispatch(Builder::build($command, $args));
371
    }
372
373
    /**
374
     * @override
375
     * @inheritDoc
376
     */
377 1 View Code Duplication
    public function exists($key, ...$keys)
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...
378
    {
379 1
        $command = Enum::EXISTS;
380 1
        $args = [$key];
381 1
        $args = array_merge($args, $keys);
382
383 1
        return $this->dispatch(Builder::build($command, $args));
384
    }
385
386
    /**
387
     * @override
388
     * @inheritDoc
389
     */
390
    public function expire($key, $seconds)
391
    {
392
        $command = Enum::EXPIRE;
393
        $args = [$key, $seconds];
394
395
        return $this->dispatch(Builder::build($command, $args));
396
    }
397
398
    /**
399
     * @override
400
     * @inheritDoc
401
     */
402 1
    public function expireAt($key, $timestamp)
403
    {
404 1
        $command = Enum::EXPIREAT;
405 1
        $args = [$key, $timestamp];
406
407 1
        return $this->dispatch(Builder::build($command, $args));
408
    }
409
410
    /**
411
     * @override
412
     * @inheritDoc
413
     */
414 1 View Code Duplication
    public function persist($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...
415
    {
416 1
        $command = Enum::PERSIST;
417 1
        $args = [$key];
418
419 1
        return $this->dispatch(Builder::build($command, $args));
420
    }
421
422
    /**
423
     * @override
424
     * @inheritDoc
425
     */
426 1
    public function pExpire($key, $milliseconds)
427
    {
428 1
        $command = Enum::PEXPIRE;
429 1
        $args = [$key, $milliseconds];
430
431 1
        return $this->dispatch(Builder::build($command, $args));
432
    }
433
434
    /**
435
     * @override
436
     * @inheritDoc
437
     */
438 1 View Code Duplication
    public function pExpireAt($key, $milTimestamp)
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...
439
    {
440 1
        $command = Enum::PEXPIREAT;
441 1
        $args = [$key, $milTimestamp];
442
443 1
        return $this->dispatch(Builder::build($command, $args));
444
    }
445
446
    /**
447
     * @override
448
     * @inheritDoc
449
     */
450 1 View Code Duplication
    public function touch($key, ...$keys)
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...
451
    {
452 1
        $command = Enum::TOUCH;
453 1
        $args = [$key];
454 1
        $args = array_merge($args, $keys);
455
456 1
        return $this->dispatch(Builder::build($command, $args));
457
    }
458
459
    /**
460
     * @override
461
     * @inheritDoc
462
     */
463 2 View Code Duplication
    public function ttl($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...
464
    {
465 2
        $command = Enum::TTL;
466 2
        $args = [$key];
467
468 2
        return $this->dispatch(Builder::build($command, $args));
469
    }
470
471
    /**
472
     * @override
473
     * @inheritDoc
474
     */
475 1 View Code Duplication
    public function type($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...
476
    {
477 1
        $command = Enum::TYPE;
478 1
        $args = [$key];
479
480 1
        return $this->dispatch(Builder::build($command, $args));
481
    }
482
483
    /**
484
     * @override
485
     * @inheritDoc
486
     */
487 View Code Duplication
    public function unLink($key, ...$keys)
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...
488
    {
489
        $command = Enum::UNLINK;
490
        $args = [$key];
491
        $args = array_merge($args, $keys);
492
493
        return $this->dispatch(Builder::build($command, $args));
494
    }
495
496
    /**
497
     * @override
498
     * @inheritDoc
499
     */
500
    public function wait($numSlaves, $timeout)
501
    {
502
        // TODO: Implement wait() method.
503
        $command = Enum::WAIT;
504
        $args = [$numSlaves, $timeout];
505
506
        return $this->dispatch(Builder::build($command, $args));
507
    }
508
509
    /**
510
     * @override
511
     * @inheritDoc
512
     */
513 1
    public function randomKey()
514
    {
515 1
        $command = Enum::RANDOMKEY;
516
517 1
        return $this->dispatch(Builder::build($command));
518
    }
519
520
    /**
521
     * @override
522
     * @inheritDoc
523
     */
524 1
    public function rename($key, $newKey)
525
    {
526 1
        $command = Enum::RENAME;
527 1
        $args = [$key, $newKey];
528
529 1
        return $this->dispatch(Builder::build($command, $args));
530
    }
531
532
    /**
533
     * @override
534
     * @inheritDoc
535
     */
536 1
    public function renameNx($key, $newKey)
537
    {
538 1
        $command = Enum::RENAMENX;
539 1
        $args = [$key, $newKey];
540
541 1
        return $this->dispatch(Builder::build($command, $args));
542
    }
543
544
    /**
545
     * @override
546
     * @inheritDoc
547
     */
548 1
    public function restore($key, $ttl, $value)
549
    {
550 1
        $command = Enum::RESTORE;
551 1
        $args = [$key, $ttl, $value];
552
553 1
        return $this->dispatch(Builder::build($command, $args));
554
    }
555
556
    /**
557
     * @override
558
     * @inheritDoc
559
     */
560 3 View Code Duplication
    public function pTtl($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...
561
    {
562 3
        $command = Enum::PTTL;
563 3
        $args = [$key];
564
565 3
        return $this->dispatch(Builder::build($command, $args));
566
    }
567
568
    /**
569
     * @override
570
     * @inheritDoc
571
     */
572
    public function move($key, $db)
573
    {
574
        // TODO: Implement move() method.
575
        $command = Enum::MOVE;
576
        $args = [$key, $db];
577
578
        return $this->dispatch(Builder::build($command, $args));
579
    }
580
581
    /**
582
     * @override
583
     * @inheritDoc
584
     */
585 View Code Duplication
    public function scan($cursor, array $options = [])
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...
586
    {
587
        $command = Enum::SCAN;
588
        $args = [$cursor];
589
        $args = array_merge($args, $options);
590
591
        return $this->dispatch(Builder::build($command, $args));
592
    }
593
594
    /**
595
     * @override
596
     * @inheritDoc
597
     */
598 View Code Duplication
    public function sort($key, array $options = [])
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...
599
    {
600
        // TODO: Implement sort() method.
601
        $command = Enum::SORT;
602
        $args = [$key];
603
        $args = array_merge($args, $options);
604
605
        return $this->dispatch(Builder::build($command, $args));
606
    }
607
}
608