Passed
Push — master ( 9cb37e...3ceb50 )
by Dmitry
01:15
created

Client   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A push() 0 4 1
A count() 0 4 1
A remove() 0 4 1
A call() 0 4 1
1
<?php
2
3
namespace SymfonyBundles\RedisBundle\Redis;
4
5
class Client extends \Predis\Client implements ClientInterface
6
{
7
    /**
8
     * {@inheritdoc}
9
     */
10 1
    public function push(string $key, ...$values): int
11
    {
12 1
        return $this->call('rpush', array_merge([$key], $values));
13
    }
14
15
    /**
16
     * {@inheritdoc}
17
     */
18 1
    public function count(string $key): int
19
    {
20 1
        return $this->call('llen', [$key]);
21
    }
22
23
    /**
24
     * {@inheritdoc}
25
     */
26 1
    public function remove(string $key): int
27
    {
28 1
        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 1
    protected function call($command, array $arguments = [])
40
    {
41 1
        return $this->executeCommand($this->createCommand($command, $arguments));
42
    }
43
}
44