Test Setup Failed
Pull Request — master (#7)
by Dmitry
05:07
created

Client::count()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace SymfonyBundles\RedisBundle\Redis;
4
5
class Client extends \Predis\Client implements ClientInterface
6
{
7
    /**
8
     * {@inheritdoc}
9
     */
10
    public function push(string $key, ...$values): int
11
    {
12
        return $this->call('rpush', array_merge([$key], $values));
13
    }
14
15
    /**
16
     * {@inheritdoc}
17
     */
18
    public function count(string $key): int
19
    {
20
        return $this->call('llen', [$key]);
21
    }
22
23
    /**
24
     * {@inheritdoc}
25
     */
26
    public function remove(string $key): int
27
    {
28
        return $this->call('del', [$key]);
29
    }
30
31
    /**
32
     * Creates a Redis command with the specified arguments and sends a request to the server.
33
     *
34
     * @param string $command   the command ID
35
     * @param array  $arguments the arguments for the command
36
     *
37
     * @return mixed
38
     */
39
    protected function call($command, array $arguments = [])
40
    {
41
        return $this->executeCommand($this->createCommand($command, $arguments));
42
    }
43
}
44