Completed
Pull Request — master (#3)
by
unknown
02:53
created

ApiKeyValTrait::expireAt()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

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